Compare commits

...
1305 Commits
Author SHA1 Message Date
bol-van 8283f4cd76 update makefiles 2026-10-29 15:55:59 +03:00
bol-van 019bbe845f update docs 2026-10-28 10:03:42 +03:00
bol-van 9679d58499 cosmetic 2026-10-28 06:43:50 +03:00
bol-van ca7ed6a986 zapret-obfs: udp2icmp update id cache access time in both directions 2026-10-27 19:01:17 +03:00
bol-van c460884213 zapret-obfs: support cgnat in udp2icmp 2026-10-27 18:50:51 +03:00
bol-van 3570f193d5 update docs 2026-10-27 18:48:28 +03:00
bol-van 8be19e079d update docs 2026-10-27 11:23:37 +03:00
bol-van 4a33055448 nfqws2: fix UAF 2026-10-22 11:06:42 +03:00
bol-van 221d7dff24 update docs 2026-10-21 11:49:48 +03:00
bol-van f94b562482 blockcheck2: more sweeps 2026-10-21 11:49:22 +03:00
bol-van 6ec7ee67ce Merge pull request #315 from sasha-spb-ru/add-veryquick-scan-level
[blockcheck2] Add a separate very quick scan level
2026-10-21 09:08:59 +03:00
bol-van 98757082b8 blockcheck2: use guard timer in all OS 2026-10-20 18:40:30 +03:00
bol-van 5786448c93 update docs 2026-10-20 17:33:26 +03:00
bol-van a0028b9895 blockcheck2: optimize PACE 2026-10-20 17:10:25 +03:00
bol-van 486626d28f Merge pull request #329 from maxsupermanhd/blockcheck-pace
blockcheck2: request pacing
2026-10-20 17:05:53 +03:00
bol-van f8d08b8436 AI fixes 2026-10-20 15:28:52 +03:00
bol-van a4515beb32 update docs 2026-10-20 09:57:59 +03:00
bol-van 299f833f39 blockcheck2.sh: temp files sweeper fix 2026-10-20 09:56:13 +03:00
bol-van a0c928be45 Merge pull request #314 from sasha-spb-ru/clean-up-leftover-tmpfiles
[blockcheck2] Sweep leftover temp files from a killed/crashed run
2026-10-20 09:40:10 +03:00
bol-van f256fea2d8 fix inconsistances in docs and comments 2026-10-20 09:16:53 +03:00
bol-van 3a6f75cd3c update docs 2026-10-20 08:32:10 +03:00
maxsupermanhd 44fbf1b18e blockcheck2: request pacing 2026-10-19 01:49:03 +03:00
bol-van a1adf7b868 nfqws2: support rare partial root environment 2026-10-04 10:18:18 +03:00
bol-van ca950d838a zapret-lib: comments spelling 2026-09-29 08:18:27 +03:00
bol-van 873642573e update docs 2026-09-28 22:35:22 +03:00
Alexander Golovanov e41e4f18c7 [blockcheck2] Add a separate very quick scan level
quick is meant to be the fast option, but it only changes how repeated
attempts are handled - it still works through every variation of a
strategy regardless. For strategies built around a fake TLS handshake,
that means testing dozens of small tweaks (different TTLs, different
TCP tricks, extra padding, split positions) well past the point where
an early exit would have been possible.

The new veryquick level stops as soon as a strategy succeeds, instead
of continuing through the rest just to be thorough. It's a separate
option rather than a change to quick, so quick, standard, and force
behave exactly as they did.
2026-09-18 16:30:33 +03:00
Alexander Golovanov 03ce20156a [blockcheck2] Sweep leftover temp files from a killed/crashed run
The pad file, PARALLEL_OUT, and HDRTEMP are all already removed on
a normal exit - Ctrl+C, closing the terminal, a plain kill all clean
up after themselves. kill -9 and crashes skip that entirely, same as
for any script, and a later run has no way to know about a different
PID's leftovers - so all three can pile up in /tmp indefinitely.

Before each is used, the script now checks for existing files matching
its pattern and removes any whose PID is confirmed no longer running.
A file still owned by a live process - a second instance running
at the same time - is left alone.
2026-09-18 14:08:10 +03:00
bol-van 00f5aaa36d update docs 2026-09-18 11:30:00 +03:00
bol-van 1e329918dc update docs 2026-09-18 11:26:08 +03:00
bol-van 8a398236ac update docs 2026-09-18 11:25:13 +03:00
bol-van 074c981a37 update docs 2026-09-18 11:24:24 +03:00
bol-van 03c139f34a update docs 2026-09-18 11:21:19 +03:00
bol-van cdcb8d4711 update docs 2026-09-18 11:20:16 +03:00
bol-van 970adb5d55 update docs 2026-09-18 11:18:44 +03:00
bol-van 6535202a9a update docs 2026-09-18 11:15:43 +03:00
bol-van 9bff218b9a update docs 2026-09-18 11:14:28 +03:00
bol-van 3e3b902902 update docs 2026-09-18 11:12:24 +03:00
bol-van 0f65389571 blockcheck2: CURL_PAD_KB=>CURL_PAD. split padding into smaller headers 2026-09-18 10:54:36 +03:00
bol-van ec25da2277 blockcheck2: warn about eval failing strategies in custom list 2026-09-18 10:04:10 +03:00
bol-van 0d2227caf6 Merge pull request #313 from sasha-spb-ru/add-request-padding
[blockcheck2] Add a way to test the size-based block without a real download
2026-09-18 09:55:41 +03:00
bol-van eb42084b30 Merge pull request #311 from sasha-spb-ru/show-strategy-coverage
[blockcheck2] Add a coverage summary next to the results
2026-09-18 09:54:42 +03:00
bol-van 3b6f0cc345 Merge pull request #310 from sasha-spb-ru/fix-strategy-escaping
[blockcheck2] Stop requiring manual escaping in strategy lists
2026-09-18 09:51:38 +03:00
bol-van 28b6fb853e Merge pull request #297 from zaveshaa/fix-doubled-word
docs: fix doubled word in manual.en.md
2026-09-17 22:03:01 +03:00
bol-van bf3b30af9c Merge pull request #290 from 0-x-0-0/fix-static-analyzer-warnings
Fix -Wcast-qual and -Wlogical-op-parentheses warnings
2026-09-17 22:01:57 +03:00
Alexander Golovanov 34a95e8a41 [blockcheck2] Add a way to test the size-based block without a real download
The "16 KB" block triggers based on how much data passes through the
connection, not on what that data actually is. Testing for it usually
means pointing at a page you know is big enough to download - but that
only works if your target actually has one.

Adds CURL_PAD_KB: set it to a number and every request gets padded
with that many KB of junk data, so the block can be triggered against
any target, even a bare server with nothing to download. Off by
default, and doesn't change anything unless you turn it on.

The padding is written to a temp file and attached from there, not
built inline: a large inline value can hit low, easy-to-reach limits
on some platforms (Cygwin among them).
2026-09-17 12:57:31 +03:00
Alexander Golovanov bf64220ab8 [blockcheck2] Stop requiring manual escaping in strategy lists
Custom strategy lists are plain text, and each line gets run through
the shell - so a strategy containing certain characters (<, parentheses,
quotes) would fail unless you added quotes around it by hand. Some real,
valid strategies use exactly these characters.

Now, when a line fails for that reason, it's automatically retried in
a simpler way that doesn't care about those characters at all. You can
paste a strategy in exactly as blockcheck2 prints it and it'll just
work. Manual escaping still works too, and is tried first if you're
already doing it.
2026-09-17 11:31:30 +03:00
Alexander Golovanov adf7791367 [blockcheck2] Add a coverage summary next to the results
When testing several targets at once, the results only ever show
strategies that worked for every single one. If your targets are
a bunch of unrelated servers, that list can easily come up empty
even when several strategies each work for most of them.

Adds a second summary that lists every strategy that worked at all,
with how many targets it worked for, best first - so you can see
which one comes closest instead of getting an all-or-nothing answer.
2026-09-17 11:24:21 +03:00
bol-van 1ea7d10f6f update docs 2026-09-16 16:41:14 +03:00
bol-van 859c24d32b update docs 2026-09-16 16:22:20 +03:00
bol-van 5df635efdb nfqws2: HttpReplyLooksLikeDPIRedirect accept # and ? chars as domain end 2026-09-16 16:20:51 +03:00
bol-van 7119ffce54 zapret-lib: dissect_url accept # and ? chars as domain end 2026-09-16 16:14:48 +03:00
bol-van 2efdb70b1c nfqws2: make autolists nonempty even if loading failed 2026-09-15 21:51:18 +03:00
bol-van 692139aeea zapret-lib: dissect quic tvb values that can't fit into 52-bit mantissa into raw strings 2026-09-15 18:58:21 +03:00
bol-van 6b6c63e338 update docs 2026-09-15 15:21:18 +03:00
bol-van 5fab86344a nfqws2: do not make autohostlists nonempty if no lists were reloaded 2026-09-15 15:02:28 +03:00
bol-van c1e8e7c0d9 nfqws2: dp_match_data optimize struct members 2026-09-15 12:13:17 +03:00
bol-van d9fde580e6 nfqws2: dp_match_data optimize struct members 2026-09-15 12:12:34 +03:00
bol-van 5ebfa6c0dc nfqws2: move dp_match() args to struct 2026-09-15 12:09:54 +03:00
bol-van a1bca5a85e update docs 2026-09-07 21:18:32 +03:00
bol-van 3122b66190 nfqws2: optimize profile search. fast checks first 2026-09-07 21:03:48 +03:00
bol-van 0b8182d24a zapret-lib: fix length checking for keyshare extension in tls_dissect_ext 2026-09-02 10:49:58 +03:00
bol-van 8b50962e66 nfqws2: --filter-mark 2026-09-02 10:36:00 +03:00
bol-van a7ff6410d6 update docs 2026-09-02 09:35:10 +03:00
bol-van 6e186a3b38 nfqws2: pad tcp options with 0x00 in reconstruct. strip 0x00 ending options in dissect. 2026-09-02 09:18:27 +03:00
bol-van 36355d46e3 nfqws2: fix exit on HUP 2026-08-28 09:04:12 +03:00
bol-van 2f8948d0eb nfqws2:dont break on eol tcpopt in dissect 2026-08-25 08:07:53 +03:00
bol-van 68514ed871 blind patch fix 2026-08-24 21:43:31 +03:00
bol-van 204e95ad0e nfqws22: pad tcp opts with zero 2026-08-24 20:41:26 +03:00
zaveshaa 3c93f925be docs: fix doubled word in manual.en.md 2026-08-23 21:11:10 +03:00
bol-van 07c69bf132 blockcheck2: fix script crash on bad strategies from the file in custom/10-list.sh 2026-08-23 19:50:13 +03:00
bol-van 2080981cea zapret-lib: minor optimize 2026-08-23 15:58:54 +03:00
bol-van c4e4fff4a0 zapret-lib: minor optimize 2026-08-23 15:58:02 +03:00
bol-van 1c5d49699c AI and manual fixes 2026-08-23 12:07:59 +03:00
bol-van a0be7cbb40 update docs 2026-08-20 18:55:40 +03:00
bol-van e263849b1b update docs 2026-08-20 18:53:41 +03:00
bol-van 46010c4a42 nfqws2: negate ssid/nlm filters 2026-08-20 18:45:49 +03:00
bol-van b08ae78778 update docs 2026-08-19 10:06:17 +03:00
bol-van 49e2d438d8 github, builder_linux: lua 5.5.1 2026-08-19 10:03:56 +03:00
bol-van a8d24607a5 blockcheck2: --wf-dup-check not needed anymore 2026-08-15 16:54:32 +03:00
bol-van 5e84833269 blockcheck2: optimize 2026-08-15 15:42:52 +03:00
bol-van fbeb124cf8 blockcheck2: use --wf-raw-filter in Windows instead of --ipset to limit target IP addresses 2026-08-15 12:08:09 +03:00
0-x-0-0 3f87539d7c Fix compiler/static analyzer warnings 2026-08-08 14:54:40 +03:00
bol-van 032651deeb update docs 2026-08-02 07:01:51 +03:00
bol-van bdad7d7be1 update docs 2026-08-01 14:11:01 +03:00
bol-van 86bcc7db16 update docs 2026-08-01 09:58:52 +03:00
bol-van 569297c623 update docs 2026-07-31 21:54:19 +03:00
bol-van 2c21faa80e github: remove high_entropy_va patch for windivert.dll, but leave dynamic_base 2026-07-31 10:31:30 +03:00
bol-van 90097be91a Merge pull request #280 from goodrussian666/master
Fixed the double-free reports in [nfqws.c (line 1118)
2026-07-31 09:53:21 +03:00
bol-van c61706cc47 update docs 2026-07-31 09:48:37 +03:00
bol-van 5f2807e0c5 builder_linux: zlib_ng optional support 2026-07-31 09:48:12 +03:00
bol-van dd85b1f852 nfqws2: remove file_mod_time() 2026-07-31 09:03:33 +03:00
bol-van b93b84791d zapret-antidpi: remove debug output 2026-07-30 22:05:03 +03:00
bol-van 4668664ee7 update docs 2026-07-30 19:02:40 +03:00
bol-van 78bbd0ee51 update docs 2026-07-30 19:01:43 +03:00
bol-van e185d5ce60 nfqws2: check for left space during udp and icmp reconstruct 2026-07-30 17:36:04 +03:00
bol-van d55fe738eb zapret-lib: include func instance in desync_timer_name 2026-07-30 17:24:29 +03:00
bol-van a8399a59fe nfqws2: do not allow more than 2 args in conntrack_feed() 2026-07-30 17:18:52 +03:00
bol-van 37e5a8a880 nfqws2: fix hostlist and ipset load if modtime is unixtime 0 2026-07-30 17:16:16 +03:00
bol-van 3b465d9981 nfqws2: stop execution plan in C code if a blob is unavailable 2026-07-30 16:34:06 +03:00
Your Name 11bc8f4fd1 Fixed the double-free reports in [nfqws.c (line 1118)
blob_collection_add() now occurs only after name/file validation and duplicate-name checks. This prevents exit_clean() from traversing a partially registered blob while name is being freed locally.

nfq2/nfqws.c:1140:4: error: Memory pointed to by 'name' is freed twice. [doubleFree]
nfq2/nfqws.c:1148:5: error: Memory pointed to by 'name' is freed twice. [doubleFree]
nfq2/nfqws.c:1159:3: error: Memory pointed to by 'name' is freed twice. [doubleFree]
nfq2/nfqws.c:1164:3: error: Memory pointed to by 'name' is freed twice. [doubleFree]
2026-07-29 20:35:31 +02:00
bol-van 80bb86e833 blockcheck2: unify messages 2026-07-23 13:46:31 +03:00
bol-van d7e6e3fb60 blockcheck2: disable tls1.3 and quic tests in batch mode if curl does not support them 2026-07-23 13:45:17 +03:00
bol-van ea047535b9 blockcheck2: revert cygstart method as it brings more problems than profit 2026-07-23 12:50:57 +03:00
bol-van a3202599aa blockcheck2: optimize signal trap/untrap 2026-07-22 21:26:05 +03:00
bol-van b8f142253b blockcheck2: wait for cygwin pid in case of signal 2026-07-22 21:13:48 +03:00
bol-van ccb6e9b534 blockcheck2: wait up to 2 seconds for the winws2 pidfile to appear 2026-07-22 20:21:36 +03:00
bol-van 3d4828d61f blockcheck2: graceful shutdown on QUIT signal 2026-07-22 13:13:34 +03:00
bol-van 0020a8de6a blockcheck2: graceful shutdown on TERM signal 2026-07-22 13:10:27 +03:00
bol-van 6f63dbc3a8 blockcheck2: use kill -f in cygwin to speed up kill 2026-07-22 09:49:43 +03:00
bol-van bb042f734e update docs 2026-07-22 08:31:39 +03:00
bol-van e6b22f3868 blockcheck2: remove spaces in assignment 2026-07-21 20:09:41 +03:00
bol-van c73af75881 blockcheck2: use instead of in killwait 2026-07-21 20:01:27 +03:00
bol-van 889d120235 blockcheck2: fix non-working 'wait' after cygstart 2026-07-21 19:53:41 +03:00
bol-van b78b52c4cd blockcheck2: use cygstart in windows to avoid fork problems (without cygwin rebase) 2026-07-20 20:42:29 +03:00
bol-van 1d85620abd nfqws2: DLOG_ERR in timer out of memory case 2026-07-20 20:18:21 +03:00
bol-van 4b9b938db2 update changes.txt 2026-07-20 19:55:07 +03:00
bol-van 43a18c7eb7 init.d: extend discord media ports to 19294-19344 2026-07-20 19:53:18 +03:00
bol-van 49c8dfedc9 init.d: extend discord media ports to 19294-19344 2026-07-20 19:51:18 +03:00
bol-van 8a0f53f3cf nfqws2: small AI fixes 2026-07-16 18:33:23 +03:00
bol-van 8d34a4b7a2 nfqws2: limit delayed packet queue to 64 packets (anti-ddos) 2026-07-04 12:37:12 +03:00
bol-van bc6b8c64a4 nfqws2: minor fix in TLSAdvanceToHostInSNI 2026-07-04 11:27:46 +03:00
bol-van c5325fc267 blockcheck fix 2026-06-25 07:01:41 +03:00
bol-van d1b80a4254 builder-linux: curl download retries and timeouts 2026-06-24 14:29:18 +03:00
bol-van 4759d64c27 update docs 2026-06-23 20:18:56 +03:00
bol-van d9acc873fa Merge pull request #195 from goodrussian666/master
cppcheck cleanup
2026-06-23 16:40:01 +00:00
bol-van 4e5efbf2b2 update docs 2026-06-23 19:35:16 +03:00
bol-van b35db6aac5 Merge pull request #249 from loop-uh/master
орфография + фикс ошибок и ссылок
2026-06-23 16:33:22 +00:00
bol-van c54533bbb2 nfqws2: accept string or function in timer_set() 2026-06-22 19:45:43 +03:00
bol-van 8afe88dea7 update docs 2026-06-21 19:08:36 +03:00
bol-van a599b4016b update docs 2026-06-21 19:06:44 +03:00
loop-uh d2c85ec8b7 орфография + фикс ошибок и ссылок 2026-06-20 19:10:46 +03:00
bol-van 15bc21d75b update docs 2026-06-16 16:33:43 +03:00
bol-van 4df9449786 nfqws2: fix 60 msec --lua-gc default to 60 sec 2026-06-16 15:50:39 +03:00
bol-van 9474a64d27 nfqws2: do not call timer search by name if not dirty 2026-06-08 20:28:37 +03:00
bol-van 31904a564e nfqws2: compile fix for bsd and lexra 2026-06-08 13:50:42 +03:00
bol-van fd9896846a nfqws2: lua-gc arg check fix 2026-06-08 13:41:14 +03:00
bol-van 2aa5d9ee37 nfqws2: minor optimize 2026-06-08 09:54:40 +03:00
bol-van da3d28f467 nfqws2: optimize 2026-06-08 08:02:13 +03:00
bol-van 5e2b6d8bde nfqws2: AI fixes 2026-06-07 19:09:27 +03:00
bol-van 08d27bf0a2 install_easy: do not use apk in openwrt if it doesn't have db in /lib/apk/db 2026-06-07 09:06:10 +03:00
bol-van d214ebf2de update docs 2026-06-07 08:39:12 +03:00
bol-van fe8b8df2ae nfqws2,zapret-lib: fix wrong spelling : WRITEABLE -> WRITABLE 2026-06-07 08:34:40 +03:00
bol-van 441d2e3cfc update docs 2026-06-06 21:57:18 +03:00
bol-van b37f17e623 zapret-antidpi: do not VERDICT_DROP in send with delay option 2026-06-06 21:50:47 +03:00
bol-van 7b82744d4d nfqws2: fix unitialized lua_ref field access 2026-06-06 09:43:28 +03:00
bol-van 211867eca5 update docs 2026-06-02 10:47:55 +03:00
bol-van c90e0e9a7f zapret-lib: fix oob urp=0 case in rawsend_dissect_segmented 2026-05-27 16:55:51 +03:00
bol-van fd4716da54 update docs 2026-05-09 22:04:07 +03:00
bol-van 5dcb6c1163 zapret-antidpi: send delayed fooled dissect, not original 2026-05-09 22:00:18 +03:00
bol-van fe112c1f22 update docs 2026-05-07 18:14:20 +03:00
bol-van 850a9920f6 update docs 2026-05-07 18:12:53 +03:00
bol-van dc99547ff0 zapret-lib,zapret-antidpi: delay parameter in 'send' desync function 2026-05-07 17:59:40 +03:00
bol-van 8d08b4f9a4 nfqws2: nfq close ifname sock after queue deinit 2026-05-06 14:46:51 +03:00
bol-van 860b13c86e nfqws2: store bt_next instead of bt_prev 2026-05-06 14:45:49 +03:00
bol-van a154c223f4 update docs 2026-05-05 22:02:09 +03:00
bol-van 7a69d56a4b update docs 2026-04-30 17:00:44 +03:00
bol-van b3be87fd7c update docs 2026-04-30 16:58:18 +03:00
bol-van 62b86c3899 zapret-tests: show current time in timer test 2026-04-30 16:44:28 +03:00
bol-van 7db50c018a nfqws2: timer rework. remove timer-res 2026-04-30 13:12:56 +03:00
bol-van eb35bb34f5 update docs 2026-04-29 10:22:25 +03:00
bol-van d0c9fa9b76 copypaste fixes 2026-04-29 08:36:43 +03:00
bol-van 7441ed7119 update LICENSE year 2026-04-28 13:41:44 +03:00
bol-van bbaeeb73fe update docs 2026-04-28 10:34:56 +03:00
bol-van b1afa7079f nfqws2: timer_enum return only names 2026-04-28 10:29:33 +03:00
bol-van 01a4ee63d4 nfqws2: timer_info, timer_enum 2026-04-28 10:22:04 +03:00
bol-van 5aefa8610b nfqws2: fix wrong op priority 2026-04-25 18:55:36 +03:00
bol-van aa226e6e7a nfqws2: fix null ptr deref 2026-04-25 18:31:46 +03:00
bol-van 65bb7ac639 nfqws2: minor optimize 2026-04-22 18:38:16 +03:00
bol-van 62dcf80867 nfqws2: fix wlan interface name search in server mode 2026-04-22 18:30:32 +03:00
Your Name 7661f29ede cleanup based on cppcheck
nfq2/darkmagic.c:1965:6: style: Condition '!set_socket_fwmark(sock,fwmark)' is always false [knownConditionTrueFalse]
2026-04-17 07:18:15 +02:00
Your Name ce3c1600da ignore .vscode 2026-04-17 07:17:10 +02:00
bol-van 640a73d25c nfqws2: do not call timer code if there're no timers 2026-04-15 08:31:39 +03:00
bol-van 787e5244ad Merge pull request #181 from goodrussian666/master
code cleanup based on cppcheck
2026-04-14 06:03:30 +00:00
bol-van d42aea6a9f update docs 2026-04-14 08:19:40 +03:00
bol-van e0b48c54db builder-linux: update zlib 2026-04-13 17:01:56 +03:00
bol-van 0f63e09d64 update docs 2026-04-13 15:41:04 +03:00
bol-van bca26682e7 update docs 2026-04-13 15:34:57 +03:00
bol-van ee24e84b85 update docs 2026-04-13 15:30:08 +03:00
bol-van 9584e29189 update docs 2026-04-13 15:26:20 +03:00
bol-van 1ed2d1bc01 update docs 2026-04-13 10:04:42 +03:00
bol-van 8fa6f11c34 update docs 2026-04-13 09:36:55 +03:00
bol-van d83368e107 update docs 2026-04-13 09:30:40 +03:00
bol-van 33ea0afd56 nfqws2: replace timer in timer_set if it already exists 2026-04-13 09:21:16 +03:00
bol-van bdc4761c46 nfqws2: fix read after free 2026-04-12 20:50:27 +03:00
bol-van 0151ee6fc1 nfqws2: fix write after free 2026-04-12 20:28:43 +03:00
bol-van e479b0427b zapret-tests: local var 2026-04-12 18:06:04 +03:00
bol-van f062579ca7 nfqws2: fix wrong debug line 2026-04-12 17:45:40 +03:00
bol-van 3364294af6 nfqws2: timers 2026-04-12 17:41:47 +03:00
bol-van fe85c6d2db init.d: remove incompatible systemd sandboxing 2026-04-06 20:51:52 +03:00
Your Name d4aa4cc5b1 code cleanup based on cppcheck
nfq2/nfqws.c:1114:19: warning: Either the condition 'p' is redundant or there is possible null pointer dereference: p. [nullPointerRedundantCheck]
2026-04-04 14:06:26 +02:00
bol-van e78382f3ad nfqws2: fail if slen==0 2026-04-01 09:34:52 +03:00
bol-van 32951c0f6a nfqws2: do not fail tls_mod if dupsid,rndsni,padencap fail 2026-03-31 14:11:52 +03:00
bol-van b6dbec4cc6 nfqws2: improve reasm cancel logic 2026-03-30 13:46:29 +03:00
bol-van b2f4e7adc6 nfqws2: always cancel reasm of not TLS 2026-03-30 11:52:57 +03:00
bol-van 56c95c47c6 nfqws2: fix TLS payload reassemble if L7 protocol is not TLS 2026-03-29 16:57:58 +03:00
bol-van c6c01c63c3 update docs 2026-03-16 12:17:48 +03:00
bol-van 7d1baf6123 zapret-pcap: fix keep argument 2026-03-14 15:17:34 +03:00
bol-van 7cdc75d0db github: remove sdiv crash on old armv7 2026-03-12 20:51:57 +03:00
bol-van 348f907b47 winws2: remove .buildid section 2026-03-12 17:40:11 +03:00
bol-van d641b00083 winws2: update res bins 2026-03-12 17:31:02 +03:00
bol-van d3b3011000 AI fixes 2026-03-06 21:36:09 +03:00
bol-van 2ec512af17 AI fixes 2026-03-06 10:58:05 +03:00
bol-van d41151ef6f nfqws2: join fragments in quic CRYPTO reconstruction. allow intersections 2026-03-05 18:38:44 +03:00
bol-van 60ac3693fc nfqws2: optimize quic CRYPTO defrag 2026-03-05 09:41:41 +03:00
bol-van 766b60544f nfqws2: remove unused var 2026-03-04 22:50:31 +03:00
bol-van e563f60153 AI fixes 2026-03-04 22:36:31 +03:00
bol-van 6d7f8efc49 nfqws2: optimize quic CRYPTO defrag 2026-03-04 19:33:49 +03:00
bol-van e46cde8e6e nfqws2: optimize 2026-03-04 18:58:39 +03:00
bol-van 52072359f0 nfqws2: remove unneeded function 2026-03-04 18:54:38 +03:00
bol-van cafacf35bc nfqws2: quic CRYPTO frag early dedup 2026-03-04 18:52:47 +03:00
bol-van 55dc47bae4 nfqws2: remove unneeded loop 2026-03-04 14:16:19 +03:00
bol-van 14a2548bf5 nfqws2: allow quic CRYPTO fragment intersection and dups 2026-03-04 12:31:40 +03:00
bol-van f59ddbb645 github,linux-builder: revert to lj_alloc for arm64 and mips64 2026-03-03 19:25:33 +03:00
bol-van 96f58adc7a docs 2026-03-03 10:53:05 +03:00
bol-van b20ee9adbe zapret-lib: prevent double apply_arg_prefix 2026-03-03 10:49:55 +03:00
bol-van 7bfb4066cd update docs 2026-03-02 20:24:45 +03:00
bol-van a8a742f48c zapret-lib: call apply_arg_prefix right before instance execute 2026-03-02 20:21:38 +03:00
bol-van 03f1fc4788 init.d: warn if ipset/hostlist files inside zapret2 root 2026-03-02 14:18:57 +03:00
bol-van 3ae875f8aa AI fixes 2026-03-02 10:44:48 +03:00
bol-van 300084a654 github.linux-builder: move arm to armv6 2026-03-01 20:22:02 +03:00
bol-van ccef4377df github: use thumb in android armv7 build 2026-03-01 18:30:54 +03:00
bol-van 3ebb24930e -DLUAJIT_USE_SYSMALLOC 2026-03-01 10:22:19 +03:00
bol-van aff6fe3966 -DLUAJIT_USE_SYSMALLOC 2026-03-01 10:18:35 +03:00
bol-van f43030c0b8 AI fix 2026-03-01 09:53:55 +03:00
bol-van 69e8bb3c7f AI fixes 2026-03-01 09:48:18 +03:00
bol-van 038f64ddad update docs 2026-02-28 22:30:08 +03:00
bol-van abdf88574c github: build experiment 2026-02-28 22:25:47 +03:00
bol-van 318c625247 update builder-linux 2026-02-28 22:23:13 +03:00
bol-van 3e52d53df0 update builder-linux 2026-02-28 19:14:45 +03:00
bol-van 410ba5ae6e github: build experiment 2026-02-28 19:02:11 +03:00
bol-van bee761f0f7 github: build experiment 2026-02-28 18:53:51 +03:00
bol-van 863267e659 github: build experiment 2026-02-28 18:47:25 +03:00
bol-van c0299a27e3 github: build experiment 2026-02-28 18:43:24 +03:00
bol-van b9e22fd97e github: luajit host CFLAGS -O2 2026-02-28 18:41:18 +03:00
bol-van b3a6445d13 update builder-linux 2026-02-28 18:40:51 +03:00
bol-van 75e3c83d07 github: armv7 thumb 2026-02-28 18:33:56 +03:00
bol-van 1aaf73858c builder-linux armv7 thumb 2026-02-28 18:29:28 +03:00
bol-van 827b1cf065 AI fixes 2026-02-28 10:10:26 +03:00
bol-van e0f67fb203 AI fixes 2026-02-27 14:34:35 +03:00
bol-van da6f4c8536 init.d: remove KillMode=none from systemd unit 2026-02-26 22:05:29 +03:00
bol-van f83ecb64bb pie experiment 2026-02-26 21:23:53 +03:00
bol-van c634fd156c update builder-linux 2026-02-26 20:03:50 +03:00
bol-van c10cc5b83e update builder-linux 2026-02-26 18:46:19 +03:00
bol-van 60988755b7 update builder-linux 2026-02-26 18:41:36 +03:00
bol-van 7584d5e38f update makefiles 2026-02-26 16:44:58 +03:00
bol-van d019627fba nfqws2: e2k arch seccomp support 2026-02-26 16:34:47 +03:00
bol-van 1ac067ec32 nfqws2: separate strip option 2026-02-26 15:09:29 +03:00
bol-van 1b5811aa9a nfqws2: silence warning 2026-02-26 11:01:13 +03:00
bol-van 60c3f56c36 pie experiment 2026-02-26 10:53:35 +03:00
bol-van a0cfbbf958 pie experiment 2026-02-26 10:46:59 +03:00
bol-van 437c988f48 pie experiment 2026-02-26 10:43:45 +03:00
bol-van a9a64b0462 pie experiment 2026-02-26 10:37:15 +03:00
bol-van 9887e470dc update builder-linux 2026-02-26 10:35:31 +03:00
bol-van 5bacfcb65f pie experiment 2026-02-26 10:28:58 +03:00
bol-van 0f04698f07 pie experiment 2026-02-26 10:21:23 +03:00
bol-van 31d5e5598b pie experiment 2026-02-26 10:19:24 +03:00
bol-van 66e2cc2bc4 pie experiment 2026-02-26 10:10:28 +03:00
bol-van 8fcc64ad0c pie experiment 2026-02-26 09:47:25 +03:00
bol-van d2f3271542 dvtws2: build with PIE 2026-02-25 17:34:36 +03:00
bol-van 942c4956b8 github: rebase windivert.dll to >4gb to allow hi entropy aslr 2026-02-25 14:33:38 +03:00
bol-van 77a24a7ec1 github: set dynamicbase on windivert.dll 2026-02-25 12:22:28 +03:00
bol-van 43999d6077 winws2: enable ASLR 2026-02-25 10:49:07 +03:00
bol-van 697f9fc986 AI fixes 2026-02-25 08:56:35 +03:00
bol-van 8e76197dff luacheck fixes 2026-02-24 19:07:04 +03:00
bol-van 190f46b6d7 zapret-lib: minor fix 2026-02-24 18:43:49 +03:00
bol-van 41e26b3ace update docs 2026-02-24 16:32:21 +03:00
bol-van 8b6ea88a23 update docs 2026-02-24 10:19:01 +03:00
bol-van 59235827c4 nfqws2: fix broken wifi ssid update 2026-02-24 10:10:52 +03:00
bol-van 7073e1fd77 nfqws2: dns_extract_name OOB fixes 2026-02-23 22:47:14 +03:00
bol-van 340261da72 zapret-lib: harden apply_fooling checks 2026-02-23 19:33:58 +03:00
bol-van 937aa91e5d nfqws2: prevent OOB read in addpool 2026-02-23 18:45:25 +03:00
bol-van dbf673e24a AI fixes 2026-02-23 18:10:37 +03:00
bol-van 61b0a70fa7 nfqws2: support mixed compressed+uncomressed DNS answers 2026-02-23 10:25:27 +03:00
bol-van d985bb316f nfqws2: support uncompressed names in DNS answers 2026-02-23 09:32:45 +03:00
bol-van 59b3734643 nfqws2: add comment 2026-02-22 19:41:08 +03:00
bol-van 37f45a132f nfqws2: optimize 2026-02-22 18:49:44 +03:00
bol-van 4d753ecdc6 nfqws2: save some syscalls 2026-02-22 18:22:43 +03:00
bol-van 272f086639 nfqws2: optimize nfq buffers 2026-02-22 17:31:13 +03:00
bol-van d9ae16e56f nfqws2: nfq_handle_packet verbose error logging 2026-02-22 17:03:52 +03:00
bol-van 46d4208c76 zapret-pcap: use reconstruct_dissect if under orchestrator 2026-02-22 12:48:20 +03:00
bol-van 2a4195070f AI fixes 2026-02-22 09:06:53 +03:00
bol-van 8e974e78e2 delete sip.bin dup 2026-02-21 19:44:00 +03:00
bol-van 7df42bc486 init.d: --payload= in custom examples 2026-02-21 10:35:14 +03:00
bol-van 7c12f60e1e AI fixes 2026-02-21 10:23:25 +03:00
bol-van 4c7a3d08d8 github: upx 4.2.4 for all except riscv64 2026-02-20 18:43:22 +03:00
bol-van e146fc24c5 github: upx 4.2.4 for all except riscv64 2026-02-20 18:41:18 +03:00
bol-van 6165c13468 AI fix 2026-02-20 15:25:56 +03:00
bol-van f7b3946ec2 update docs 2026-02-20 13:19:17 +03:00
bol-van 9f29f2c0ae update docs 2026-02-20 13:12:08 +03:00
bol-van c13284b776 zapret-auto: per_instance_condition feed target desync to cond function, code=>cond_code 2026-02-20 07:18:31 +03:00
bol-van 6e85c9650d nfqws2: use tcp seq for reasm_offset 2026-02-19 17:38:46 +03:00
bol-van 7f3b5f659f update docs 2026-02-19 13:00:57 +03:00
bol-van 8e62b2e743 update docs 2026-02-19 12:57:50 +03:00
bol-van 94dfd5fded quic2_example_com.bin 2026-02-19 10:26:42 +03:00
bol-van 70d8e5ad15 AI fixes 2026-02-19 10:05:50 +03:00
bol-van a80aed5ccc update builder-linux 2026-02-18 17:28:03 +03:00
bol-van 2b35dc8ecd update builder-linux 2026-02-18 16:31:01 +03:00
bol-van 75fadab371 update builder-linux 2026-02-18 16:16:58 +03:00
bol-van e70f4a000a update builder-linux 2026-02-18 16:08:19 +03:00
bol-van 755c792797 github: luajit for ppc 2026-02-18 15:37:08 +03:00
bol-van b17894eec1 nfqws2: goto lua desync if reasm is cancelled 2026-02-18 15:28:30 +03:00
bol-van 9e22ec883c update builder-linux 2026-02-18 12:42:11 +03:00
bol-van f70fb89754 AI fixes, update builder-linux 2026-02-18 12:15:46 +03:00
bol-van e30f99e106 update docs 2026-02-18 10:46:10 +03:00
bol-van fce76e59aa build-linux update 2026-02-18 10:28:36 +03:00
bol-van 1b1c8ddb38 nfqws2, zapret-lib: always treat blobs, % and # as string 2026-02-17 19:22:17 +03:00
bol-van 5ced6811c8 winws: fix ensure_access for unix paths 2026-02-17 16:27:06 +03:00
bol-van 371612b000 install_bin: add mipsel64 2026-02-17 14:24:43 +03:00
bol-van 3c87be3cba update docs 2026-02-17 14:11:55 +03:00
bol-van c642fb3845 builder-linux 2026-02-17 14:07:08 +03:00
bol-van 847e689bfb AI fixes 2026-02-17 09:35:09 +03:00
bol-van 287527092a remove debug message 2026-02-17 09:15:53 +03:00
bol-van a9514f39f5 update docs 2026-02-16 20:54:18 +03:00
bol-van 4b7ff505e4 nfqws2: old kernels compat 2026-02-16 20:51:39 +03:00
bol-van 2120264e0b AI and manual fixes 2026-02-16 19:45:58 +03:00
bol-van 178bced5f3 update docs 2026-02-16 14:55:31 +03:00
bol-van ff78968807 nfqws2: ensure old toolchains do not break 2026-02-16 12:01:08 +03:00
bol-van e4535d2646 nfqws2: loongarch64 compile fix 2026-02-16 11:51:43 +03:00
bol-van 7c60ad3a7a AI fixes 2026-02-16 10:47:50 +03:00
bol-van a621edf898 AI fixes 2026-02-15 09:40:54 +03:00
bol-van 2809f8d7e4 update docs 2026-02-14 18:16:57 +03:00
bol-van 97819327cd nfqws2: remember absolute paths 2026-02-14 18:10:26 +03:00
bol-van eb9a1e9f6b nfqws2: --chdir 2026-02-14 16:08:01 +03:00
bol-van 6f6850707a zapret-lib: tls_dissect abort 2 loops if data is corrupt 2026-02-14 15:30:59 +03:00
bol-van f702865311 AI fixes 2026-02-14 13:19:48 +03:00
bol-van 6447081a01 winws2: optimize signal handling in windivert_recv 2026-02-14 11:36:00 +03:00
bol-van e4e513ec66 github: stronger gz and zip compression 2026-02-13 17:38:22 +03:00
bol-van 47630450bd AI fixes 2026-02-13 16:49:42 +03:00
bol-van e4129fec63 github: upx 5.1.0 2026-02-13 13:35:55 +03:00
bol-van f71ba91e7c remove no-unwind from makefiles 2026-02-13 10:59:24 +03:00
bol-van 59e6603b83 dont use no-unwind to prevent crashes 2026-02-13 10:34:16 +03:00
bol-van 14a061859f change toolchain, riscv64 2026-02-13 09:11:51 +03:00
bol-van 9aaa419f68 nfqws2: fix fread inf loop 2026-02-12 11:54:12 +03:00
bol-van d5231bc4fc nfqws2: allow any size iv_len in aes_gcm 2026-02-11 15:42:23 +03:00
bol-van 35cebfba73 winws2: use -msse only for luajit 2026-02-11 14:09:55 +03:00
bol-van 811d16054b update docs 2026-02-11 14:05:29 +03:00
bol-van a9ee072a14 github: cygwin lto 2026-02-11 14:01:24 +03:00
bol-van 1dbf5ecfe6 optimize exe size 2026-02-11 13:18:14 +03:00
bol-van b210db168f nfqws2: bsd compile fixes 2026-02-11 13:05:45 +03:00
bol-van 5306a043d0 AI fixes 2026-02-11 11:26:20 +03:00
bol-van b375a94036 update docs 2026-02-11 11:22:53 +03:00
bol-van 8b2bff4187 AI fixes 2026-02-11 11:03:27 +03:00
bol-van 827ab7cdcc nfqws2: optimize quit logic 2026-02-10 19:05:14 +03:00
bol-van bfa1d8c5dd nfqws2: compile mask_from_bitcount only for windows 2026-02-10 15:59:56 +03:00
bol-van 52ea6270f4 nfqws2: update kavl 2026-02-10 15:51:50 +03:00
bol-van 0fb21856c6 nfqws2: update uthash 2026-02-10 15:47:28 +03:00
bol-van 48e4d3a6e7 init.d: optimize ipt dports 2026-02-10 12:34:47 +03:00
bol-van 6204c74993 update docs 2026-02-10 12:07:24 +03:00
bol-van d981391120 update docs 2026-02-10 12:06:26 +03:00
bol-van 7db676e02c init.d: use bitmap:port ipset for standard dports 2026-02-10 11:33:50 +03:00
bol-van c91cae0903 nfqws2: quit handling optimize 2026-02-09 21:06:36 +03:00
bol-van c06712a0d5 nfqws2: optimize 2026-02-09 19:49:47 +03:00
bol-van 2e2f118e10 nfqws2: EINTR safety 2026-02-09 19:44:06 +03:00
bol-van 6638140880 zapret-auto: instances arg in condition, cond_lua 2026-02-09 17:24:11 +03:00
bol-van 41bac1833e nfqws2: remove bind to address in rawsend 2026-02-09 15:59:53 +03:00
bol-van c3b1cc3eb9 update docs 2026-02-09 13:45:23 +03:00
bol-van 6f52fb08f9 update docs 2026-02-09 13:44:41 +03:00
bol-van 08549b570b update docs 2026-02-09 13:43:46 +03:00
bol-van 13daef5167 update docs 2026-02-09 13:39:26 +03:00
bol-van 1fd6063cd7 update docs 2026-02-09 13:38:25 +03:00
bol-van 5e4f78228e zapret-auto: per_instance_condition not execute if cond arg absent 2026-02-09 13:28:51 +03:00
bol-van 2e255ca59f zapret-auto: per_instance_condition 2026-02-09 13:19:01 +03:00
bol-van 565a8abffc AI fixes 2026-02-09 10:04:13 +03:00
bol-van 69f1576f7e AI fixes 2026-02-08 17:22:39 +03:00
bol-van 0917cb21bb AI fixes 2026-02-08 17:12:36 +03:00
bol-van 8f316ae1a2 nfqws2: AI fixes 2026-02-07 20:07:49 +03:00
bol-van caaf5e7a2e nfqws2: DLOG_ERR payload too large 2026-02-07 14:50:54 +03:00
bol-van dbfbd6e6d3 nfqws2: DLOG_ERR if payload does not fit into the buffer 2026-02-07 14:47:31 +03:00
bol-van 397fe60b5f update docs 2026-02-07 13:55:23 +03:00
bol-van e096ed64bc update docs 2026-02-07 13:54:01 +03:00
bol-van 0f2def9bd5 update docs 2026-02-07 13:52:11 +03:00
bol-van 85721e4b82 update docs 2026-02-07 13:50:55 +03:00
bol-van 0fd9314df9 update docs 2026-02-07 13:49:54 +03:00
bol-van a9e2bfe49c update docs 2026-02-07 13:48:27 +03:00
bol-van bd7a40f5a9 nfqws2: handling of incoming frag, AI fixes 2026-02-07 13:36:31 +03:00
bol-van bcd50f5215 zapret-tests: 64-bit time support checks 2026-02-06 17:16:40 +03:00
bol-van 927cca3d44 AI fixes 2026-02-06 16:42:18 +03:00
bol-van 162e8906a6 nfqws2: use mktime instead of timelocal 2026-02-06 15:53:50 +03:00
bol-van 3f7180379b update docs 2026-02-06 15:47:34 +03:00
bol-van 5d0af6b058 nfqws2: load wlanapi.dll dynamically only if required 2026-02-06 15:42:36 +03:00
bol-van 392e1cc1ef nfqws2: fix sz=0 case in fill_random_bytes 2026-02-06 14:58:24 +03:00
bol-van 8a5643851d zapret-tests: fix ip_len in csum tests 2026-02-06 12:01:31 +03:00
bol-van 6299a46ab7 nfqws2: 1ULL in proto/payload 2026-02-06 11:31:47 +03:00
bol-van c5ecc0493d nfqws2: check malloc result 2026-02-06 11:05:54 +03:00
bol-van 7bb8b1d7b3 nfqws2: clear partially allocated windivert filters 2026-02-06 11:04:27 +03:00
bol-van 401bd83f82 nfqws2: use malloc in fuzz for packet data 2026-02-06 11:03:51 +03:00
bol-van c117c30849 nfqws2: AI fixes 2026-02-06 10:47:29 +03:00
bol-van 6828e7352c antivirus issue ban warning 2026-02-06 10:10:09 +03:00
bol-van 943e548f93 mdig: minor change 2026-02-05 18:51:36 +03:00
bol-van 539c329da3 update docs 2026-02-05 14:35:14 +03:00
bol-van 4c6902c17c update docs 2026-02-05 14:34:41 +03:00
bol-van 9121d949f6 update docs 2026-02-05 14:34:17 +03:00
bol-van 64c1f96f80 nfqws2: time convert functions 2026-02-05 14:33:15 +03:00
bol-van 3334786fe3 AI fixes 2026-02-05 12:54:59 +03:00
bol-van 20a0fa671d AI fixes 2026-02-05 12:36:27 +03:00
bol-van 747de07c85 update docs 2026-02-05 12:22:50 +03:00
bol-van 6384af6607 update docs 2026-02-05 12:22:18 +03:00
bol-van 3046dd8013 nfqws2: bt and utp_bt protocol detectors 2026-02-05 12:19:31 +03:00
bol-van c80ae95a09 nfqws2: hidden packet data fuzz option 2026-02-05 11:06:32 +03:00
bol-van d7e5fc1a7c nfqws2: AI fixes 2026-02-05 09:37:34 +03:00
bol-van 97a6b9dd5b nfqws2: AI inspired fixes 2026-02-04 22:06:23 +03:00
bol-van cfd2df41c4 nfqws2: tls debug ssl 3.0 2026-02-04 17:54:07 +03:00
bol-van f47f4a0cae blockcheck2: small fixes 2026-02-04 17:35:07 +03:00
bol-van 823a2e2e5d update docs 2026-02-04 15:18:57 +03:00
bol-van 0cdbedde74 update docs 2026-02-04 15:17:27 +03:00
bol-van 36e243863b update docs 2026-02-04 15:15:47 +03:00
bol-van 181395be87 nfqws2: compile compat 2026-02-04 15:14:49 +03:00
bol-van fb71a41ea5 nfqws2: compile compat 2026-02-04 15:12:23 +03:00
bol-van 7f8f64a355 nfqws2: compile compat 2026-02-04 15:04:59 +03:00
bol-van 7e31dc9d89 update docs 2026-02-04 14:24:34 +03:00
bol-van 4a9072a949 nfqws2: unblocked bcryptorandom, --new=name, AI fixes 2026-02-04 14:24:10 +03:00
bol-van 4b0e3af020 update docs 2026-02-03 22:42:03 +03:00
bol-van d442a38774 update docs 2026-02-03 22:40:48 +03:00
bol-van ede3515fa3 update docs 2026-02-03 22:37:59 +03:00
bol-van 831cf02ad5 update docs 2026-02-03 22:33:10 +03:00
bol-van c436470b18 nfqws2: type field in stat table 2026-02-03 22:32:57 +03:00
bol-van 56b4ce0b2a nfqws2: clock_getfloattime() 2026-02-03 22:03:56 +03:00
bol-van 18b33008af nfqws2: stat luacall 2026-02-03 21:58:14 +03:00
bol-van c72c48432e nfqws2: fix icmp data32 2026-02-03 17:08:45 +03:00
bol-van c5894b0708 nfqws2: fix icmp_data reconstruct in 32-bit luajit 2026-02-03 16:40:14 +03:00
bol-van 79b018dd74 nfqws2: check ip version=4 2026-02-03 15:58:08 +03:00
bol-van 56cce72dac github: disable check sig for cygwin 2026-02-03 12:23:43 +03:00
bol-van a8b4007386 github: disable check sig for cygwin 2026-02-03 11:15:40 +03:00
bol-van 2977c20044 AI inspired fixes 2026-02-03 10:45:15 +03:00
bol-van d432e770a6 zapret-lib: fix broken verdict_aggregate 2026-02-02 19:29:11 +03:00
bol-van 0574d609de update docs 2026-02-02 19:02:15 +03:00
bol-van 043b85dfb4 update docs 2026-02-02 18:14:37 +03:00
bol-van 22b7861603 update docs 2026-02-02 18:10:41 +03:00
bol-van 8b24076c20 update docs 2026-02-02 18:07:22 +03:00
bol-van 3abc22baf5 AI inspired fix 2026-02-02 18:02:31 +03:00
bol-van 739c24cdf3 nfqws2: process --filter-l3 as a list in templates 2026-02-02 13:57:40 +03:00
bol-van 5c97563698 AI inspired fixes 2026-02-02 11:02:33 +03:00
bol-van 2ddfe55d9a AI inspired fixes 2026-02-02 10:58:48 +03:00
bol-van a781f3d1ce update docs 2026-02-01 16:01:30 +03:00
bol-van 080655c4c2 nfqws2: copy b_filter_l3 2026-02-01 15:57:09 +03:00
bol-van 3434739144 update docs 2026-02-01 14:50:57 +03:00
bol-van 740cbfbc34 nfqws2: copy param set bool 2026-02-01 14:32:18 +03:00
bol-van 37f0f4589f nfqws2: template free import 2026-02-01 14:28:24 +03:00
bol-van 9d7fed4c67 update docs 2026-02-01 11:32:01 +03:00
bol-van 2533a3debc update docs 2026-02-01 10:15:54 +03:00
bol-van 6e90adad5b update docs 2026-02-01 09:56:24 +03:00
bol-van aa359128bb update docs 2026-02-01 09:53:22 +03:00
bol-van fed07a0249 nfqws2: fix initial -1 scale, allow raw packets in conntrack_feed 2026-02-01 09:49:16 +03:00
bol-van 055ae067f9 AI inspired fixes 2026-01-31 18:06:44 +03:00
bol-van 2490ef6951 AI inspired fixes 2026-01-31 17:47:18 +03:00
bol-van a531da39fd winws2: optimize bulk buffer size 2026-01-31 17:14:00 +03:00
bol-van b920964ab3 winws2: optimize bulk buffer size 2026-01-31 17:13:37 +03:00
bol-van 7d9f5a4b83 winws2: use windivert bulk mode 2026-01-31 16:54:17 +03:00
bol-van b157613b1a nfqws2: minor beautify 2026-01-31 13:24:48 +03:00
bol-van 4081878b36 update docs 2026-01-31 13:19:37 +03:00
bol-van b1fbf5c81a update docs 2026-01-31 13:17:33 +03:00
bol-van 04d940e619 nfqws2: fix comments 2026-01-31 13:00:52 +03:00
bol-van bd9aec8374 zapret-obfs: synhide: conntrack_feed for both server and client 2026-01-31 11:44:11 +03:00
bol-van e9bffca658 zapret-obfs: synhide: use conntrack_feed, use x2 magic by default 2026-01-31 11:28:16 +03:00
bol-van 001942fe74 nfqws2: conntrack_feed() 2026-01-31 11:26:20 +03:00
bol-van f5d1108cce winws2: remove vista from manifest 2026-01-31 09:41:30 +03:00
bol-van 27d387c76d zapret-obfs: fix comment 2026-01-30 21:59:11 +03:00
bol-van d5306fb97a nfqws2: android 5 compat 2026-01-30 21:47:19 +03:00
bol-van 5f87b7670a AI inspired fixes 2026-01-30 19:18:17 +03:00
bol-van 2a2a3e4f73 AI inspired fixes 2026-01-30 19:06:13 +03:00
bol-van 1f99fb49af zapret-obfs: remove wrong comment 2026-01-30 18:58:59 +03:00
bol-van b99b59bbdb zapret-obfs: synhide xorseq 2026-01-30 18:55:56 +03:00
bol-van 9128601820 AI inspired fixes 2026-01-30 17:23:47 +03:00
bol-van 584d3b5925 zapret-obfs: synhide more magics 2026-01-30 16:37:19 +03:00
bol-van eff7e6488a fix openwrt makefile 2026-01-30 13:16:01 +03:00
bol-van 27c49bcfe4 zapret-obfs: add comment 2026-01-30 11:54:21 +03:00
bol-van 48fbd39ada zapret-obfs: synhide 2026-01-30 11:52:59 +03:00
bol-van 6eb4970c9b update docs 2026-01-29 18:03:23 +03:00
bol-van ba5cff29f1 update docs 2026-01-29 18:01:47 +03:00
bol-van bd155daa91 update docs 2026-01-29 17:57:55 +03:00
bol-van 5de6595ccd update docs 2026-01-29 17:53:41 +03:00
bol-van 4253b7b408 update docs 2026-01-29 17:52:31 +03:00
bol-van 389a331d83 update docs 2026-01-29 17:51:37 +03:00
bol-van 540094baac update docs 2026-01-29 16:07:36 +03:00
bol-van a3c4724542 update docs 2026-01-29 16:06:59 +03:00
bol-van 79f33ef75a update docs 2026-01-29 16:06:20 +03:00
bol-van d4c1126961 makefile: -Wno-alloc-size-larger-than 2026-01-29 14:25:12 +03:00
bol-van 9e378f629d update docs 2026-01-29 13:52:16 +03:00
bol-van 227c2e76e3 update docs 2026-01-29 13:48:07 +03:00
bol-van 2f74d21923 update docs 2026-01-29 13:46:06 +03:00
bol-van 4376aa0cdf update docs 2026-01-29 13:45:29 +03:00
bol-van 331e0dcbab update docs 2026-01-29 13:31:03 +03:00
bol-van f1af8cbde9 update docs 2026-01-29 13:30:15 +03:00
bol-van b865591f2a update docs 2026-01-29 13:29:27 +03:00
bol-van 384d219597 update docs 2026-01-29 12:37:25 +03:00
bol-van 7880782a95 update docs 2026-01-29 12:36:13 +03:00
bol-van d914472542 update docs 2026-01-29 12:32:56 +03:00
bol-van 6a32bc46e2 update docs 2026-01-29 12:31:12 +03:00
bol-van 8cf0d68d58 update docs 2026-01-29 10:53:24 +03:00
bol-van 04134d78ee update docs 2026-01-29 10:51:38 +03:00
bol-van 47f6410946 winws2: --wf-raw-filter 2026-01-29 10:16:12 +03:00
bol-van a29e159895 rm bad files 2026-01-29 10:15:24 +03:00
bol-van e5fd657a8a zapret-obfs: change comments 2026-01-29 09:42:02 +03:00
bol-van faea98da74 zapret-obfs: use shim in wgobfs 2026-01-29 09:40:45 +03:00
bol-van c8722d1ed9 update docs 2026-01-28 18:41:38 +03:00
bol-van 77e405e24d update docs 2026-01-28 18:38:15 +03:00
bol-van 7c5dfad8e2 update docs 2026-01-28 18:27:11 +03:00
bol-van b25f16126b update docs 2026-01-28 18:25:53 +03:00
bol-van 4970c01344 update docs 2026-01-28 18:23:29 +03:00
bol-van 4e412ab2d6 update docs 2026-01-28 18:22:55 +03:00
bol-van a2374f0fcf update docs 2026-01-28 18:17:33 +03:00
bol-van 65337446d4 update docs 2026-01-28 18:09:27 +03:00
bol-van be88140bb0 nfqws2: icmpv6 codes lua constants 2026-01-28 17:19:02 +03:00
bol-van 27fff3f5c3 nfqws2: use conntrack l7 proto for related icmp 2026-01-28 16:54:21 +03:00
bol-van 8ba5739ef2 zapret-obfs: minor changes 2026-01-28 15:45:18 +03:00
bol-van a788975268 zapret-obfs: udp2icmp server parameter without value means 1 2026-01-28 14:41:31 +03:00
bol-van e441711b05 zapret-obfs.lua: udp2icmp 2026-01-28 14:10:09 +03:00
bol-van 314627d851 zapret-obfs: fix ippxor=0 case 2026-01-27 19:59:36 +03:00
bol-van 4560ef6d5b zapret-obfs: optimize 2026-01-27 18:53:26 +03:00
bol-van 431e794356 zapret-obfs: optimize 2026-01-27 18:51:29 +03:00
bol-van f50bd701f7 zapret-obfs: optimize 2026-01-27 18:21:23 +03:00
bol-van 15f29169d5 blockcheck2: more ttl=0 fixes 2026-01-27 17:37:24 +03:00
bol-van a106519f1e zapret-tests update 2026-01-27 15:43:06 +03:00
bol-van 5b016f62e4 zapret-obfs: ippxor 2026-01-27 14:08:10 +03:00
bol-van 68c15864a4 nfqws2: print ver on all os 2026-01-27 10:25:04 +03:00
bol-van 752cafad7c fix stupid AI suggestion 2026-01-26 20:12:25 +03:00
bol-van 12853b8052 zapret-tests: send raw ip protocol 2026-01-26 18:39:33 +03:00
bol-van 1d869650b1 nfqws2: dissect of partial packets 2026-01-26 16:04:06 +03:00
bol-van 12a9bf8b19 nfqws2: icmp payload type for unrelated icmps 2026-01-26 15:34:19 +03:00
bol-van 4ade6f7e82 del old files 2026-01-26 15:02:57 +03:00
bol-van 6adb789314 icmp and ipp support 2026-01-26 14:55:24 +03:00
bol-van 78b3baa03f icmp and ipp support 2026-01-26 14:22:38 +03:00
bol-van 90fa71d6d6 openbsd build info fix 2026-01-26 09:07:30 +03:00
bol-van e33e1a9b89 openbsd build info fix 2026-01-26 09:06:34 +03:00
bol-van e7f0e79f78 binaries with readme 2026-01-26 09:04:12 +03:00
bol-van 8b11d6c279 update docs 2026-01-24 20:25:35 +03:00
bol-van 30044e8c61 zapret-auto: check track 2026-01-22 23:02:54 +03:00
bol-van 1cffa0f5ec blockcheck2: --wf-tcp-empty=1 required for some methods 2026-01-22 14:58:33 +03:00
bol-van 8bee9efcf0 update docs 2026-01-20 11:13:38 +03:00
bol-van 848221b096 nfqws2: use __close in lua 5.5 2026-01-20 11:03:59 +03:00
bol-van fb3bdd9b70 zapret-lib: gzip use local gz 2026-01-20 11:03:03 +03:00
bol-van ca6d145312 lua 5.5 2026-01-20 10:31:55 +03:00
bol-van 01d78e8dc4 lua 5.5 2026-01-20 10:29:08 +03:00
bol-van db050b9ba1 blockcheck2: fix broken iptables rule 2026-01-19 16:42:17 +03:00
bol-van b65da8d8db nfqws2: remove unused var 2026-01-19 16:30:37 +03:00
bol-van 1359986d29 nfqws2: deduplicate code 2026-01-19 16:28:12 +03:00
bol-van 36ee42bc8c nfqws2: remove unneeded code 2026-01-19 12:02:30 +03:00
bol-van a8373a8400 update docs 2026-01-19 11:54:40 +03:00
bol-van 33b1e81041 nfqws2: check hostlist/ipset file is readable before destroying in-memory copy 2026-01-19 11:46:21 +03:00
bol-van 577d9e6aba AI inspired fixes 2026-01-19 11:25:49 +03:00
bol-van 3caf1ce10a zapret-auto: circular DLOG instead of DLOG_ERR if no track 2026-01-18 18:17:43 +03:00
bol-van 8e67260a23 nfqws2: minor optimize 2026-01-18 13:16:01 +03:00
bol-van 378b1c727d nfqws2: removed hard check for host: presence in http_req 2026-01-18 11:47:06 +03:00
bol-van 14bd4832a4 update docs 2026-01-18 11:33:12 +03:00
bol-van 6d8b405bf0 update docs 2026-01-18 11:29:17 +03:00
bol-van 00b6d70efc nfqws2: tcp protocol_probe reasm data 2026-01-18 10:59:03 +03:00
bol-van ca14fbe9c8 AI inspired fixes 2026-01-17 23:09:08 +03:00
bol-van c81968b94b nfqws2: fix wrong ipv6 dissection 2026-01-17 22:40:08 +03:00
bol-van a2d567c7a0 nfqws2: fix wrong ipv6 dissection 2026-01-17 22:31:21 +03:00
bol-van 5026199f24 zapret-antidpi: oob instance cutoff if called not from the very beginning of tcp 2026-01-17 19:45:54 +03:00
bol-van 68435f64ea update docs 2026-01-17 18:11:01 +03:00
bol-van d84dfaf61d blockcheck2, winws: multiple instances compat 2026-01-17 18:03:06 +03:00
bol-van 4c13c63d27 AI inspired fixes 2026-01-17 13:31:48 +03:00
bol-van 5dde1264ce update docs 2026-01-17 10:26:36 +03:00
bol-van cc989c52ed update docs 2026-01-17 10:01:38 +03:00
bol-van 0446b1493b AI inspired fixes 2026-01-17 10:01:26 +03:00
bol-van 97cd8cebca update docs 2026-01-17 09:53:37 +03:00
bol-van 2d02eeb578 blockcheck2: tcp_nop_del for openbsd 2026-01-17 09:50:39 +03:00
bol-van fe318a42e8 zapret-lib: tcp_nop_del 2026-01-16 21:34:18 +03:00
bol-van 73c10e3f15 update docs 2026-01-16 18:37:58 +03:00
bol-van 17cf260fd0 update docs 2026-01-16 18:33:19 +03:00
bol-van fa15c635bb update docs 2026-01-16 18:24:13 +03:00
bol-van 74690047b5 update docs 2026-01-16 18:18:56 +03:00
bol-van d24453da69 update docs 2026-01-16 18:16:56 +03:00
bol-van af200628cd update docs 2026-01-16 18:15:19 +03:00
bol-van 76fe7bff82 update docs 2026-01-16 18:14:16 +03:00
bol-van 1d1eedbb3b update docs 2026-01-16 18:06:56 +03:00
bol-van 274b331825 blockcheck2: remove drop_ack from oob 2026-01-16 17:12:53 +03:00
bol-van 69f900b3da udpate docs 2026-01-16 17:06:10 +03:00
bol-van da9faabf97 udpate docs 2026-01-16 17:00:16 +03:00
bol-van 60934f5ab8 udpate docs 2026-01-16 16:53:17 +03:00
bol-van eb7043fc12 zapret-antidpi: oob remove drop_ack 2026-01-16 16:37:56 +03:00
bol-van 681c53c3b4 AI inspired fixes 2026-01-16 16:17:34 +03:00
bol-van 65f6923383 update docs 2026-01-16 15:30:00 +03:00
bol-van f0f59261bb update docs 2026-01-16 15:29:37 +03:00
bol-van 06cf59d050 update docs 2026-01-16 15:24:48 +03:00
bol-van f0bff44219 update docs 2026-01-16 15:24:15 +03:00
bol-van da0016ed0e update docs 2026-01-16 15:23:12 +03:00
bol-van 704c73f821 zapret-antidpi: oob error if char != 1 symbol 2026-01-16 15:05:23 +03:00
bol-van 201dd40b46 zapret-antidpi: oob error if char > 1 symbol 2026-01-16 15:04:16 +03:00
bol-van aa13a1f5d2 blockcheck2: oob --wf-tcp-empty=1 in windows 2026-01-16 14:57:59 +03:00
bol-van 2a3b6f2a8b zapret-antidpi: oob dlog drop_ack event 2026-01-16 14:56:39 +03:00
bol-van 801dec81c8 ask_list default value fix 2026-01-16 14:18:26 +03:00
bol-van 14359afb93 AI inspired fixes 2026-01-16 13:52:46 +03:00
bol-van 372c6748ca zapret-lib,antidpi: optimizations 2026-01-15 23:30:55 +03:00
bol-van 87d2fcd5a1 blockcheck2: AI fixes and oob 2026-01-15 22:34:15 +03:00
bol-van 74ddd4f9d2 AI inspired fixes 2026-01-15 21:29:37 +03:00
bol-van 6b7507deb5 nfqws2: set desync.tcp_mss to minimum of both ends or default if at least one is unknown 2026-01-15 20:51:57 +03:00
bol-van f8156a3d38 blockcheck2: ttl/autottl disable fix for BSD 2026-01-15 20:29:40 +03:00
bol-van 67a8ee47e3 zapret-antidpi: oob 2026-01-15 20:05:22 +03:00
bol-van 93d81ca4b2 blockcheck: multiple NOTEST fixes 2026-01-15 15:08:30 +03:00
bol-van 3d9a36600b blockcheck: NOTEST_SEQOVL fix 2026-01-15 15:04:01 +03:00
bol-van c3adb3f045 nfqws2: simplify complex unwinds in lua code 2026-01-15 11:46:36 +03:00
bol-van f919533873 nfqws2: simplify complex unwinds in lua code 2026-01-15 11:40:39 +03:00
bol-van 17bdfe16b1 blockcheck2: custom test special chars escape warning 2026-01-15 10:22:00 +03:00
bol-van bc0102fbdc nfqws2: do not require / in the beginning of URI in http 2026-01-15 10:13:08 +03:00
bol-van 10d72b3242 AI inspired fixes 2026-01-15 09:41:55 +03:00
bol-van 9dd14dfc7c nfqws2: check ipv6 plen 2026-01-14 19:13:46 +03:00
bol-van 10201f1abf nfqws2: bitset/bitget check negative from-to 2026-01-14 17:39:15 +03:00
bol-van 236550918b update docs 2026-01-14 17:22:27 +03:00
bol-van 72a269e88d makefile fixes 2026-01-14 17:08:35 +03:00
bol-van d3199eebd3 zapret-tests: fixes and ipv6 rawsend 2026-01-14 16:40:44 +03:00
bol-van ffcb14726d AI and manual fixes 2026-01-14 16:39:16 +03:00
bol-van aa5a1f4183 zapret-wgobfs: add comment 2026-01-14 09:49:28 +03:00
bol-van ca186a6566 AI inspired fixes 2026-01-14 09:47:12 +03:00
bol-van dced388652 update docs 2026-01-13 13:48:20 +03:00
bol-van 1f7d10bf5b update docs 2026-01-13 13:47:48 +03:00
bol-van 6b1b4adddb update docs 2026-01-13 13:46:49 +03:00
bol-van cfe7b76352 update docs 2026-01-13 13:43:52 +03:00
bol-van 62fd0dc432 update docs 2026-01-13 13:42:11 +03:00
bol-van 050a01bda2 update docs 2026-01-13 13:40:57 +03:00
bol-van 4c5d84c19e update docs 2026-01-13 13:40:23 +03:00
bol-van d430b4775d update docs 2026-01-13 13:38:49 +03:00
bol-van 807565968e update docs 2026-01-13 13:38:16 +03:00
bol-van e062b1795e update docs 2026-01-13 13:37:28 +03:00
bol-van 3417e50438 update docs 2026-01-13 13:35:56 +03:00
bol-van 70f5a88ec0 update docs 2026-01-13 13:22:34 +03:00
bol-van 4b3fba3fb2 nfqws2: add comments 2026-01-13 10:39:15 +03:00
bol-van 9cded5448a nfqws2: add comments 2026-01-13 10:38:00 +03:00
bol-van 2302ac6949 nfqws2: optimize unmodified csum fix logic 2026-01-13 10:33:59 +03:00
bol-van 0be76b902e nfqws2: minor optimize 2026-01-12 20:23:54 +03:00
bol-van fa89e011fb nfqws2: align packet buffers 2026-01-12 18:32:52 +03:00
bol-van 622a81001d AI inspired fixes 2026-01-12 16:51:40 +03:00
bol-van 4d793b73a4 nfqws2: do nothing on signals if quit requested 2026-01-12 11:32:38 +03:00
bol-van a47b6a529b update docs 2026-01-12 10:51:29 +03:00
bol-van 7c320c8d57 update docs 2026-01-12 10:13:26 +03:00
bol-van b18f0770c8 update docs 2026-01-12 10:12:35 +03:00
bol-van f7fc845014 update docs 2026-01-12 10:11:10 +03:00
bol-van 2c1a885a07 update docs 2026-01-12 10:10:01 +03:00
bol-van 9eb308d84c update docs 2026-01-12 10:09:02 +03:00
bol-van 3e724c3810 update docs 2026-01-12 10:03:35 +03:00
bol-van c179d55d88 nfqws2: harden wireguard detector 2026-01-12 09:34:56 +03:00
bol-van 3f1af1441e nfqws2: check quit flag outside of EINTR context 2026-01-12 09:08:19 +03:00
bol-van 4c1b2b65f3 nfqws2: gracefully shutdown on SIGINT and SIGTERM 2026-01-11 21:01:18 +03:00
bol-van 918258413f nfqws2: fix tls reasm logic 2026-01-11 19:41:13 +03:00
bol-van e6206c5a5f nfqws2: fix tls reasm 2026-01-11 18:20:29 +03:00
bol-van f93c6de772 nfqws2: --payload-disable 2026-01-11 17:25:53 +03:00
bol-van 5a7e2b1ca2 nfqws2: alternative representation of payload filter in execution_plan item 2026-01-11 16:20:45 +03:00
bol-van ca8104c72a zapret-lib: remove bitable, use barray 2026-01-11 15:36:10 +03:00
bol-van 3aad1f9ed9 nfqws2: optimize ctx userdata 2026-01-11 14:10:42 +03:00
bol-van fd288d5e7d nfqws2: move ctx from lightuserdata to userdata. prevents crashes on specific ARM cpus 2026-01-11 13:58:31 +03:00
bol-van 349fe3f7d7 update docs 2026-01-11 12:32:44 +03:00
bol-van 4554b7c15b zapret-lib, zapret-antidpi: use numeric indexes in http dissects 2026-01-11 12:29:53 +03:00
bol-van 0b595ae3a8 AI inspired fixes 2026-01-11 11:39:37 +03:00
bol-van 3e69e1b8c1 zapret-lib: bitable 2026-01-11 11:21:12 +03:00
bol-van 02b895910b dvtws2: openbsd compile fix 2026-01-11 11:04:09 +03:00
bol-van b2a53e9c64 nfqws2: AI inspired fixes 2026-01-11 10:56:24 +03:00
bol-van a626cfce8a update docs 2026-01-11 09:36:47 +03:00
bol-van ebcbfc37ba update docs 2026-01-10 20:14:44 +03:00
bol-van 33d3c94b68 update docs 2026-01-10 20:12:45 +03:00
bol-van d55dbb7717 update docs 2026-01-10 20:05:21 +03:00
bol-van cb82be9eab update docs 2026-01-10 20:04:01 +03:00
bol-van 024d36acc4 update docs 2026-01-10 20:02:06 +03:00
bol-van 08c6151a4c update docs 2026-01-10 19:56:22 +03:00
bol-van 520317dc3c update docs 2026-01-10 19:24:02 +03:00
bol-van 6bc0bf1b97 AI inspired fixes 2026-01-10 18:54:26 +03:00
bol-van d18fec9053 update docs 2026-01-10 16:47:40 +03:00
bol-van e60e5a0578 update docs 2026-01-10 16:46:44 +03:00
bol-van 84576a7039 update docs 2026-01-10 16:44:07 +03:00
bol-van 7957a0a425 update docs 2026-01-10 16:42:58 +03:00
bol-van 7ba4110416 update docs 2026-01-10 16:35:54 +03:00
bol-van 4babaef6a8 update docs 2026-01-10 16:32:54 +03:00
bol-van 872e37d160 update docs 2026-01-10 16:28:48 +03:00
bol-van a8219f4897 update docs 2026-01-10 16:25:24 +03:00
bol-van 36267b7e9b update docs 2026-01-10 16:22:35 +03:00
bol-van 99a7f06976 eng manual 2026-01-10 15:42:42 +03:00
bol-van 3617b8934f blockcheck2: 23-seqovl fix 2026-01-10 14:58:38 +03:00
bol-van 8e6387a6df config.default add MDIG comments 2026-01-09 13:14:36 +03:00
bol-van 3bc0e8e350 mdig: EAGAIN->EAI_AGAIN help text 2026-01-09 12:38:06 +03:00
bol-van 7f12334872 update docs 2026-01-09 12:04:48 +03:00
bol-van 0f42ff1731 ipset: mdig eagain support 2026-01-09 12:00:56 +03:00
bol-van 801328dc02 mdig: --eagain, --eagain-delay 2026-01-09 11:42:33 +03:00
bol-van fdb9c9be60 mdig: increase EAGAIN attempts 2026-01-09 10:17:13 +03:00
bol-van 5e89db0c7b replace spaces with tabs 2026-01-08 20:43:55 +03:00
bol-van 0e95de6083 replace spaces with tabs 2026-01-08 20:43:20 +03:00
bol-van 3ec585c97e init.d: 99-lan-filter custom script 2026-01-08 20:20:52 +03:00
bol-van 577959f442 init.d: nft_detele_chain => nft_del_chain 2026-01-08 19:14:47 +03:00
bol-van 36731cd9b5 zapret1 unfixed parts 2026-01-08 19:13:34 +03:00
bol-van b3b8133c39 nfqws2: minor safety fix 2026-01-08 12:19:41 +03:00
bol-van 5f96ce1099 nfqws2: minor safety fix 2026-01-08 12:18:54 +03:00
bol-van 2088f593d4 nfqws2: remove unused code 2026-01-08 11:55:51 +03:00
bol-van 03152ba76f nfqws2: move rawsend_cleanup 2026-01-08 11:46:45 +03:00
bol-van f94d1b1d16 nfqws2: ignore trailing spaces and tabs in hostlists and ipsets 2026-01-08 11:38:13 +03:00
bol-van 790a2ca355 nfqws2: params leaks fix 2026-01-07 14:45:09 +03:00
bol-van f318397726 AI inspired fixes 2026-01-07 13:44:56 +03:00
bol-van 5a116cf9be nfqws2: memleak fix 2026-01-07 13:18:30 +03:00
bol-van d40f05865b zapret-tests: improve resolve tests 2026-01-07 12:35:19 +03:00
bol-van e47603281c zapret-tests: improve resolve tests 2026-01-07 12:27:27 +03:00
bol-van 8ba58c8f16 update docs 2026-01-07 08:32:44 +03:00
bol-van 2def9397a0 zapret-lib: add expected_ratio to z_readfile 2026-01-07 08:31:23 +03:00
bol-van a61895778b update docs 2026-01-07 08:26:51 +03:00
bol-van a622061b45 nfqws2: optimize realloc increment 2026-01-07 08:24:04 +03:00
bol-van 1bbd342ff2 update docs 2026-01-07 08:15:43 +03:00
bol-van 84f978cee4 update docs 2026-01-07 08:14:24 +03:00
bol-van dd3cffca5f update docs 2026-01-07 08:13:02 +03:00
bol-van b699e5d9ec nfqws2, zapret-lib: more gzip optimizations 2026-01-07 08:09:41 +03:00
bol-van e6591575fe ipset: -9 gzip ratio 2026-01-07 07:03:12 +03:00
bol-van ca7569f68a update docs 2026-01-07 06:52:51 +03:00
bol-van 3a16523399 update docs 2026-01-07 06:51:58 +03:00
bol-van 2fd172118c nfqws2: change default expected gzip ratio 2026-01-07 06:50:15 +03:00
bol-van c43574d056 nfqws2: gzip optimize memory alloc 2026-01-07 06:45:27 +03:00
bol-van 22d4df73f6 update docs 2026-01-07 06:36:14 +03:00
bol-van 23d6cddb30 nfqws2: coroutine compat 2026-01-06 23:12:28 +03:00
bol-van c3b5d5e9ed update docs 2026-01-06 22:17:53 +03:00
bol-van 20856321c3 update docs 2026-01-06 22:15:31 +03:00
bol-van 75f3c7eac3 nfqws2: free zlib stream in __gc 2026-01-06 22:14:53 +03:00
bol-van 129461dc45 zapret-tests: gzip test 2026-01-06 21:06:14 +03:00
bol-van 91a3badc67 AI inspired fixes 2026-01-06 20:35:42 +03:00
bol-van ff15bcceae nfqws2: fix clang warning 2026-01-06 17:18:46 +03:00
bol-van 61b20f86a7 update docs 2026-01-06 17:07:16 +03:00
bol-van 2de8809ead zapret-lib: writefile 2026-01-06 17:07:08 +03:00
bol-van c77e8f799f update docs 2026-01-06 16:49:46 +03:00
bol-van 4cdf498a14 update docs 2026-01-06 16:48:33 +03:00
bol-van 4bbfc3081d update docs 2026-01-06 16:47:25 +03:00
bol-van 1099cf013d update docs 2026-01-06 16:46:42 +03:00
bol-van cb85f6e672 zapret-lib: fix error message 2026-01-06 16:42:00 +03:00
bol-van 823f4a6fb6 zapret-lib: fix error message 2026-01-06 16:41:35 +03:00
bol-van 05647e84ef zapret-lib: do not error on premature file end 2026-01-06 16:40:58 +03:00
bol-van 8bc74d0c4f nfqws2, zapret-lib: gzip 2026-01-06 16:23:18 +03:00
bol-van 0eb6cc9722 nfqws2: remove unused lua code 2026-01-06 12:08:35 +03:00
bol-van 13594401c6 init.d: 80-dns-intercept fix wrong comments 2026-01-05 10:43:35 +03:00
bol-van 2983c681d7 update docs 2026-01-04 14:28:02 +03:00
bol-van 68eefd9dd7 update docs 2026-01-04 14:21:14 +03:00
bol-van 73f6f7c522 update docs 2026-01-04 14:18:54 +03:00
bol-van df83a29b98 update docs 2026-01-04 14:17:07 +03:00
bol-van 9881cc4da2 update docs 2026-01-04 13:00:37 +03:00
bol-van 44f8ad6747 update docs 2026-01-04 12:38:33 +03:00
bol-van c651367d6a update docs 2026-01-04 12:35:08 +03:00
bol-van 90f88271c5 update docs 2026-01-04 12:34:07 +03:00
bol-van 9ba8d6cbdf update docs 2026-01-04 12:18:17 +03:00
bol-van 27efbb37d7 update docs 2026-01-04 12:16:57 +03:00
bol-van d725bd8fd7 update docs 2026-01-04 12:13:58 +03:00
bol-van 0ef50d04dc update docs 2026-01-04 12:13:33 +03:00
bol-van fdae4b1812 update docs 2026-01-04 12:08:36 +03:00
bol-van d0644f6160 update docs 2026-01-04 12:06:01 +03:00
bol-van b4f1765574 update docs 2026-01-04 12:04:58 +03:00
bol-van 8454d48fcd update docs 2026-01-04 12:01:30 +03:00
bol-van 70d7a77d06 update docs 2026-01-04 11:56:51 +03:00
bol-van 2a48f82feb update docs 2026-01-04 11:54:34 +03:00
bol-van c5d997ce48 update docs 2026-01-04 11:52:55 +03:00
bol-van c950edb380 update docs 2026-01-04 11:39:23 +03:00
bol-van 0d96b03f49 blockcheck2: additional NOTEST 2026-01-04 11:38:47 +03:00
bol-van 9772641813 init.d: 80-dns-intercept use mangle iptable 2026-01-03 20:19:28 +03:00
bol-van 7307a03ff7 init.d: 80-dns-intercept print_op 2026-01-03 20:16:49 +03:00
bol-van b529198f24 80-dns-intercept: remove DISABLE_IPVx filters 2026-01-03 19:59:51 +03:00
bol-van 5f5cfb434c update docs 2026-01-03 19:48:42 +03:00
bol-van 2f1aa5734e winws2: --wf-filter-loopback 2026-01-03 19:44:29 +03:00
bol-van 062360f3f3 update docs 2026-01-03 19:24:12 +03:00
bol-van 7122808425 init.d: dns intercept scheme 2026-01-03 19:14:35 +03:00
bol-van 515921522e init.d: ressurect lanif 2026-01-03 17:50:11 +03:00
bol-van c0ce825a95 update lame issue warning 2026-01-03 15:04:39 +03:00
bol-van c4b23d21ce init.d: sysv functions fix wrong interface order 2026-01-03 14:55:39 +03:00
bol-van 0847d9f140 nfqws2: replace printf with write in sighup 2026-01-03 13:24:18 +03:00
bol-van b239690e33 AI inspired fixes 2026-01-03 13:15:01 +03:00
bol-van 4f6510daf1 base.sh: detect hard links to busybox 2026-01-03 00:39:29 +03:00
bol-van 0cad2329a1 install_bin: fix and 2026-01-03 00:39:03 +03:00
bol-van 24d9eb1fe2 nfqws2: use query name in dns response extraction 2026-01-03 00:12:43 +03:00
bol-van f98445d36b update docs 2026-01-02 22:45:02 +03:00
bol-van 7278bb1b87 nfqws2: fix non-working dns ipcache if --debug=0 2026-01-02 20:01:23 +03:00
bol-van 5b58997e3e update docs 2026-01-02 19:53:22 +03:00
bol-van 93a6487eb5 update docs 2026-01-02 19:39:31 +03:00
bol-van fdca797671 nfqws2: cache dns response IP addresses if --ipcache-hostname enabled 2026-01-02 19:29:33 +03:00
bol-van bb9e78e8fb nfqws2: optimize udp protocol detect code 2026-01-02 17:44:52 +03:00
bol-van 2a15a1a778 Merge pull request #61 from Pavel4e5/typos
Typos
2026-01-02 17:26:44 +03:00
Pavel4e5 bf89b415bb Merge branch 'bol-van:master' into typos 2026-01-02 18:42:40 +05:00
bol-van 735936efc5 zapret-tests: test_swap 2026-01-01 14:26:23 +03:00
bol-van 9d09d8adcc nfqws2: fix comment 2025-12-31 18:07:30 +03:00
bol-van 3874e16075 nfqws2: print luajit status at startup 2025-12-31 16:10:22 +03:00
bol-van cbb05967ba update docs 2025-12-31 10:49:19 +03:00
bol-van 665bd5f318 zapret-lib: check NFQWS2_COMPAT_VER 2025-12-31 10:48:42 +03:00
bol-van fa1d7c30c3 blockcheck2: --payload= 2025-12-31 10:42:54 +03:00
Pavel4e5 940f94162d update docs 2025-12-31 02:47:05 +05:00
Pavel4e5 60108bf378 zapret-antidpi: correct error message 2025-12-31 02:40:33 +05:00
bol-van 5a68245e32 update docs 2025-12-30 15:33:28 +03:00
bol-van b2dbdd4dd7 update docs 2025-12-30 15:32:55 +03:00
bol-van 5bc65c3b91 update docs 2025-12-30 15:20:49 +03:00
bol-van 6bf7f2c7c0 nfqws2: use luaL_loadbuffer 2025-12-30 15:11:15 +03:00
bol-van 44a80abb3f nfqws2: use luaL_loadbuffer 2025-12-30 15:05:42 +03:00
bol-van 89f0f39b83 update docs 2025-12-30 13:27:07 +03:00
bol-van ad6f1db149 blockcheck2: http_unixeol test 2025-12-30 13:26:51 +03:00
bol-van 9154fe1677 zapret-lib, zapret-antidpi: http_reconstruct_req, http_unixeol 2025-12-30 13:26:15 +03:00
bol-van 5e63a0f5c5 update docs 2025-12-30 11:24:08 +03:00
bol-van 0521053991 github actions: use pigz -11 instead of gzip 2025-12-30 11:10:10 +03:00
bol-van 7b7ed1ad60 update docs 2025-12-30 10:51:07 +03:00
bol-van 2915647c63 update docs 2025-12-30 10:50:19 +03:00
bol-van 958a4e918b update docs 2025-12-30 10:48:11 +03:00
bol-van cb332dad74 update docs 2025-12-30 10:44:05 +03:00
bol-van 17e9e0a8e6 update docs 2025-12-29 20:40:50 +03:00
bol-van 78b348a193 nfqws2: bu48 crash fix 2025-12-29 19:25:28 +03:00
bol-van 8103a02689 nfqws2: fix wrong bitset on 32-bit platforms 2025-12-29 19:14:25 +03:00
bol-van a2dedc45c0 update docs 2025-12-29 18:19:30 +03:00
bol-van f0d3a63df9 update docs 2025-12-29 18:18:57 +03:00
bol-van c6ca25a656 nfqws2: lua gzip notice in help text 2025-12-29 18:16:43 +03:00
bol-van 71b87f749d actions: gzip lua in embedded release 2025-12-29 18:13:49 +03:00
bol-van 3d756c9702 nfqws2: support gzipped lua 2025-12-29 18:10:41 +03:00
bol-van 13864fe5c5 zapret-antidpi,zapret-lib: separate tls_client_hello_mod function 2025-12-29 17:16:15 +03:00
bol-van cc2601af2f blockcheck2: fix missing --blob 2025-12-29 16:49:52 +03:00
bol-van 07319a329e update docs 2025-12-29 14:57:28 +03:00
bol-van 52f5c2697b update docs 2025-12-29 14:54:53 +03:00
bol-van 6b0dde5643 update docs 2025-12-29 14:53:16 +03:00
bol-van e42265e071 update docs 2025-12-29 14:51:03 +03:00
bol-van 939f7a9558 update docs 2025-12-29 14:49:47 +03:00
bol-van b62ebd8fcb update docs 2025-12-29 14:46:50 +03:00
bol-van 521fafc05d update docs 2025-12-29 14:46:01 +03:00
bol-van 419d6769bd update docs 2025-12-29 14:42:36 +03:00
bol-van dde3f59d32 update docs 2025-12-29 14:42:19 +03:00
bol-van 78e1fb85ac zapret-antidpi: use TLS_EXT_SERVER_NAME 2025-12-29 14:08:34 +03:00
bol-van f73790b871 zapret-lib: tls comments 2025-12-29 13:45:33 +03:00
bol-van 33f3378094 zapret-antidpi: extend tls clone function 2025-12-29 13:19:12 +03:00
bol-van af7a6f6c10 zapret-antidpi: fix sniext add case 2025-12-29 13:10:35 +03:00
bol-van 9cc348e5bd zapret-antidpi: extend tls clone function 2025-12-29 13:03:48 +03:00
bol-van 8628c34941 zapret-lib: fix reconstruct handshake without record layer 2025-12-29 12:08:11 +03:00
bol-van eec9f3e87c zapret-lib: tls dissector/reconstructor 2025-12-29 11:59:52 +03:00
bol-van e4a8f51775 nfqws2: do not treat quic handshake messages as initials 2025-12-28 18:04:41 +03:00
bol-van fb962df188 nfqws2: detect incoming quic_initial (w/o decryption) 2025-12-28 17:12:18 +03:00
bol-van 173dcd47d1 nfqws2: detect incoming quic_initial (w/o decryption) 2025-12-28 17:09:25 +03:00
bol-van 3439dc4f21 zapret-tests: remove unneeded code 2025-12-28 16:39:11 +03:00
bol-van 6e04162a20 github actions: remove arm-old target - luajit fail reason revealed 2025-12-28 15:32:09 +03:00
bol-van 883a3d6233 update docs 2025-12-28 15:14:01 +03:00
bol-van e8cde6b0a2 rename sip.bin 2025-12-28 14:43:28 +03:00
bol-van 43872a21a6 more fakes 2025-12-28 13:45:10 +03:00
bol-van ff2c3e81f9 update docs 2025-12-28 13:01:54 +03:00
bol-van bcbfb45c53 update docs 2025-12-28 12:53:19 +03:00
bol-van fa6a75f139 update docs 2025-12-28 12:51:10 +03:00
bol-van e96c06598c update docs 2025-12-28 12:50:35 +03:00
bol-van 58320aecbe nfqws2: swap24 2025-12-28 12:49:09 +03:00
bol-van ba526b75e1 update docs 2025-12-28 12:40:00 +03:00
bol-van b9321619fc update docs 2025-12-28 12:37:58 +03:00
bol-van d1a489a196 nfqws2: support 48-bit arithmetics 2025-12-28 12:32:26 +03:00
bol-van cf91697dfb update docs 2025-12-28 10:55:08 +03:00
bol-van 401886bf32 update docs 2025-12-28 10:51:38 +03:00
bol-van 8baf81a840 update docs 2025-12-28 10:51:18 +03:00
bol-van 417cd8335a update docs 2025-12-28 10:48:26 +03:00
bol-van 5a9d40ad3f update docs 2025-12-28 10:47:42 +03:00
bol-van af0be0fd94 update docs 2025-12-28 10:46:59 +03:00
bol-van 68e0c367c9 blockcheck2: fix broken parts 2025-12-28 10:27:21 +03:00
bol-van 0969d22391 nfqws2: wrong type fix 2025-12-27 19:55:10 +03:00
bol-van 94daca8ced nfqws2: wrong type fix 2025-12-27 19:51:34 +03:00
bol-van 1982984a86 nfqws2: fix crash 2025-12-27 19:50:12 +03:00
bol-van 6a520f508a winws2: no EACCES check in windows 2025-12-27 11:52:10 +03:00
bol-van 70d0dd5d79 nfqws2: permissions info if EACCES on lua files 2025-12-27 10:44:27 +03:00
bol-van 4ca0f6b574 update docs 2025-12-26 16:19:45 +03:00
bol-van 76e85d8969 update docs 2025-12-26 16:18:08 +03:00
bol-van f458a76880 update docs 2025-12-26 14:28:43 +03:00
bol-van 6077d363ec more fakes 2025-12-26 13:02:53 +03:00
bol-van c70f114c3a zapret-antidpi: dht_dn 3 by default 2025-12-26 10:51:37 +03:00
bol-van 2c037dca73 init.d: 50-dht4all NFQWS_OPT_DHT_PKT_OUT 2025-12-26 10:50:20 +03:00
bol-van fe2fc0337f update docs 2025-12-25 20:51:08 +03:00
bol-van b3a86d0d8a update docs 2025-12-25 20:48:31 +03:00
bol-van 5618be9a71 update docs 2025-12-25 20:47:35 +03:00
bol-van 715ae4bf1c update docs 2025-12-25 20:16:10 +03:00
bol-van f44b6bf769 update docs 2025-12-25 20:15:07 +03:00
bol-van e75857c448 update docs 2025-12-25 20:13:34 +03:00
bol-van bc008e2cf3 update docs 2025-12-25 19:53:23 +03:00
bol-van 752226208b update docs 2025-12-25 19:49:03 +03:00
bol-van 9e2222549e init.d: 50-wg4all catch also response and cookie 2025-12-25 16:38:09 +03:00
bol-van b0686b16f7 update docs 2025-12-25 16:20:51 +03:00
bol-van d5b2c41daa update docs 2025-12-25 16:19:07 +03:00
bol-van 46a7632f59 50-dht4all iptables fix 2025-12-25 16:13:42 +03:00
bol-van 0642969a2d 50-dht4all fix comment 2025-12-25 16:07:33 +03:00
bol-van 13af2ec1be chmod 2025-12-25 16:02:12 +03:00
bol-van 50a1bb72d9 change dht and wireguard detection 2025-12-25 15:54:49 +03:00
bol-van 1696f1b552 update docs 2025-12-25 12:06:39 +03:00
bol-van b0ce5c0c1b nfqws2: harden tls handshake detection 2025-12-24 17:18:25 +03:00
bol-van 87943846d9 update docs 2025-12-24 16:43:45 +03:00
bol-van 8b359d0410 update docs 2025-12-24 16:39:03 +03:00
bol-van 0430d9d9cd zapret-pcap: move file:close 2025-12-24 16:16:34 +03:00
bol-van efcc1477dd update docs 2025-12-24 14:27:43 +03:00
bol-van 100fff0461 update docs 2025-12-24 14:26:51 +03:00
bol-van 1d14f8b0a4 update docs 2025-12-24 12:58:09 +03:00
bol-van 6e5c6511d3 update docs 2025-12-24 12:57:02 +03:00
bol-van 491a24d671 update docs 2025-12-24 12:53:48 +03:00
bol-van 505e8ff82c zapret-auto: tcp options nil 2025-12-24 00:12:49 +03:00
bol-van 1bbc56dc1b zapret-auto: desync.track presence check 2025-12-24 00:10:32 +03:00
bol-van ad60550bf3 update docs 2025-12-23 23:52:34 +03:00
bol-van 3043963e28 nfqws2,zapret-auto: ip6flow fixes 2025-12-23 23:48:32 +03:00
bol-van 664bc60175 winws2: send to interface 1.0 if no ifname given 2025-12-23 23:01:36 +03:00
bol-van 815801a7db zapret-auto: preserve interface name in rst send 2025-12-23 22:24:21 +03:00
bol-van 05f54086cf zapret-auto: add reset to detector defaults 2025-12-23 22:14:52 +03:00
bol-van b7a5f0410f nfqws2: minor lua safety checks 2025-12-23 21:57:25 +03:00
bol-van da8bb9f5b8 nfqws2: struct iphdr -> ip 2025-12-23 21:39:04 +03:00
bol-van 9e52d767d1 update docs 2025-12-23 15:31:31 +03:00
bol-van 3ff06303cb init.d: autohostlist reset feature 2025-12-23 15:30:31 +03:00
bol-van 2a5c036909 nfqws2,zapret-auto: reset retransmitter 2025-12-23 15:13:33 +03:00
bol-van a6e11540ff zapret-auto: reset parameter to standard_detector 2025-12-23 10:27:23 +03:00
bol-van 347c35e588 update docs 2025-12-23 09:52:17 +03:00
bol-van ea28460f1d update docs 2025-12-23 09:49:47 +03:00
bol-van 0ac5df9d0e update docs 2025-12-22 20:54:44 +03:00
bol-van 63767929a0 nfqws2: dtls, reevaulate profile on l7/host discovery in any direction 2025-12-22 17:42:53 +03:00
bol-van 026c832f3f update docs 2025-12-22 13:55:54 +03:00
bol-van 53ef85773e update docs 2025-12-22 13:53:54 +03:00
bol-van c41353cb8a update docs 2025-12-22 13:53:00 +03:00
bol-van d2f6c18adf update docs 2025-12-22 13:52:45 +03:00
bol-van 00d1406791 update docs 2025-12-22 12:21:52 +03:00
bol-van a38acae652 update docs 2025-12-22 12:16:28 +03:00
bol-van 90a991b5ee update docs 2025-12-22 12:14:47 +03:00
bol-van 686721f96a zapret-lib: wsize_rewrite change dlog text 2025-12-22 11:34:01 +03:00
bol-van 479b067f1a update docs 2025-12-21 23:28:46 +03:00
bol-van ea1f34c833 update docs 2025-12-21 23:27:29 +03:00
bol-van b4fe028cb7 update docs 2025-12-21 23:26:18 +03:00
bol-van 39c3640477 update docs 2025-12-21 23:18:49 +03:00
bol-van 2236a95d49 update docs 2025-12-21 23:08:18 +03:00
bol-van 8bb03d68b5 update docs 2025-12-21 23:05:34 +03:00
bol-van 7b2a9a26ed update docs 2025-12-21 23:02:52 +03:00
bol-van b0ae1ac6f8 update docs 2025-12-21 21:56:00 +03:00
bol-van 29c1d1f164 update docs 2025-12-21 21:52:42 +03:00
bol-van 7cedbc5630 update docs 2025-12-21 21:45:18 +03:00
bol-van ccd943a02b update docs 2025-12-21 21:42:31 +03:00
bol-van 49dc116c4b update docs 2025-12-21 21:38:51 +03:00
bol-van f70107fad3 update docs 2025-12-21 21:37:50 +03:00
bol-van 40e9edcdcb init.d: fix 20-fw-extra 2025-12-21 21:22:27 +03:00
bol-van 905677b7ac init.d: remove unneeded code 2025-12-21 20:58:53 +03:00
bol-van 87b7b644c7 update docs 2025-12-21 16:20:09 +03:00
bol-van 2b410318ff blockcheck2: optionally replace multidisorder with multidisorder_legacy 2025-12-21 16:18:32 +03:00
bol-van afee286d91 update docs 2025-12-21 16:07:55 +03:00
bol-van f223a3e7e9 update docs 2025-12-21 16:05:02 +03:00
bol-van 258e353a52 update docs 2025-12-21 16:03:14 +03:00
bol-van 934d6e3e91 update docs 2025-12-21 16:00:42 +03:00
bol-van 630fb94466 update docs 2025-12-21 15:57:56 +03:00
bol-van 87617d379b update config.default 2025-12-21 15:38:12 +03:00
bol-van 1b6b3306aa init.d: remove unused code 2025-12-21 15:33:22 +03:00
bol-van 2cf74b3ed6 nfqws2: fix 'reasm cancelled' if no incoming traffic redirected 2025-12-21 14:52:08 +03:00
bol-van 0cd6f97b68 update docs 2025-12-20 23:13:36 +03:00
bol-van 3e2ead29da update docs 2025-12-20 17:47:57 +03:00
bol-van ebffdfad08 update docs 2025-12-20 17:45:53 +03:00
bol-van 205a3ca528 update docs 2025-12-20 17:44:21 +03:00
bol-van a014984f65 update docs 2025-12-20 17:42:55 +03:00
bol-van c62f49fa86 blockcheck2: move ttl limiters to def.in 2025-12-20 16:47:47 +03:00
bol-van 5bf3f4029d ipset: reestr reduce file size limit 2025-12-20 15:26:31 +03:00
bol-van b475f11c7c update docs 2025-12-20 14:48:56 +03:00
bol-van 021913aba2 ipset: renew get_reestr 2025-12-20 14:47:46 +03:00
bol-van 154d7d9c60 ipset: remove *reestr* because source does not and will probably not ever update 2025-12-20 14:07:42 +03:00
bol-van 7d6ddd557d zapret-antidpi: multidisorder_legacy change messages 2025-12-20 13:25:22 +03:00
bol-van 600345b3ec update docs 2025-12-20 13:19:09 +03:00
bol-van 7923535849 zapret-antidpi: multidisorder_legacy VERDICT_DROP 2025-12-20 13:10:11 +03:00
bol-van e8d8e3f7d2 zapret-antidpi: multidisorder_legacy 2025-12-20 13:04:07 +03:00
bol-van c6e6b51077 update docs 2025-12-20 11:00:12 +03:00
bol-van c1acca07c3 update docs 2025-12-20 10:52:04 +03:00
bol-van 4cc52b9d24 zapret-auto: iff/neg in repeater 2025-12-20 10:48:01 +03:00
bol-van 0c4ef51b2a blockcheck2: change multi cut point from 1360 to 1220 2025-12-20 10:18:53 +03:00
bol-van 1027cb666d blockcheck2: 1,midsld,1360 pos for multi 2025-12-19 20:45:31 +03:00
bol-van 1920bbf862 update docs 2025-12-19 20:35:37 +03:00
bol-van 1a80e0cc0c update docs 2025-12-19 19:12:09 +03:00
bol-van ebcd07b865 update docs 2025-12-19 19:10:50 +03:00
bol-van eaecce9630 update docs 2025-12-19 19:10:14 +03:00
bol-van 17b7eb7c4b update docs 2025-12-19 19:09:00 +03:00
bol-van 12838003f8 update docs 2025-12-19 18:59:03 +03:00
bol-van fa820b3e98 update docs 2025-12-19 18:57:13 +03:00
bol-van af867002f4 update docs 2025-12-19 18:55:30 +03:00
bol-van c6bc68d414 update docs 2025-12-19 18:55:03 +03:00
bol-van 801cacef58 update docs 2025-12-19 18:54:32 +03:00
bol-van 0df18df3f1 update docs 2025-12-19 18:53:39 +03:00
bol-van 4d9108822c update docs 2025-12-19 18:52:02 +03:00
bol-van 72f0b61cc0 actions: separate target arm-old with LUA 5.4 2025-12-19 18:01:00 +03:00
bol-van 99ea6e6fe0 actions: separate target arm-old with LUA 5.4 2025-12-19 17:47:56 +03:00
bol-van 99482d06d4 update docs 2025-12-19 13:56:55 +03:00
bol-van 65faaffe78 update docs 2025-12-19 13:55:19 +03:00
bol-van 81b2aa9d02 update docs 2025-12-19 13:52:39 +03:00
bol-van e07239e717 update docs 2025-12-19 13:49:54 +03:00
bol-van a5ca736ad7 update docs 2025-12-19 13:11:42 +03:00
bol-van 320f938418 update docs 2025-12-19 12:40:16 +03:00
bol-van 5e53ecfacb update docs 2025-12-19 12:33:20 +03:00
bol-van d46edfdd55 update docs 2025-12-19 12:30:58 +03:00
bol-van ec6e438144 blockcheck2: check quic only hopbyhop/destopt 2025-12-19 12:29:39 +03:00
bol-van 5b06f0b2a7 blockcheck2: check quic only hopbyhop/destopt 2025-12-19 11:52:11 +03:00
bol-van ec1f5b5eff blockcheck2: check http3 with ipv6 exthdr 2025-12-19 11:47:55 +03:00
bol-van 774d9b79c0 dns fake 2025-12-19 11:41:55 +03:00
bol-van 176ccb6b8a update docs 2025-12-19 11:28:08 +03:00
bol-van f0e31c0fd1 update docs 2025-12-19 11:27:21 +03:00
bol-van 7c3f1080e0 update docs 2025-12-19 10:46:42 +03:00
bol-van 3f760c778b update docs 2025-12-19 10:45:03 +03:00
bol-van 1b6b4c6b42 update docs 2025-12-18 17:28:51 +03:00
bol-van 6361a3798a update docs 2025-12-18 17:26:51 +03:00
bol-van 83feefdc18 update docs 2025-12-18 16:42:09 +03:00
bol-van 6d249528e4 zapret-antidpi: fix messages 2025-12-18 15:59:10 +03:00
bol-van cf8874c4f5 zapret-lib: fix comment 2025-12-18 12:29:40 +03:00
bol-van 82955888b8 zapret-lib: repeater clear parameter 2025-12-18 12:20:28 +03:00
bol-van eec1461867 zapret-lib: repeater support nested loops 2025-12-18 11:51:55 +03:00
bol-van 5e5dd241d4 zapret-auto: repeater - stop parameter 2025-12-18 11:17:50 +03:00
bol-van 8f53a44f7e zapret-lib: orchestrator 'repeater' 2025-12-17 22:54:22 +03:00
bol-van 03fd5acc95 update docs 2025-12-17 22:19:03 +03:00
bol-van b40f5511d1 nfqws2: fix missing fclose 2025-12-17 21:55:10 +03:00
bol-van 89a662ed0a update docs 2025-12-17 21:28:13 +03:00
bol-van c79822e5ef update docs 2025-12-17 20:54:01 +03:00
bol-van 3fd50eefb7 update docs 2025-12-17 20:51:27 +03:00
bol-van 2cdc45703a update docs 2025-12-17 20:50:36 +03:00
bol-van 5c77e78ad9 update docs 2025-12-17 20:49:54 +03:00
bol-van 48d59b436c update docs 2025-12-17 20:34:45 +03:00
bol-van d829464843 update docs 2025-12-17 20:31:48 +03:00
bol-van 0fb44db47c update docs 2025-12-17 20:28:11 +03:00
bol-van 77cd246540 update docs 2025-12-17 20:25:03 +03:00
bol-van b4d0ea465b update docs 2025-12-17 20:16:53 +03:00
bol-van 89cbed43dc update docs 2025-12-17 18:40:47 +03:00
bol-van 27ba59fa7f update docs 2025-12-17 18:36:45 +03:00
bol-van df30a86305 update docs 2025-12-17 18:10:31 +03:00
bol-van 02349dcb1d update docs 2025-12-17 16:45:54 +03:00
bol-van 7bcca64f08 update docs 2025-12-17 16:44:09 +03:00
bol-van 14bf1ce69b update docs 2025-12-17 16:42:37 +03:00
bol-van 0034e75321 update docs 2025-12-17 15:51:57 +03:00
bol-van f6c9f8b151 update docs 2025-12-17 15:51:05 +03:00
bol-van 76acf483f9 update docs 2025-12-17 15:45:08 +03:00
bol-van e7e175dd82 nfqws2: fix parentheses 2025-12-17 14:38:03 +03:00
bol-van 68ac46d1d2 winws2: remove old comment 2025-12-17 14:27:51 +03:00
bol-van 2ecd34cbca winws2: harden sandbox 2025-12-17 13:43:13 +03:00
bol-van b5b1f71fcc update docs 2025-12-17 11:05:09 +03:00
bol-van f5f7de4086 nfqws2: fix broken l7proto profile rediscovery 2025-12-17 10:48:33 +03:00
bol-van a331d59d33 update docs 2025-12-16 21:47:25 +03:00
bol-van 0a6d066e92 update docs 2025-12-16 19:39:01 +03:00
bol-van 1216ef0364 update docs 2025-12-16 19:35:07 +03:00
bol-van 52e38ee687 update docs 2025-12-16 19:31:51 +03:00
bol-van fd53a54cf3 update docs 2025-12-16 19:31:22 +03:00
bol-van c6b7e1fc43 update docs 2025-12-16 19:28:45 +03:00
bol-van a7a1520b40 update docs 2025-12-16 19:27:09 +03:00
bol-van 04881b10b1 update docs 2025-12-16 18:17:02 +03:00
bol-van 561e5e2718 update docs 2025-12-16 18:15:55 +03:00
bol-van e83e127c15 update docs 2025-12-16 18:10:08 +03:00
bol-van 3590861ffe update docs 2025-12-16 18:09:09 +03:00
bol-van a12307d7f9 update docs 2025-12-16 18:07:00 +03:00
bol-van 25a9f9e426 update docs 2025-12-16 17:44:48 +03:00
bol-van f4644e2a47 zapret-lib: update comment 2025-12-16 17:11:22 +03:00
bol-van b9a0d42815 nfqws2: improve ctx magic protection 2025-12-16 16:00:29 +03:00
bol-van f76beba434 nfqws2: fix instance_cutoff regression 2025-12-16 15:08:09 +03:00
bol-van 60b6ec2f49 nfqws2: lightuserdata safety check 2025-12-16 15:03:43 +03:00
bol-van ce95210d1c update docs 2025-12-16 13:04:05 +03:00
bol-van 953d92b177 update docs 2025-12-16 13:00:23 +03:00
bol-van 4d9b4c9ad8 update docs 2025-12-16 12:59:35 +03:00
bol-van ee7b72dc66 update docs 2025-12-16 12:57:54 +03:00
bol-van 8eb588d6a4 update docs 2025-12-16 12:46:36 +03:00
bol-van 08e1f8fba1 update docs 2025-12-15 21:22:15 +03:00
bol-van 454eedeb36 update docs 2025-12-15 21:20:09 +03:00
bol-van 7e761b3f03 update docs 2025-12-15 21:13:25 +03:00
bol-van 3dd51ee3b1 update docs 2025-12-15 21:12:48 +03:00
bol-van 07b1356c6c update docs 2025-12-15 21:11:23 +03:00
bol-van 23445785c9 update docs 2025-12-15 21:10:34 +03:00
bol-van f4a7fe3aaf update docs 2025-12-15 19:27:16 +03:00
bol-van 6d31036ca1 update docs 2025-12-15 19:07:22 +03:00
bol-van 5ceb3aa301 update docs 2025-12-15 19:01:09 +03:00
bol-van 7fd602885f update docs 2025-12-15 18:59:43 +03:00
bol-van af75c3d63d nfqws2: fix wrong comment 2025-12-15 18:49:51 +03:00
bol-van cb9789668f nfqws2: fix wrong comment 2025-12-15 18:48:44 +03:00
bol-van c16508e2e4 nfqws2: add l3_len, l4_len to dissect 2025-12-15 18:29:49 +03:00
bol-van 912eb1217a update docs 2025-12-15 17:12:27 +03:00
bol-van 3a328089a3 update docs 2025-12-15 17:05:31 +03:00
bol-van 4c76444b2d update docs 2025-12-15 17:04:46 +03:00
bol-van 403413bb26 update docs 2025-12-15 17:02:57 +03:00
bol-van 8ea6a17942 update docs 2025-12-15 17:00:17 +03:00
bol-van 15731d6135 update docs 2025-12-15 16:59:10 +03:00
bol-van 8255481787 update docs 2025-12-15 16:03:34 +03:00
bol-van d2a919f71d update docs 2025-12-15 16:02:23 +03:00
bol-van 915130aed9 update docs 2025-12-15 15:55:28 +03:00
bol-van 901ffdfe5a update docs 2025-12-15 15:52:43 +03:00
bol-van 8caaf85b36 update docs 2025-12-15 14:46:03 +03:00
bol-van 1dc5e23a41 update docs 2025-12-15 14:44:06 +03:00
bol-van ee859db268 update docs 2025-12-15 14:40:50 +03:00
bol-van 37f7fbbdec update docs 2025-12-15 14:40:08 +03:00
bol-van 81f6937187 update docs 2025-12-15 14:39:39 +03:00
bol-van cbf5be50d1 update docs 2025-12-15 14:25:03 +03:00
bol-van 1966ea2298 nfqws2: define IPT_ECN_NOT_ECT 2025-12-15 14:20:40 +03:00
bol-van d96350d2c7 nfqws2: define IPTOS_DSCP_MASK 2025-12-15 14:19:11 +03:00
bol-van 5cb96559d0 zapret-lib: seq compare functions 2025-12-15 11:31:51 +03:00
bol-van dffba7cd13 rename seq_over_2G to rseq_over_2G 2025-12-15 11:11:04 +03:00
bol-van 5ad122da40 update docs 2025-12-15 11:04:47 +03:00
bol-van 54871f4ef8 nfqws2: regression 2025-12-15 11:01:23 +03:00
bol-van d06e4f4c82 nfqws2,zapret-lib: check tcp seq overflow 2025-12-15 11:00:01 +03:00
bol-van 322b050e45 update docs 2025-12-14 21:55:46 +03:00
bol-van 5cb9cfc820 update docs 2025-12-14 21:55:26 +03:00
bol-van ede260d4fa update docs 2025-12-14 21:54:19 +03:00
bol-van 9a7de03830 update docs 2025-12-14 21:43:02 +03:00
bol-van b9b14f254a update docs 2025-12-14 21:41:28 +03:00
bol-van 653ed92cf8 update docs 2025-12-14 21:38:45 +03:00
bol-van 0d99c68b1b zapret-auto: do not nld if track.hostname_is_ip 2025-12-14 21:09:06 +03:00
bol-van 6c75dcc002 zapret-lua: circular change comments 2025-12-14 18:53:04 +03:00
bol-van b76e1f65a3 zapret-auto: remove old comment 2025-12-14 18:41:08 +03:00
bol-van de8845b89d zapret-auto: separate hostkey function 2025-12-14 18:14:42 +03:00
bol-van f1eae764ab nfqws2: clean lua cutoff on profile change 2025-12-14 17:39:15 +03:00
bol-van 03c650b33c nfqws2: set fwmark to 0 in windows 2025-12-14 16:34:10 +03:00
bol-van 64b12c51e5 update docs 2025-12-14 16:28:43 +03:00
bol-van 2d8e031904 update docs 2025-12-14 16:26:56 +03:00
bol-van 28f0cd6e73 update docs 2025-12-14 16:19:24 +03:00
bol-van 9a9179a23b update docs 2025-12-14 16:18:36 +03:00
bol-van 48123bf1f7 update docs 2025-12-14 15:03:24 +03:00
bol-van ece4e52676 update docs 2025-12-14 15:01:51 +03:00
bol-van 1d24d1e040 zapret-auto: update comment 2025-12-14 13:29:39 +03:00
bol-van d0fd6b4868 update docs 2025-12-14 13:27:12 +03:00
bol-van 328408fa30 zapret-auto: deduplicate standard detector defaults 2025-12-14 13:20:28 +03:00
bol-van 0343bb248d zapret-auto: unify automate dlog prefix 2025-12-14 13:02:23 +03:00
bol-van e4dd1574b8 zapret-auto: change function name 2025-12-14 13:00:39 +03:00
bol-van 1e3486ee14 zapret-auto: add success detector logic 2025-12-14 12:33:08 +03:00
bol-van efe7470732 update docs 2025-12-13 23:48:26 +03:00
bol-van 8acd5690f4 update docs 2025-12-13 23:46:33 +03:00
bol-van c2e3176a46 update docs 2025-12-13 23:44:27 +03:00
bol-van 658252d46a update docs 2025-12-13 23:43:06 +03:00
bol-van 5aaf7b3d6c update docs 2025-12-13 23:42:00 +03:00
bol-van 031ac7616d update docs 2025-12-13 23:41:16 +03:00
bol-van 098417d19f update docs 2025-12-13 23:40:43 +03:00
bol-van 2f0a74a11e update docs 2025-12-13 23:39:16 +03:00
bol-van 40c37c3448 update docs 2025-12-13 23:37:51 +03:00
bol-van 77fb530120 update docs 2025-12-13 23:36:52 +03:00
bol-van faa0274521 update docs 2025-12-13 23:35:21 +03:00
bol-van 8a253d3d95 update docs 2025-12-13 23:34:36 +03:00
bol-van 0aac2965c1 nfqws2: minor reorder struct members 2025-12-13 22:13:04 +03:00
bol-van d1128a8bc6 update docs 2025-12-13 20:56:17 +03:00
bol-van e016fc0e42 update docs 2025-12-13 20:55:50 +03:00
bol-van f48ea2f6a7 update docs 2025-12-13 20:39:03 +03:00
bol-van 2ab71ab895 update docs 2025-12-13 20:19:02 +03:00
bol-van 736e0ba3d4 update docs 2025-12-13 20:16:13 +03:00
bol-van f2ae880c11 update docs 2025-12-13 20:15:05 +03:00
bol-van 019f3089c6 update docs 2025-12-13 20:09:12 +03:00
bol-van 30d28488c9 update docs 2025-12-13 19:53:54 +03:00
bol-van 5bcec4aada update docs 2025-12-13 19:50:16 +03:00
bol-van 886fbabcfc update docs 2025-12-13 17:00:17 +03:00
bol-van cd8dbf2a2b update docs 2025-12-13 16:59:05 +03:00
bol-van 002742bd03 update docs 2025-12-13 16:56:45 +03:00
bol-van dc2c707c3c update docs 2025-12-13 16:55:22 +03:00
bol-van 9630d0a9df update docs 2025-12-13 16:54:54 +03:00
bol-van f4c4d5e558 update docs 2025-12-13 16:43:11 +03:00
bol-van 7b37880954 update docs 2025-12-13 16:39:53 +03:00
bol-van 6b7738ac16 update docs 2025-12-13 16:38:46 +03:00
bol-van 8dec014b50 update docs 2025-12-13 16:36:46 +03:00
bol-van b0ee32f3dc update docs 2025-12-13 16:36:21 +03:00
bol-van 0e770ff46d update docs 2025-12-13 16:35:52 +03:00
bol-van 14b3aef030 update docs 2025-12-13 16:33:05 +03:00
bol-van 004c583595 update docs 2025-12-13 16:31:18 +03:00
bol-van c4818a6a32 nfqws2: solved inability to get SSID using nl80211 on kernels 5.19+ 2025-12-13 15:33:57 +03:00
bol-van 58d57fed01 update docs 2025-12-13 11:27:16 +03:00
bol-van d6b73fe7e0 update docs 2025-12-13 11:26:58 +03:00
bol-van 4867838fce update docs 2025-12-13 11:24:35 +03:00
bol-van 4b2551509f update docs 2025-12-13 11:22:16 +03:00
bol-van ed6acb36a1 nfqws2: update docs 2025-12-12 23:45:32 +03:00
bol-van 26b80e80b6 nfqws2: update docs 2025-12-12 23:43:47 +03:00
bol-van 79b776b5a9 nfqws2: update docs 2025-12-12 23:42:27 +03:00
bol-van 3b251b9ee6 nfqws2: update docs 2025-12-12 23:41:43 +03:00
bol-van 8c65a966d9 nfqws2: update docs 2025-12-12 23:40:58 +03:00
bol-van 9da0b13aa3 nfqws2: update docs 2025-12-12 23:39:18 +03:00
bol-van d7fd491121 nfqws2: update docs 2025-12-12 23:38:09 +03:00
bol-van c60ef399ec nfqws2: update docs 2025-12-12 23:36:15 +03:00
bol-van 2abab21e4b nfqws2: update docs 2025-12-12 23:31:17 +03:00
bol-van 6190babb99 nfqws2: update docs 2025-12-12 23:29:55 +03:00
bol-van 7ce0b4a996 nfqws2: reduce default retrans maxseq to 32768, adjust config 2025-12-12 23:28:49 +03:00
bol-van 053556fe2d nfqws2: autohostlist reset fail counter if udp_in > threshold 2025-12-12 23:11:11 +03:00
bol-van 52571045fe nfqws2: add EOL at the end of truncated buffered DLOG line if it's too large. increase log line buffer 2025-12-12 20:37:58 +03:00
bol-van db875ed1d4 nfqws2: cancel reasm if server window size is smaller than expected reasm size 2025-12-12 20:20:12 +03:00
bol-van e828864811 nfqws2: cancel reasm if server window size is smaller than expected reasm size 2025-12-12 20:18:55 +03:00
bol-van 4404127fa3 update docs 2025-12-12 18:26:30 +03:00
bol-van 13e81e4b6f update docs 2025-12-12 18:25:45 +03:00
bol-van a631add2d9 update docs 2025-12-12 18:24:34 +03:00
bol-van 26b9b63a20 update docs 2025-12-12 18:21:35 +03:00
bol-van 90489fad2f update docs 2025-12-12 18:21:17 +03:00
bol-van d93c243d21 update docs 2025-12-12 18:20:46 +03:00
bol-van 65235d71d7 update docs 2025-12-12 18:19:53 +03:00
bol-van fc01e6715f update docs 2025-12-12 18:04:18 +03:00
bol-van 1a33d68998 update docs 2025-12-12 18:00:57 +03:00
bol-van dfaa475d2a update docs 2025-12-12 17:50:42 +03:00
bol-van 743018423a update docs 2025-12-12 17:47:15 +03:00
bol-van 762023f201 update docs 2025-12-12 16:45:16 +03:00
bol-van a296b93b7a update docs 2025-12-12 16:44:17 +03:00
bol-van 1c9b3aa1bc update docs 2025-12-12 16:40:02 +03:00
bol-van 565fa8e337 init.d: fix non-working incoming redirect 2025-12-12 16:09:31 +03:00
bol-van 9fcecd07d1 update docs 2025-12-12 12:19:04 +03:00
bol-van 652e271877 update docs 2025-12-12 12:06:55 +03:00
bol-van fc7ed4f4a8 update docs 2025-12-12 12:04:57 +03:00
bol-van e9e5bdc860 update docs 2025-12-12 12:04:31 +03:00
bol-van a2b8300219 update docs 2025-12-12 12:03:45 +03:00
bol-van dfdcfbdf51 update docs 2025-12-12 12:02:12 +03:00
bol-van 170ec372fb update docs 2025-12-12 12:00:53 +03:00
bol-van 3f073908a6 update docs 2025-12-12 11:59:17 +03:00
bol-van 7708021587 nfqws2: rewrite autohostlist udp failure detector logic 2025-12-11 15:19:31 +03:00
bol-van 912aadf6ca zapret-auto: override host autostate key 2025-12-11 13:41:04 +03:00
bol-van 420cc0c3ef nfqws2: fix crash 2025-12-11 13:38:10 +03:00
bol-van 6ce5829d06 zapret-auto: override host autostate key 2025-12-11 12:57:32 +03:00
bol-van a6d43af931 nfqws2: autohostlist do not react to rseq 0 2025-12-11 01:03:25 +03:00
bol-van ca9898959e nfqws2: remove commented test code 2025-12-11 00:23:20 +03:00
bol-van 8cd2904614 nfqws2: push desync.track.pos.dt as float with nsec accuracy 2025-12-11 00:21:22 +03:00
bol-van 0de1ab1b1b init.d: AUTOHOSTLIST_INCOMING_MAXSEQ 2025-12-10 23:21:30 +03:00
bol-van d1690aadcf nfqws2: autohostlist incoming failure triggers change 2025-12-10 23:11:28 +03:00
bol-van 2dd8533fb5 nfqws2,zapret-lib.lua,zapret-auto.lua: restructure conntrack record 2025-12-10 19:36:31 +03:00
bol-van 33ac18ea6b zapret-lib,zapret-auto: do not use desync copy to not lose VERDICT_MODIFY changes 2025-12-10 13:43:39 +03:00
bol-van 5c05c10f83 zapret-lib: return 0 if #val refers to non-string and non-table type 2025-12-10 10:49:46 +03:00
bol-van 7de0995d4a nfqws2,zapret-lib: fix non-working # and % arg subst under orchestrator 2025-12-10 10:28:48 +03:00
bol-van a1c64e4dea update doc 2025-12-09 18:08:36 +03:00
bol-van 92b66b1535 update doc 2025-12-09 18:08:01 +03:00
bol-van 9bf4fb11e7 update doc 2025-12-09 18:05:08 +03:00
bol-van 7deeb04207 start writing manual.md 2025-12-09 18:00:24 +03:00
bol-van 776155a326 blockcheck2: fix unterminated string 2025-12-09 14:17:07 +03:00
bol-van 30423596ca zapret-lib: detect_payload_str 2025-12-09 12:18:59 +03:00
bol-van 27ef67adf9 zapret-auto: cond_payload_str 2025-12-09 11:48:23 +03:00
bol-van bb604f111c zapret-auto: add comments 2025-12-09 11:22:09 +03:00
bol-van e5174bc9ad zapret-auto: condition and stopif orchestrators 2025-12-09 10:50:54 +03:00
bol-van 6c29bf6702 zapret-lib,zapret-auto: allow nested orchestration 2025-12-09 09:52:24 +03:00
bol-van 976033be37 nfqws2: do not increase upseq_prev on empty packets 2025-12-09 09:52:08 +03:00
bol-van f9b2135688 zapret-auto: add comments 2025-12-08 22:45:42 +03:00
bol-van 844fa6ab47 zapret-auto: optimize detector code 2025-12-08 20:02:26 +03:00
bol-van dc0fe70bd6 zapret-auto: udp_in/udp_out failure detection 2025-12-08 19:46:00 +03:00
bol-van 2752c26795 blockcheck2: FOOLINGS_UDP overridable 2025-12-08 18:37:18 +03:00
bol-van 1600b41135 init.d: support --hostlist-auto-retrans-threshold 2025-12-08 16:52:49 +03:00
bol-van 2017889207 nfqws2: change retransmission detection scheme 2025-12-08 16:46:04 +03:00
bol-van 146ab847df nfqws2: allow dupsid with partial tls 2025-12-08 11:31:46 +03:00
bol-van cf9059ed22 update changes.txt 2025-12-08 10:57:04 +03:00
bol-van c94264c79e nfqws2: more fixes to reasm overlap support 2025-12-08 10:55:32 +03:00
bol-van 04cb71150a nfqws2: improve reasm overlap support 2025-12-08 10:35:26 +03:00
bol-van 378ee514c4 nfqws2: reasm support negative overlaps without gaps and without going beyond the starting seq 2025-12-08 09:55:44 +03:00
bol-van 1a190fcf9e nfqws2: increase tls_mod sni max size 2025-12-07 21:30:07 +03:00
bol-van 0f8a788351 zapret-auto: optimize code 2025-12-07 20:05:43 +03:00
bol-van 4c00f11c15 zapret-auto: move crec record get 2025-12-07 20:01:29 +03:00
bol-van 0f8cfd7022 zapret-lib: remove duplicate function 2025-12-07 19:59:31 +03:00
bol-van 4563b6ddcb blockcheck2: syndata tests 2025-12-07 19:44:28 +03:00
bol-van 9ae6927a0e zapret-auto: remove duplicate seq assignment 2025-12-07 17:03:45 +03:00
bol-van 8540278c9b zapret-antidpi: use tls_mod_shim 2025-12-07 17:00:55 +03:00
bol-van 76b9ab5075 zapret-lib: improve random seed 2025-12-07 16:52:37 +03:00
bol-van 3a153035e8 zapret-lib,zapret-antidpi: support sni=%var in tls_mod 2025-12-07 15:08:56 +03:00
bol-van 2b5eb3cd2d blockcheck2: remove newline print if test function absent 2025-12-07 14:31:56 +03:00
bol-van 2c35e8949a blockcheck2: fix brokern http3 test 2025-12-07 14:01:54 +03:00
bol-van 7edd428508 zapret-auto, zapret-lib: deduplicate plan instance execution code 2025-12-07 11:07:46 +03:00
bol-van 7749fce7dc zapret-auto: separate failure detection logic 2025-12-07 10:51:52 +03:00
bol-van ea6e1e0853 blockcheck2: change qnum to allow parallel run with blockcheck1 for different domains 2025-12-07 09:46:32 +03:00
bol-van 7d2f12cbad zapret-auto: remove unused code 2025-12-06 23:50:35 +03:00
bol-van f91c069a8b nfqws2: fix wrong enum type 2025-12-06 23:25:19 +03:00
bol-van 6961c013c5 actions: build x86 binary with classic LUA 5.4 2025-12-06 23:13:19 +03:00
bol-van e5736b5fdd fix multiple problems with lua_Integer 32 bit type in lua < 5.3 on 32-bit platforms 2025-12-06 22:43:45 +03:00
bol-van efa675468d nfqws2: fix wrong payload/proto type 2025-12-06 20:53:42 +03:00
bol-van 1073f03802 update changes.txt 2025-12-06 20:27:26 +03:00
bol-van 9125cb0205 zapret-auto: circular.reqhost parameter 2025-12-06 20:25:04 +03:00
bol-van 9d5435f977 nfqws2: do not export instance_cutoff, export l7proto for conntrack-less case 2025-12-06 19:43:39 +03:00
bol-van f17ab4c91e zapret-lib,zapret-auto: unify messages 2025-12-06 17:19:28 +03:00
bol-van 97aa261e14 winws: always catch http redirect 2025-12-06 16:18:18 +03:00
bol-van 813fece07a nfqws2,zapret-auto: circular orchestrator 2025-12-06 15:58:09 +03:00
bol-van 2a7b44b1d0 zapret-lib: port support in url dissector 2025-12-06 10:46:47 +03:00
bol-van 28e719d825 zapret-lib: url and nld dissectors 2025-12-06 10:39:19 +03:00
bol-van 18725f6442 zapret-lib: remove temp debug code 2025-12-06 10:01:19 +03:00
bol-van 20b20fbb90 zapret-tests: adapt to 32bit arithmetics 2025-12-06 10:00:19 +03:00
bol-van 967b53b628 update changes.txt 2025-12-06 09:59:08 +03:00
bol-van 9cebc5cc37 nfqws2: remove any arithmetics beyond 32 bit 2025-12-06 09:57:08 +03:00
bol-van 0dc29c9c35 zapret-lib: http_reply dissector 2025-12-05 22:51:56 +03:00
bol-van fd1eac2ef1 zapret-lib: fix seq number substraction 2025-12-05 22:31:51 +03:00
bol-van 0c2abab6a9 nfqws2: uXadd luacalls 2025-12-05 22:31:27 +03:00
bol-van efd8acb8de zapret-lib: fix multiple problems 2025-12-05 14:42:33 +03:00
bol-van a147ebef61 update changes.txt 2025-12-05 11:28:58 +03:00
bol-van 7f4bdd5eb4 update changes.txt 2025-12-05 11:09:48 +03:00
bol-van 0588240d8d nfqws2: LUA_COMPAT_VER tracking 2025-12-05 11:07:14 +03:00
bol-van b9e03ef71b nfqws2: --template <name> , --cookie 2025-12-05 10:23:33 +03:00
bol-van 9c0c7cfa8c init.d: remove stun_binding_req 2025-12-04 23:24:05 +03:00
bol-van 807ad5953b nfqws2: profile templates, remove stun_bindin_req detalisation 2025-12-04 23:22:27 +03:00
bol-van ee031db3a1 blockcheck2: fix broken DNS cache 2025-12-04 14:57:00 +03:00
bol-van 93e4df72e5 zapret-lib: apply_arg_prefix, posdebug, argdebug 2025-12-03 16:08:12 +03:00
bol-van e62d3919f4 nfqws2: proper conntrack position of replay pieces 2025-12-03 16:07:10 +03:00
bol-van 63414f8608 zapret-lib: typo 2025-12-02 21:55:09 +03:00
bol-van 18974e6c1f zapret-lib: separate execution plan replay function 2025-12-02 21:54:28 +03:00
bol-van e61967ac2b nfqws2: profile names 2025-12-02 21:38:45 +03:00
bol-van 6010307667 nfqws2: post payload filter and range in exec plan, zapret-lib: duplicate range check logic 2025-12-02 20:48:03 +03:00
bol-van 04ceb589e0 nfqws2: desync orchestration luacalls 2025-12-02 17:49:23 +03:00
bol-van 69b08f0a36 install_easy 2025-12-02 15:45:57 +03:00
bol-van ec6021898b install_bin: remove macos support 2025-12-02 11:48:56 +03:00
bol-van 711eefed3e init.d: custom scripts replace spaces with tabs 2025-12-02 11:44:43 +03:00
bol-van 032b24f5b4 init.d: openwrt beautify pid file name 2025-12-02 11:38:31 +03:00
bol-van ef4b427836 nfqws2: test lua init scripts accessibility in --dry-run mode 2025-12-02 11:33:56 +03:00
bol-van a795b0f10c init.d: 40-webserver replace spaces with tabs 2025-12-02 11:11:24 +03:00
bol-van b56be286c9 init.d: 40-webserver custom script 2025-12-02 10:51:57 +03:00
bol-van 63668fc84e nft optimize rules 2025-12-02 10:49:50 +03:00
bol-van 837833feaf optimize nft chain activation 2025-12-02 09:19:09 +03:00
bol-van 90afc96283 fix 'which' function behavior with absolute paths 2025-12-02 08:53:03 +03:00
bol-van b0455bfee2 nft do not apply FILTER_MARK to incoming 2025-12-01 20:07:07 +03:00
bol-van d279fab308 nft optimize FILTER_MARK 2025-12-01 20:00:08 +03:00
bol-van 27695a892f nft remove unneeded nozapret set checks 2025-12-01 19:52:32 +03:00
bol-van 151226dfc2 update config.default 2025-12-01 16:44:47 +03:00
bol-van ef78f8d30c ipset 2025-12-01 15:49:03 +03:00
bol-van a01408a5c9 init.d launch scripts 2025-12-01 15:30:45 +03:00
bol-van 50ae834005 compile docs: fix path to /opt/zapret2 2025-12-01 13:19:45 +03:00
bol-van b21e85bfe9 nfqws2: wrong function name 2025-11-30 17:41:45 +03:00
bol-van b91fb6a424 nfqws2: lexra compile fix 2025-11-30 15:39:18 +03:00
bol-van 97e16b5611 blockcheck2: fix -wf winws parameters 2025-11-30 15:25:53 +03:00
bol-van 8fe63df846 update docs 2025-11-30 15:17:32 +03:00
bol-van 494abc0e53 update docs ver 2025-11-30 15:09:21 +03:00
bol-van ef300e5d21 blockcheck 2025-11-30 15:03:52 +03:00
bol-van 1f70b21a4d nfqws2: fix crash 2025-11-30 11:08:54 +03:00
bol-van 520bf5142f nfqws2: allow negative numbers in bu8,bu16,bu24,bu32,swap16,swap32 2025-11-30 09:25:43 +03:00
bol-van b2a611adba nfqws2: fix crash 2025-11-30 09:02:58 +03:00
bol-van 24320b6671 nfqws2: do not prohibit truncate calls 2025-11-29 23:05:00 +03:00
bol-van 709db5d135 doc typo 2025-11-29 22:55:01 +03:00
bol-van 6515cd3227 zapret-lib: fix rawsend_segmented 2025-11-29 21:07:59 +03:00
bol-van 574ad480f8 zapret-lib: fix mss issue in rawsend_segmented 2025-11-28 16:30:42 +03:00
bol-van bebb2ccabf zapret-antidpi: allow some desync funcs to work with arbitrary blobs 2025-11-28 16:21:13 +03:00
bol-van 4923ac7bc5 replace ip6_hopbyhop_x2 to ip6_hopbyhop2 2025-11-27 21:33:03 +03:00
bol-van 605af78ce8 fix rawsend tests on windows 2025-11-27 09:45:52 +03:00
bol-van b496bac9ab zapret-pcap: improve comment 2025-11-27 08:48:59 +03:00
bol-van 9ba7ad6263 zapret-pcap: improve comment 2025-11-27 08:48:16 +03:00
bol-van 36a980469f zapret-pcap: 'keep' parameter 2025-11-27 08:47:28 +03:00
bol-van 284b345482 zapret-pcap: separate pcap write functions 2025-11-27 08:44:36 +03:00
bol-van 5866bc7721 winws2: gettid support 2025-11-26 22:14:41 +03:00
bol-van bcf11b8f72 nfqws2: support \: escapement in --lua-desync args 2025-11-26 18:18:39 +03:00
bol-van ee11c760fd zapret-lib: fix comment 2025-11-26 18:01:50 +03:00
bol-van e1c6802b52 nfqws2: getpid and gettid luacall 2025-11-26 17:51:46 +03:00
bol-van 8d2b7d9ef2 zapret-pcap: cache file name 2025-11-26 17:11:52 +03:00
bol-van 733171fb3c zapret_pcap: fix comment 2025-11-26 15:38:39 +03:00
bol-van 9eaf346253 zapret-pcap.lua 2025-11-26 15:30:54 +03:00
bol-van 1cfec4d737 nfqws2: update code 2025-11-26 14:11:29 +03:00
bol-van 39c6a71481 move basic desync functions to zapret-lib.lua 2025-11-25 16:35:15 +03:00
bol-van 35b97450fe nfqws2: optimize mtproto detection 2025-11-25 14:49:33 +03:00
bol-van cfb8b9f11f nfqws2: optimize aes-ctr and mtproto detection 2025-11-25 14:47:18 +03:00
bol-van 5e737f314b fix lua5.4 incompat 2025-11-25 13:26:55 +03:00
bol-van 6a26ea85a3 update docs 2025-11-25 13:08:40 +03:00
bol-van 1eb780bb06 update docs 2025-11-25 13:04:25 +03:00
bol-van db2412a6b4 nfqws2: # and % arg subst 2025-11-25 13:03:28 +03:00
bol-van de15c25def zapret-antidpi: luaexec 2025-11-25 13:03:11 +03:00
bol-van 3ee6d2fb48 nfqws2: make --writeable dir optional and support it in all OS 2025-11-25 10:35:04 +03:00
bol-van 9822fd0b36 github: delete windivert filters from embedded build 2025-11-24 20:57:51 +03:00
205 changed files with 36977 additions and 4529 deletions

No files matched your search

+2
View File
@@ -1,5 +1,7 @@
* text=auto eol=lf
*.cmd eol=crlf
*.bat eol=crlf
*.manifest eol=crlf
*.rc eol=crlf
init.d/windivert.filter.examples/** eol=crlf
files/** binary
+7 -1
View File
@@ -11,8 +11,14 @@ Issues - это место для обращений к разработчику
Discussions - место для обсуждения вопросов между пользователями.
Все, что выходит за рамки багов и технически грамотных предложений, идей,
вопросы типа "как мне это запустить", "что нажать", "что вписать" - будет безжалостно удаляться.
вопросы типа "как мне это запустить", "что нажать", "что вписать", "перестало открываться" - будет безжалостно удаляться.
Если вы не знаете как пользоваться, для вас что-то сложно, здесь - не место обучению программе или linux и не место для вопросов подобного рода.
Поймите, пожалуйста, что zapret - это инструмент, а не готовое решение для пользователя. В его функциях нет кнопки "открыть сайты", поэтому
если они перестали открываться - это не issue. Функцию "открыть сайты" дают только сборки - ищите их и все вопросы адресуйте туда.
Если вы игнорируете данное требование, вы не достигните своих целей , а только добавите желания удалить ваш issue или при настойчивости забанить.
Идите в дискуссии, не захламляйте issues.
Так же будут немедленно удаляться любые issue, связанные с реакцией антивирусов. При агрессии или настойчивости - бан. (подсказка : вирусов нет, удаляйте если не верите)
Here is the place for bugs only. All questions, especially user-like questions (non-technical) go to Discussions.
There're also no viruses here. All virus claims and everyting non-technical and non-bugs will be instantly deleted, closed or moved to Discussions.
+92 -47
View File
@@ -25,33 +25,21 @@ jobs:
- arch: arm64
tool: aarch64-unknown-linux-musl
- arch: arm
tool: arm-unknown-linux-musleabi
# - arch: armhf
# tool: arm-unknown-linux-musleabihf
# - arch: armv7
# tool: armv7-unknown-linux-musleabi
# - arch: armv7hf
# tool: armv7-unknown-linux-musleabihf
# - arch: mips64el
# tool: mips64el-unknown-linux-musl
tool: armv6-unknown-linux-musleabi
- arch: mips64
tool: mips64-unknown-linux-musl
# - arch: mipsel
# tool: mipsel-unknown-linux-musl
- arch: mipselsf
tool: mipsel-unknown-linux-muslsf
# - arch: mips
# tool: mips-unknown-linux-musl
- arch: mipssf
tool: mips-unknown-linux-muslsf
# - arch: ppc64
# tool: powerpc64-unknown-linux-musl
- arch: ppc
tool: powerpc-unknown-linux-musl
- arch: x86
tool: i586-unknown-linux-musl
- arch: x86_64
tool: x86_64-unknown-linux-musl
- arch: riscv64
tool: riscv64-unknown-linux-musl
- arch: lexra
tool: mips-linux
dir: rsdk-4.6.4-5281-EB-3.10-0.9.33-m32ub-20141001
@@ -69,17 +57,17 @@ jobs:
env:
ARCH: ${{ matrix.arch }}
TOOL: ${{ matrix.tool }}
REPO: ${{ matrix.arch == 'lexra' && matrix.repo || 'spvkgn/musl-cross' }}
REPO: ${{ matrix.arch == 'lexra' && matrix.repo || 'bol-van/musl-cross' }}
DIR: ${{ matrix.arch == 'lexra' && matrix.dir || matrix.tool }}
run: |
sudo dpkg --add-architecture i386
sudo apt update -qq
if [[ "$ARCH" == lexra ]]; then
sudo apt install -y libcap-dev libc6:i386 zlib1g:i386
sudo apt install -y pigz libcap-dev libc6:i386 zlib1g:i386
URL=https://github.com/$REPO/raw/refs/heads/master/$DIR.txz
else
# luajit buildvm requires 32 bit executable on host platform for 32 bit cross targets
sudo apt install -y libcap-dev libc6-dev gcc-multilib
sudo apt install -y pigz libcap-dev libc6-dev gcc-multilib
URL=https://github.com/$REPO/releases/download/latest/$TOOL.tar.xz
fi
mkdir -p $HOME/tools
@@ -93,11 +81,15 @@ jobs:
CFLAGS: ${{ matrix.env.CFLAGS != '' && matrix.env.CFLAGS || null }}
LDFLAGS: ${{ matrix.env.LDFLAGS != '' && matrix.env.LDFLAGS || null }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LUA_VER: 5.4
LUA_RELEASE: 5.4.8
LUA_VER: 5.5
LUA_RELEASE: 5.5.1
LUAJIT_VER: 2.1
LUAJIT_RELEASE: 2.1-20250826
LUAJIT_LUAVER: 5.1
MINSIZE: -flto=auto -ffunction-sections -fdata-sections
LDMINSIZE: -Wl,--gc-sections -flto=auto
#current toolchain's musl is not PIC. will be broken by upx
#PIC: -fpic
run: |
DEPS_DIR=$GITHUB_WORKSPACE/deps
export CC="$TARGET-gcc"
@@ -107,13 +99,28 @@ jobs:
export STRIP=$TARGET-strip
export PKG_CONFIG_PATH=$DEPS_DIR/lib/pkgconfig
export STAGING_DIR=$RUNNER_TEMP
OPTIMIZE=-Oz
SYSMALLOC=-DLUAJIT_USE_SYSMALLOC
case "$ARCH" in
lexra)
OPTIMIZE=-Os
;;
arm)
CPU="-mcpu=arm1176jzf-s -mthumb"
;;
arm64|mips64)
# not safe without GC64
SYSMALLOC=
;;
esac
MINSIZE="$OPTIMIZE $MINSIZE"
if [[ "$ARCH" == lexra ]] || [[ "$ARCH" == ppc ]]; then
if [[ "$ARCH" == lexra ]] || [[ "$ARCH" == riscv64 ]] || [[ "$ARCH" == x86 ]] ; then
# use classic lua
wget -qO- https://www.lua.org/ftp/lua-${LUA_RELEASE}.tar.gz | tar -xz
(
cd lua-${LUA_RELEASE}
make CC=$CC CFLAGS="-Os -flto=auto $CFLAGS" linux -j$(nproc)
make CC=$CC AR="$AR rc" CFLAGS="$CPU $MINSIZE $CFLAGS" LDFLAGS="$LDMINSIZE $LDFLAGS" linux -j$(nproc)
make install INSTALL_TOP=$DEPS_DIR INSTALL_BIN=$DEPS_DIR/bin INSTALL_INC=$DEPS_DIR/include/lua${LUA_VER} INSTALL_LIB=$DEPS_DIR/lib
)
LJIT=0
@@ -129,9 +136,10 @@ jobs:
*)
HOSTCC="cc -m32"
esac
echo ARCH=$ARCH SYSMALLOC=$SYSMALLOC
(
cd luajit2-*
make BUILDMODE=static XCFLAGS=-DLUAJIT_DISABLE_FFI HOST_CC="$HOSTCC" CROSS= CC="$CC" TARGET_AR="$AR rcus" TARGET_STRIP=$STRIP CFLAGS="-Os -s -flto=auto $CFLAGS" -j$(nproc)
make BUILDMODE=static XCFLAGS="$SYSMALLOC -DLUAJIT_DISABLE_FFI" HOST_CC="$HOSTCC" CROSS= CC="$CC" TARGET_AR="$AR rcus" TARGET_STRIP=$STRIP TARGET_CFLAGS="$CPU $MINSIZE $CFLAGS" TARGET_LDFLAGS="$CPU $LDMINSIZE $LDFLAGS" -j$(nproc)
make install PREFIX= DESTDIR=$DEPS_DIR
)
LJIT=1
@@ -147,7 +155,8 @@ jobs:
for i in libmnl libnfnetlink libnetfilter_queue ; do
(
cd $i-*
CFLAGS="-Os -flto=auto $CFLAGS" \
CFLAGS="$CPU $MINSIZE $CFLAGS" \
LDFLAGS="$LDMINSIZE $LDFLAGS" \
./configure --prefix= --host=$TARGET --enable-static --disable-shared --disable-dependency-tracking
make install -j$(nproc) DESTDIR=$DEPS_DIR
)
@@ -159,7 +168,7 @@ jobs:
xargs -I{} wget -qO- https://github.com/madler/zlib/archive/refs/tags/{}.tar.gz | tar -xz
(
cd zlib-*
CFLAGS="-Os -flto=auto $CFLAGS" \
CFLAGS="$CPU $MINSIZE $CFLAGS" \
./configure --prefix= --static
make install -j$(nproc) DESTDIR=$DEPS_DIR
)
@@ -170,9 +179,10 @@ jobs:
install -Dm644 -t $DEPS_DIR/include/sys /usr/include/x86_64-linux-gnu/sys/queue.h /usr/include/sys/capability.h
# zapret2
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -static-libgcc -static -I$DEPS_DIR/include $CFLAGS" \
OPTIMIZE=$OPTIMIZE \
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -static-libgcc -I$DEPS_DIR/include $CPU $CFLAGS" \
LDFLAGS="-L$DEPS_DIR/lib $LDFLAGS" \
make -C zapret2 LUA_JIT=$LJIT LUA_CFLAGS="$LCFLAGS" LUA_LIB="$LLIB" -j$(nproc)
make -C zapret2 CFLAGS_PIC= LDFLAGS_PIE=-static LUA_JIT=$LJIT LUA_CFLAGS="$LCFLAGS" LUA_LIB="$LLIB" -j$(nproc)
tar -C zapret2/binaries/my -cJf zapret2-linux-$ARCH.tar.xz .
@@ -220,6 +230,8 @@ jobs:
LUAJIT_VER: 2.1
LUAJIT_RELEASE: 2.1-20250826
LUAJIT_LUAVER: 5.1
MINSIZE: -Oz -flto=auto -ffunction-sections -fdata-sections
LDMINSIZE: -Wl,--gc-sections -flto=auto
run: |
DEPS_DIR=$GITHUB_WORKSPACE/deps
export TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64
@@ -230,6 +242,17 @@ jobs:
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip
export PKG_CONFIG_PATH=$DEPS_DIR/lib/pkgconfig
SYSMALLOC=-DLUAJIT_USE_SYSMALLOC
case "$ABI" in
armeabi-v7a)
CPU="-mthumb"
;;
arm64-v8a)
# not safe without GC64
SYSMALLOC=
PAGESIZE="-Wl,-z,max-page-size=16384"
;;
esac
# luajit
wget -qO- https://github.com/openresty/luajit2/archive/refs/tags/v${LUAJIT_RELEASE}.tar.gz | tar -xz
@@ -242,7 +265,7 @@ jobs:
esac
(
cd luajit2-*
make BUILDMODE=static XCFLAGS=-DLUAJIT_DISABLE_FFI HOST_CC="$HOSTCC" CROSS= CC="$CC" TARGET_AR="$AR rcus" TARGET_STRIP=$STRIP CFLAGS="-Os -flto=auto $CFLAGS" -j$(nproc)
make BUILDMODE=static XCFLAGS="$SYSMALLOC -DLUAJIT_DISABLE_FFI" HOST_CC="$HOSTCC" CROSS= CC="$CC" TARGET_AR="$AR rcus" TARGET_STRIP=$STRIP TARGET_CFLAGS="$CPU $MINSIZE $CFLAGS" TARGET_LDFLAGS="$LDMINSIZE $LDFLAGS" -j$(nproc)
make install PREFIX= DESTDIR=$DEPS_DIR
)
LJIT=1
@@ -258,7 +281,8 @@ jobs:
for i in libmnl libnfnetlink libnetfilter_queue ; do
(
cd $i-*
CFLAGS="-Os -flto=auto -Wno-implicit-function-declaration" \
CFLAGS="$CPU $MINSIZE -Wno-implicit-function-declaration $CFLAGS" \
LDFLAGS="$LDMINSIZE $LDFLAGS" \
./configure --prefix= --host=$TARGET --enable-static --disable-shared --disable-dependency-tracking
make install -j$(nproc) DESTDIR=$DEPS_DIR
)
@@ -266,8 +290,8 @@ jobs:
done
# zapret2
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -I$DEPS_DIR/include" \
LDFLAGS="-L$DEPS_DIR/lib" \
CFLAGS="-DZAPRET_GH_VER=${{ github.ref_name }} -DZAPRET_GH_HASH=${{ github.sha }} -I$DEPS_DIR/include $CPU" \
LDFLAGS="-L$DEPS_DIR/lib $PAGESIZE" \
make -C zapret2 LUA_JIT=$LJIT LUA_CFLAGS="$LCFLAGS" LUA_LIB="$LLIB" -j$(nproc) android
# strip unwanted ELF sections to prevent warnings on old Android versions
@@ -313,13 +337,16 @@ jobs:
env:
TARGET: ${{ matrix.target }}
ARCH: ${{ matrix.arch }}
PIC: -fpic
CC: ${{ matrix.target }}-freebsd11-clang
MINSIZE: -Os -flto=auto -ffunction-sections -fdata-sections
LDMINSIZE: -Wl,--gc-sections -flto=auto
run: |
wget -qO- https://github.com/openresty/luajit2/archive/refs/tags/v${LUAJIT_RELEASE}.tar.gz | tar -xz
(
cd luajit2-*
make BUILDMODE=static XCFLAGS=-DLUAJIT_DISABLE_FFI HOST_CC=gcc CC=$CC CFLAGS="-Os -flto=auto $CFLAGS"
make BUILDMODE=static XCFLAGS="$PIC -DLUAJIT_USE_SYSMALLOC -DLUAJIT_DISABLE_FFI" HOST_CC=gcc CC=$CC TARGET_CFLAGS="$MINSIZE $CFLAGS $PIC" TARGET_LDFLAGS="$LDMINSIZE $LDFLAGS"
make install PREFIX= DESTDIR=$DEPS_DIR
)
@@ -390,8 +417,8 @@ jobs:
uses: cygwin/cygwin-install-action@v4
with:
platform: ${{ matrix.arch }}
site: ${{ matrix.arch == 'x86_64' && 'http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/64bit/2024/01/30/231215' || null }}
check-sig: ${{ matrix.arch == 'x86_64' && 'false' || null }}
site: ${{ matrix.arch == 'x86_64' && 'http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/64bit/2024/01/30/231215' || 'http://ctm.crouchingtigerhiddenfruitbat.org/pub/cygwin/circa/2022/11/23/063457' }}
check-sig: 'false'
packages: >-
gcc-core
make
@@ -424,13 +451,15 @@ jobs:
- name: Build luajit
env:
LUAJIT_RELEASE: 2.1-20250826
MINSIZE: -Os -flto=auto -ffunction-sections -fdata-sections
LDMINSIZE: -Wl,--gc-sections -flto=auto
shell: C:\cygwin\bin\bash.exe -eo pipefail '{0}'
run: >-
export MAKEFLAGS=-j$(nproc) &&
wget -q https://github.com/openresty/luajit2/archive/refs/tags/v${LUAJIT_RELEASE}.tar.gz &&
tar -xzf v${LUAJIT_RELEASE}.tar.gz &&
rm -f v${LUAJIT_RELEASE}.tar.gz &&
make -C luajit2-${LUAJIT_RELEASE} BUILDMODE=static XCFLAGS=-DLUAJIT_DISABLE_FFI CFLAGS="-Os -s" &&
make -C luajit2-${LUAJIT_RELEASE} BUILDMODE=static XCFLAGS="-DLUAJIT_USE_SYSMALLOC -DLUAJIT_DISABLE_FFI -ffat-lto-objects" TARGET_CFLAGS="$MINSIZE $CFLAGS" TARGET_LDFLAGS="$LDMINSIZE $LDFLAGS" &&
make -C luajit2-${LUAJIT_RELEASE} install
- name: Build winws
@@ -453,6 +482,7 @@ jobs:
cp -a -t output psmisc/psmisc-*.src/psmisc-*/inst/usr/bin/killall.exe /usr/bin/cygwin1.dll &&
wget -O WinDivert.zip https://github.com/basil00/WinDivert/releases/download/v2.2.2/WinDivert-2.2.2-A.zip &&
unzip -j WinDivert.zip "*/${DIR}/WinDivert.dll" "*/${DIR}/WinDivert${BITS}.sys" -d output &&
peflags --dynamicbase=true output/WinDivert.dll &&
zip zapret2-win-${{ matrix.arch }}.zip -j output/*
- name: Upload artifacts
@@ -485,17 +515,28 @@ jobs:
pattern: zapret2-*
- name: Install upx
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
version: v4.2.4
shell: bash
env:
VER_OLD: 4.2.4
VER_NEW: 5.1.0
run: |
# old upx works for old kernels like 2.6.26
# new upx crashes on ~<3.10 but required for riscv64
curl -Lo - https://github.com/upx/upx/releases/download/v$VER_OLD/upx-$VER_OLD-amd64_linux.tar.xz | tar -Jx upx-$VER_OLD-amd64_linux/upx
sudo cp upx-$VER_OLD-amd64_linux/upx /usr/local/bin/upx_old
curl -Lo - https://github.com/upx/upx/releases/download/v$VER_NEW/upx-$VER_NEW-amd64_linux.tar.xz | tar -Jx upx-$VER_NEW-amd64_linux/upx
sudo cp upx-$VER_NEW-amd64_linux/upx /usr/local/bin/upx_new
rm -r upx-$VER_OLD-amd64_linux/upx upx-$VER_NEW-amd64_linux/upx
- name: Prepare binaries
shell: bash
run: |
cd ${{ steps.bins.outputs.download-path }}
run_upx() {
upx --best --lzma $@ || true
run_upx_old() {
upx_old --best --lzma $@ || true
}
run_upx_new() {
upx_new --best --lzma $@ || true
}
run_dir() {
for f in $dir/* ; do
@@ -503,8 +544,10 @@ jobs:
case $f in
*.tar.xz )
tar -C $dir -xvf $f && rm $f
if [[ $dir =~ linux ]] && [[ $dir != *-linux-mips64 ]] && [[ $dir != *-linux-lexra ]]; then
run_upx $dir/*
if [[ $dir = *-linux-riscv64 ]]; then
run_upx_new $dir/*
elif [[ $dir =~ linux ]] && [[ $dir != *-linux-mips64 ]] && [[ $dir != *-linux-lexra ]]; then
run_upx_old $dir/*
fi
;;
*.zip )
@@ -532,6 +575,7 @@ jobs:
*-linux-mipselsf ) run_dir linux-mipsel ;;
*-linux-mipssf ) run_dir linux-mips ;;
*-linux-ppc ) run_dir linux-ppc ;;
*-linux-riscv64 ) run_dir linux-riscv64 ;;
*-linux-x86 ) run_dir linux-x86 ;;
*-linux-x86_64 ) run_dir linux-x86_64 ;;
*-linux-lexra ) run_dir linux-lexra ;;
@@ -546,15 +590,16 @@ jobs:
run: |
rm -rf ${{ env.repo_dir }}/.git*
find ${{ env.repo_dir }}/binaries -type f -exec sha256sum {} \; >sha256sum.txt
tar --owner=0 --group=0 -czf ${{ env.repo_dir }}.tar.gz ${{ env.repo_dir }}
zip -qr ${{ env.repo_dir }}.zip ${{ env.repo_dir }}
tar --owner=0 --group=0 -c ${{ env.repo_dir }} | pigz -11 >${{ env.repo_dir }}.tar.gz
zip -9qr ${{ env.repo_dir }}.zip ${{ env.repo_dir }}
(
cd ${{ env.repo_dir }}
rm -rf binaries/{android*,freebsd*,win*} \
init.d/{openrc,pfsense,runit,s6,systemd} \
init.d/{openrc,pfsense,runit,s6,systemd,windivert.filter.examples} \
nfq2 ip2net mdig docs Makefile
pigz -11 lua/*.lua
)
tar --owner=0 --group=0 -czf ${{ env.repo_dir }}-openwrt-embedded.tar.gz ${{ env.repo_dir }}
tar --owner=0 --group=0 -c ${{ env.repo_dir }} | pigz -11 >${{ env.repo_dir }}-openwrt-embedded.tar.gz
- name: Upload release assets
uses: softprops/action-gh-release@v2
+1
View File
@@ -11,3 +11,4 @@ ipset/zapret-ip*.txt
ipset/zapret-ip*.gz
ipset/zapret-hosts*.txt
ipset/zapret-hosts*.gz
.vscode/
+2
View File
@@ -0,0 +1,2 @@
Бинари только в релизах. Собираем с исходников или качаем релиз с гитхаба ! Инфа по сборке в docs/compile.
Binaries are only in releases. Build from source or download release from github ! See docs/compile.
+79
View File
@@ -0,0 +1,79 @@
LIST_HTTP="${LIST_HTTP:-$TESTDIR/list_http.txt}"
LIST_HTTPS_TLS12="${LIST_HTTPS_TLS12:-$TESTDIR/list_https_tls12.txt}"
LIST_HTTPS_TLS13="${LIST_HTTPS_TLS13:-$TESTDIR/list_https_tls13.txt}"
LIST_QUIC="${LIST_QUIC:-$TESTDIR/list_quic.txt}"
emptyf()
{
:
}
check_list()
{
# $1 - test function
# $2 - domain
# $3 - file
local line ok=0
[ -f "$3" ] || {
echo "no strategy file '$3'"
return 1
}
while IFS= read -r line; do
case "$line" in
""|\#*) continue ;;
esac
line=$(echo "$line" | tr -d "\r\n")
# dry run eval in subshell. can fail because of unescaped chars or something else
if (eval emptyf $line) 2>/dev/null; then
# real run in the current shell. can modify vars
eval pktws_curl_test_update "$1" "$2" $line && ok=1
else
# $line contains characters that are meaningful to nfqws2/lua-desync
# syntax (e.g. "<" in --out-range=s1<d1, or "(" and "'" in a
# --lua-init=...=tls_mod(...,'rnd') expression) but aren't valid
# shell syntax on their own, so the dry run above rejected it.
# Fall back to a plain (non-eval) split: $line is only word-split
# on whitespace here, nothing in it is re-parsed as shell syntax,
# so these can be used exactly as blockcheck2 itself prints them,
# with no manual escaping needed.
pktws_curl_test_update "$1" "$2" $line && ok=1
echo >&2 'WARNING: this strategy fails eval (may be unescaped special characters). using fallback space separated method'
echo >&2 "WARNING: exact line : $line"
fi
done < "$3"
[ "$ok" = 1 ]
}
pktws_check_http()
{
# $1 - test function
# $2 - domain
check_list "$1" "$2" "$LIST_HTTP"
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
check_list "$1" "$2" "$LIST_HTTPS_TLS12"
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
check_list "$1" "$2" "$LIST_HTTPS_TLS13"
}
pktws_check_http3()
{
# $1 - test function
# $2 - domain
check_list "$1" "$2" "$LIST_QUIC"
}
+12
View File
@@ -0,0 +1,12 @@
Простой тестер стратегий по списку из файла.
Скопируйте эту директорию под другим именем в blockcheck2.d, отредактируйте list файлы, впишите туда свои стратегии.
В диалоге blockcheck2.sh выберите тест с названием вашей директории.
Можно комментировать строки символом '#' в начале строки.
Параметры со спец символами типа "<" больше не обязательно эскейпить - если строка не разбирается как shell, она пробуется заново буквально. Эскейпинг по правилам shell по-прежнему работает и пробуется первым.
Альтернативный путь до файлов стратегий можно задать переменными LIST_HTTP, LIST_HTTPS_TLS12, LIST_HTTPS_TLS13, LIST_QUIC.
This is simple strategy tester from a file.
Copy this folder, write your strategies into list files and select your test in blockcheck2 dialog.
Lines can be commented using the '#' symbol at the line start.
Parameters with special symbols like "<" no longer need escaping - a line that doesn't parse as shell is retried literally instead of failing. Escaping by shell rules still works too and is tried first.
Strategy list files paths can be overriden in env variables : LIST_HTTP, LIST_HTTPS_TLS12, LIST_HTTPS_TLS13, LIST_QUIC.
+5
View File
@@ -0,0 +1,5 @@
# write nfqws2 parameters here
# WARNING : parameters with special symbols like "<" must be escaped or will cause error
--payload=http_req --lua-desync=http_hostcase
--payload=http_req --lua-desync=http_methodeol
--payload=http_req --lua-desync=fake:blob=fake_default_http:tcp_ts=-1000
@@ -0,0 +1,4 @@
# write nfqws2 parameters here
# WARNING : parameters with special symbols like "<" must be escaped or will cause error
--payload tls_client_hello --lua-desync=fake:blob=fake_default_tls:tcp_ts=-1000
--payload=tls_client_hello --lua-desync=fake:blob=0x00000000:tcp_md5:repeats=1 --lua-desync=fake:blob=fake_default_tls:tcp_md5:tls_mod=rnd,dupsid:repeats=1 --lua-desync=multisplit:pos=2
@@ -0,0 +1,5 @@
# write nfqws2 parameters here
# WARNING : parameters with special symbols like "<" must be escaped or will cause error
--payload tls_client_hello --lua-desync=fake:blob=fake_default_tls:tcp_ts=-1000
--payload tls_client_hello --lua-desync=tcpseg:pos=0,-1:seqovl=1 --lua-desync=drop
--payload tls_client_hello --lua-desync=luaexec:code="desync.pat=tls_mod(fake_default_tls,'rnd,rndsni,dupsid,padencap',desync.reasm_data)" --lua-desync=tcpseg:pos=0,-1:seqovl=#pat:seqovl_pattern=pat --lua-desync=drop
+4
View File
@@ -0,0 +1,4 @@
# write nfqws2 parameters here
# WARNING : parameters with special symbols like "<" must be escaped or will cause error
--payload quic_initial --lua-desync=fake:blob=fake_default_quic:repeats=11
--payload quic_initial --lua-desync=send:ipfrag --lua-desync=drop
+12
View File
@@ -0,0 +1,12 @@
pktws_check_http()
{
# $1 - test function
# $2 - domain
local s
[ "$NOTEST_BASIC_HTTP" = 1 ] && { echo "SKIPPED"; return; }
for s in 'http_hostcase' 'http_hostcase:spell=hoSt' 'http_domcase' 'http_methodeol' 'http_unixeol'; do
pktws_curl_test_update $1 $2 --payload=http_req --lua-desync=$s
done
}
+42
View File
@@ -0,0 +1,42 @@
. "$TESTDIR/def.inc"
pktws_check_http()
{
# $1 - test function
# $2 - domain
local PAYLOAD="--payload=http_req" repeats ok
[ "$NOTEST_MISC_HTTP" = 1 ] && { echo "SKIPPED"; return; }
for repeats in 1 20 100 260; do
# send starting bytes of original payload
pktws_curl_test_update "$1" "$2" $PAYLOAD --lua-desync=tcpseg:pos=0,method+2:ip_id=rnd:repeats=$repeats && ok=1
pktws_curl_test_update "$1" "$2" $PAYLOAD --lua-desync=tcpseg:pos=0,midsld:ip_id=rnd:repeats=$repeats && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" != force ] && break
done
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
local PAYLOAD="--payload=tls_client_hello" repeats ok
[ "$NOTEST_MISC_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
for repeats in 1 20 100 260; do
# send starting bytes of original payload
pktws_curl_test_update "$1" "$2" $PAYLOAD --lua-desync=tcpseg:pos=0,1:ip_id=rnd:repeats=$repeats && ok=1
pktws_curl_test_update "$1" "$2" $PAYLOAD --lua-desync=tcpseg:pos=0,midsld:ip_id=rnd:repeats=$repeats && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" != force ] && break
done
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
pktws_check_https_tls12 "$1" "$2"
}
+39
View File
@@ -0,0 +1,39 @@
. "$TESTDIR/def.inc"
pktws_oob()
{
# $1 - test function
# $2 - domain
local urp
for urp in b 0 2 midsld; do
pktws_curl_test_update "$1" "$2" --in-range=-s1 --lua-desync=oob:urp=$urp
done
}
pktws_check_http()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_OOB_HTTP" = 1 ] && { echo "SKIPPED"; return; }
pktws_oob "$@"
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_OOB_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_oob "$@"
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
pktws_check_https_tls12 "$1" "$2"
}
+74
View File
@@ -0,0 +1,74 @@
. "$TESTDIR/def.inc"
pktws_simple_split_tests()
{
# $1 - test function
# $2 - domain/uri
# $3 - splits
# $4 - PRE args for nfqws2
local pos ok ok_any pre="$4" func
local splitf splitfs="multisplit multidisorder"
ok_any=0
for splitf in $splitfs; do
func=$splitf
[ "$func" = multidisorder ] && func=$MULTIDISORDER
eval need_$splitf=0
ok=0
for pos in $3; do
pktws_curl_test_update $1 $2 $pre $PAYLOAD --lua-desync=$func:pos=$pos && ok=1
done
[ "$ok" = 1 -a "$SCANLEVEL" != force ] || eval need_$splitf=1
[ "$ok" = 1 ] && ok_any=1
done
[ "$ok_any" = 1 ]
}
pktws_check_http()
{
# $1 - test function
# $2 - domain
local splits_http='method+2 midsld method+2,midsld'
local PAYLOAD="--payload=http_req"
[ "$NOTEST_MULTI_HTTP" = 1 ] && { echo "SKIPPED"; return; }
pktws_simple_split_tests "$1" "$2" "$splits_http"
}
pktws_check_https_tls()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
local splits_tls='2 1 sniext+1 sniext+4 host+1 midsld 1,midsld 1,midsld,1220 1,sniext+1,host+1,midsld-2,midsld,midsld+2,endhost-1'
local PAYLOAD="--payload=tls_client_hello"
pktws_simple_split_tests "$1" "$2" "$splits_tls" "$3"
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_MULTI_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2" && [ "$SCANLEVEL" != force ] && return
# do not use 'need' values obtained with wssize
local need_multisplit_save=$need_multisplit need_multidisorder_save=$need_multidisorder
pktws_check_https_tls "$1" "$2" --lua-desync=wssize:wsize=1:scale=6
need_multisplit=$need_multisplit_save; need_multidisorder=$need_multidisorder_save
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_MULTI_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2"
}
+92
View File
@@ -0,0 +1,92 @@
. "$TESTDIR/def.inc"
pktws_check_http()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_SEQOVL_HTTP" = 1 ] && { echo "SKIPPED"; return; }
local PAYLOAD="--payload=http_req"
local ok pat= split f f2
pat=${SEQOVL_PATTERN_HTTP:+seqovl_pat}
pat=${pat:-fake_default_http}
pktws_curl_test_update $1 $2 $PAYLOAD --lua-desync=tcpseg:pos=0,-1:seqovl=1 --lua-desync=drop
pktws_curl_test_update $1 $2 ${SEQOVL_PATTERN_HTTP:+--blob=$pat:@"$SEQOVL_PATTERN_HTTP" }$PAYLOAD --lua-desync=tcpseg:pos=0,-1:seqovl=#$pat:seqovl_pattern=$pat --lua-desync=drop
ok=0
for split in method+2 method+2,midsld; do
pktws_curl_test_update $1 $2 $PAYLOAD --lua-desync=multisplit:pos=$split:seqovl=1 && ok=1
pktws_curl_test_update $1 $2 ${SEQOVL_PATTERN_HTTP:+--blob=$pat:@"$SEQOVL_PATTERN_HTTP" }$PAYLOAD --lua-desync=multisplit:pos=$split:seqovl=#$pat:seqovl_pattern=$pat && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" != force ] && break
done
for split in 'method+1 method+2' 'midsld-1 midsld' 'method+1 method+2,midsld'; do
f="$(extract_arg 1 $split)"
f2="$(extract_arg 2 $split)"
pktws_curl_test_update $1 $2 $PAYLOAD --lua-desync=$MULTIDISORDER:pos=$f2:seqovl=$f
pktws_curl_test_update $1 $2 ${SEQOVL_PATTERN_HTTP:+--blob=$pat:@"$SEQOVL_PATTERN_HTTP" }$PAYLOAD --lua-desync=$MULTIDISORDER:pos=$f2:seqovl=$f:seqovl_pattern=$pat
done
}
pktws_seqovl_tests_tls()
{
# $1 - test function
# $2 - domain/uri
# $3 - PRE args for nfqws2
local ok ok_any
local testf=$1 domain="$2" pre="$3"
local pat rnd_mod padencap_mod split f f2
local PAYLOAD="--payload=tls_client_hello"
pat=${SEQOVL_PATTERN_HTTPS:+seqovl_pat}
pat=${pat:-fake_default_tls}
rnd_mod="--lua-init=$pat=tls_mod($pat,'rnd')"
padencap_mod="--lua-desync=luaexec:code=desync.patmod=tls_mod($pat,'rnd,dupsid,padencap',desync.reasm_data)"
ok=0
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=tcpseg:pos=0,-1:seqovl=1 --lua-desync=drop && ok=1
pktws_curl_test_update $testf $domain ${SEQOVL_PATTERN_HTTPS:+--blob=$pat:@"$SEQOVL_PATTERN_HTTPS" }$rnd_mod $pre $PAYLOAD --lua-desync=tcpseg:pos=0,-1:seqovl=#$pat:seqovl_pattern=$pat --lua-desync=drop && ok=1
pktws_curl_test_update $testf $domain ${SEQOVL_PATTERN_HTTPS:+--blob=$pat:@"$SEQOVL_PATTERN_HTTPS" }$pre $PAYLOAD $padencap_mod --lua-desync=tcpseg:pos=0,-1:seqovl=#patmod:seqovl_pattern=patmod --lua-desync=drop && ok=1
ok_any=$ok
ok=0
for split in 10 10,sniext+1 10,sniext+4 10,midsld; do
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=multisplit:pos=$split:seqovl=1 && ok=1
pktws_curl_test_update $testf $domain ${SEQOVL_PATTERN_HTTPS:+--blob=$pat:@"$SEQOVL_PATTERN_HTTPS" }$rnd_mod $pre $PAYLOAD --lua-desync=multisplit:pos=$split:seqovl=#$pat:seqovl_pattern=$pat && ok=1
pktws_curl_test_update $testf $domain ${SEQOVL_PATTERN_HTTPS:+--blob=$pat:@"$SEQOVL_PATTERN_HTTPS" }$pre $PAYLOAD $padencap_mod --lua-desync=multisplit:pos=$split:seqovl=#patmod:seqovl_pattern=patmod && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" != force ] && break
done
for split in '1 2' 'sniext sniext+1' 'sniext+3 sniext+4' 'midsld-1 midsld' '1 2,midsld'; do
f="$(extract_arg 1 $split)"
f2="$(extract_arg 2 $split)"
pktws_curl_test_update $1 $2 $pre $PAYLOAD --lua-desync=$MULTIDISORDER:pos=$f2:seqovl=$f && ok=1
pktws_curl_test_update $testf $domain ${SEQOVL_PATTERN_HTTPS:+--blob=$pat:@"$SEQOVL_PATTERN_HTTPS" }$rnd_mod $pre $PAYLOAD --lua-desync=$MULTIDISORDER:pos=$f2:seqovl=$f:seqovl_pattern=$pat && ok=1
done
[ "$ok" = 1 ] && ok_any=1
[ "$ok_any" = 1 ]
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_SEQOVL_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_seqovl_tests_tls "$1" "$2" && [ "$SCANLEVEL" != force ] && return
pktws_seqovl_tests_tls "$1" "$2" --lua-desync=wssize:wsize=1:scale=6
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_SEQOVL_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_seqovl_tests_tls "$1" "$2"
}
+55
View File
@@ -0,0 +1,55 @@
. "$TESTDIR/def.inc"
pktws_check_http()
{
# $1 - test function
# $2 - domain
local PAYLOAD="--payload=http_req" split
[ "$NOTEST_SYNDATA_HTTP" = 1 ] && { echo "SKIPPED"; return; }
for split in '' multisplit $MULTIDISORDER; do
pktws_curl_test_update "$1" "$2" --lua-desync=syndata ${split:+$PAYLOAD --lua-desync=$split}
pktws_curl_test_update "$1" "$2" --lua-desync=syndata:blob=fake_default_http ${split:+$PAYLOAD --lua-desync=$split}
done
}
pktws_check_https_tls()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
local PAYLOAD="--payload=tls_client_hello" ok=0 pre="$3" split
for split in '' multisplit $MULTIDISORDER; do
pktws_curl_test_update "$1" "$2" $pre --lua-desync=syndata ${split:+$PAYLOAD --lua-desync=$split} && ok=1
pktws_curl_test_update "$1" "$2" $pre --lua-desync=syndata:blob=0x1603 ${split:+$PAYLOAD --lua-desync=$split} && ok=1
pktws_curl_test_update "$1" "$2" $pre --lua-desync=syndata:blob=fake_default_tls:tls_mod=rnd,dupsid,rndsni ${split:+$PAYLOAD --lua-desync=$split} && ok=1
pktws_curl_test_update "$1" "$2" $pre --lua-desync=syndata:blob=fake_default_tls:tls_mod=rnd,dupsid,sni=google.com ${split:+$PAYLOAD --lua-desync=$split} && ok=1
done
[ "$ok" = 1 ]
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_SYNDATA_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2" && [ "$SCANLEVEL" != force ] && return
pktws_check_https_tls "$1" "$2" --lua-desync=wssize:wsize=1:scale=6
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_SYNDATA_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2"
}
+162
View File
@@ -0,0 +1,162 @@
. "$TESTDIR/def.inc"
pktws_check_http()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_HTTP" = 1 ] && { echo "SKIPPED"; return; }
local testf=$1 domain="$2"
local ok ok_any ttls attls f ff fake fooling
local PAYLOAD="--payload=http_req"
if [ -n "$FAKE_HTTP" ]; then
fake=fake_http
else
fake=fake_default_http
fi
need_fake=0
[ "$MAX_TTL" = 0 ] || ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
[ "$MAX_AUTOTTL_DELTA" = 0 ] || attls=$(seq -s ' ' $MIN_AUTOTTL_DELTA $MAX_AUTOTTL_DELTA)
ok_any=0
ok=0
for ttl in $ttls; do
# orig-ttl=1 with start/cutoff limiter drops empty ACK packet in response to SYN,ACK. it does not reach DPI or server.
# missing ACK is transmitted in the first data packet of TLS/HTTP proto
for ff in $fake 0x00000000; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }$PAYLOAD "--lua-desync=fake:blob=${ff}:ip${IPVV}_ttl=$ttl:repeats=$FAKE_REPEATS" $f && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
done
[ "$ok" = 1 ] && break
done
for fooling in $FOOLINGS_TCP; do
for ff in $fake 0x00000000; do
pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=fake_http:@"$FAKE_HTTP" }$PAYLOAD --lua-desync=fake:blob=$ff:$fooling:repeats=$FAKE_REPEATS && ok=1
# duplicate SYN with MD5
contains "$fooling" tcp_md5 && pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }$PAYLOAD --lua-desync=fake:blob=$ff:$fooling:repeats=$FAKE_REPEATS --payload=empty "--out-range=<s1" --lua-desync=send:$TCP_MD5 && ok=1
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
for ttl in $attls; do
for ff in $fake 0x00000000; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }$PAYLOAD --lua-desync=fake:blob=$ff:ip${IPVV}_autottl=-$ttl,3-20:repeats=$FAKE_REPEATS $f && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ $ok = 0 -a "$SCANLEVEL" != force ] && need_fake=1
[ $ok = 1 ] && ok_any=1
[ $ok_any = 1 ]
}
pktws_fake_https_vary_()
{
local ok_any=0 testf=$1 domain="$2" fooling="$3" pre="$4" post="$5"
shift; shift; shift
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=$fake:$fooling:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=fake:blob=0x00000000:$fooling:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=0x00000000:$fooling:repeats=$FAKE_REPEATS --lua-desync=fake:blob=$fake:$fooling:tls_mod=rnd,dupsid:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }$pre $PAYLOAD --lua-desync=multisplit:blob=$fake:$fooling:pos=2:nodrop:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=$fake:$fooling:tls_mod=rnd,dupsid,padencap:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 ] && ok=1
}
pktws_fake_https_vary()
{
local ok_any=0 fooling="$3"
pktws_fake_https_vary_ "$1" "$2" "$3" "$4" "$5" && ok_any=1
# duplicate SYN with MD5
contains "$fooling" tcp_md5 && \
pktws_fake_https_vary_ "$1" "$2" "$3" "$4" "${5:+$5 }--payload=empty --out-range=<s1 --lua-desync=send:$TCP_MD5" && ok_any=1
[ "$ok_any" = 1 ]
}
pktws_check_https_tls()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
local testf=$1 domain="$2" pre="$3"
local ok ok_any ttls attls f fake fooling
local PAYLOAD="--payload=tls_client_hello"
shift; shift
if [ -n "$FAKE_HTTPS" ]; then
fake=fake_tls
else
fake=fake_default_tls
fi
need_fake=0
[ "$MAX_TTL" = 0 ] || ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
[ "$MAX_AUTOTTL_DELTA" = 0 ] || attls=$(seq -s ' ' $MIN_AUTOTTL_DELTA $MAX_AUTOTTL_DELTA)
ok_any=0
ok=0
for ttl in $ttls; do
# orig-ttl=1 with start/cutoff limiter drops empty ACK packet in response to SYN,ACK. it does not reach DPI or server.
# missing ACK is transmitted in the first data packet of TLS/HTTP proto
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_fake_https_vary $testf $domain "ip${IPVV}_ttl=$ttl" "$pre" "$f" && [ "$SCANLEVEL" != force ] && break
done
[ "$ok" = 1 ] && break
done
for fooling in $FOOLINGS_TCP; do
pktws_fake_https_vary $testf $domain "$fooling" "$pre"
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
for ttl in $attls; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_fake_https_vary $testf $domain "ip${IPVV}_autottl=-$ttl,3-20" "$pre" "$f" && [ "$SCANLEVEL" != force ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ $ok = 0 -a "$SCANLEVEL" != force ] && need_fake=1
[ $ok = 1 ] && ok_any=1
[ $ok_any = 1 ]
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2" && [ "$SCANLEVEL" != force ] && return
# do not use 'need' values obtained with wssize
local need_fake_save=$need_fake
pktws_check_https_tls "$1" "$2" --lua-desync=wssize:wsize=1:scale=6
need_fake=$need_fake_save
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2"
}
+114
View File
@@ -0,0 +1,114 @@
. "$TESTDIR/def.inc"
pktws_check_faked()
{
# $1 - test function
# $2 - domain
# $3 - payload_type
# $4 - splits
# $5 - pattern
# $6 - PRE args for nfqws2
local testf=$1 domain="$2" pre="$6"
local ok ok_any ttls attls f fooling
local splitf splitfs= split splits="$4"
local PAYLOAD="--payload=$3"
local FAKED_PATTERN="$5"
[ "$MAX_TTL" = 0 ] || ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
[ "$MAX_AUTOTTL_DELTA" = 0 ] || attls=$(seq -s ' ' $MIN_AUTOTTL_DELTA $MAX_AUTOTTL_DELTA)
# do not test fakedsplit if multisplit works
[ "$need_multisplit" = 0 -a "$SCANLEVEL" != force ] || splitfs=fakedsplit
# do not test fakeddisorder if multidisorder works
[ "$need_multidisorder" = 0 -a "$SCANLEVEL" != force ] || splitfs="${splitfs:+$splitfs }fakeddisorder"
ok_any=0
for splitf in $splitfs; do
ok=0
for ttl in $ttls; do
# orig-ttl=1 with start/cutoff limiter drops empty ACK packet in response to SYN,ACK. it does not reach DPI or server.
# missing ACK is transmitted in the first data packet of TLS/HTTP proto
for split in $splits; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_curl_test_update $testf $domain ${FAKED_PATTERN:+--blob=faked_pat:@"$FAKED_PATTERN" }$pre $PAYLOAD --lua-desync=$splitf:${FAKED_PATTERN:+pattern=faked_pat:}pos=$split:ip${IPVV}_ttl=$ttl:repeats=$FAKE_REPEATS $f && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$ok" = 1 ] && break
done
for fooling in $FOOLINGS_TCP; do
for split in $splits; do
pktws_curl_test_update $testf $domain ${FAKED_PATTERN:+--blob=faked_pat:@"$FAKED_PATTERN" }$pre $PAYLOAD --lua-desync=$splitf:${FAKED_PATTERN:+pattern=faked_pat:}pos=$split:$fooling && ok=1
# duplicate SYN with MD5
contains "$fooling" tcp_md5 && pktws_curl_test_update $testf $domain ${FAKED_PATTERN:+--blob=faked_pat:@"$FAKED_PATTERN" }$pre $PAYLOAD --lua-desync=$splitf:${FAKED_PATTERN:+pattern=faked_pat:}pos=$split:$fooling:repeats=$FAKE_REPEATS --payload=empty --out-range="<s1" --lua-desync=send:$TCP_MD5 && ok=1
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
for ttl in $attls; do
for split in $splits; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_curl_test_update $testf $domain ${FAKED_PATTERN:+--blob=faked_pat:@"$FAKED_PATTERN" }$pre $PAYLOAD --lua-desync=$splitf:${FAKED_PATTERN:+pattern=faked_pat:}pos=$split:ip${IPVV}_autottl=-$ttl,3-20:repeats=$FAKE_REPEATS $f && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ $ok = 0 -a "$SCANLEVEL" != force ] && eval need_$splitf=1
[ $ok = 1 ] && ok_any=1
[ "$SCANLEVEL" = veryquick -a "$ok_any" = 1 ] && break
done
[ "$ok_any" = 1 ]
}
pktws_check_http()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
[ "$NOTEST_FAKED_HTTP" = 1 ] && { echo "SKIPPED"; return; }
local splits='method+2 midsld method+2,midsld'
pktws_check_faked $1 "$2" http_req "$splits" "$FAKED_PATTERN_HTTP" "$3"
}
pktws_check_https_tls()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
local splits='2 1 sniext+1 sniext+4 host+1 midsld 1,midsld 1,sniext+1,host+1,midsld-2,midsld,midsld+2,endhost-1'
pktws_check_faked $1 "$2" tls_client_hello "$splits" "$FAKED_PATTERN_HTTPS" "$3"
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKED_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2" && [ "$SCANLEVEL" != force ] && return
# do not use 'need' values obtained with wssize
local need_fakedsplit_save=$need_fakedsplit need_fakeddisorder_save=$need_fakeddisorder
pktws_check_https_tls "$1" "$2" --lua-desync=wssize:wsize=1:scale=6
need_fakedsplit=$need_fakedsplit_save need_fakeddisorder=$need_fakeddisorder_save
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKED_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2"
}
+112
View File
@@ -0,0 +1,112 @@
. "$TESTDIR/def.inc"
pktws_hostfake_vary_()
{
local ok_any=0 testf=$1 domain="$2" fooling="$3" pre="$4" post="$5" disorder
shift; shift; shift
for disorder in '' 'disorder_after:'; do
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}$fooling:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}nofake1:$fooling:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}nofake2:$fooling:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}midhost=midsld:$fooling:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}nofake1:midhost=midsld:$fooling:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}nofake2:midhost=midsld:$fooling:repeats=$FAKE_REPEATS $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
done
[ "$ok_any" = 1 ] && ok=1
}
pktws_hostfake_vary()
{
local ok_any=0 fooling="$3"
pktws_hostfake_vary_ "$1" "$2" "$3" "$4" "$5" && ok_any=1
# duplicate SYN with MD5
contains "$fooling" tcp_md5 && \
pktws_hostfake_vary_ "$1" "$2" "$3" "$4" "${5:+$5 }--payload=empty --out-range=<s1 --lua-desync=send:$TCP_MD5" && ok_any=1
[ "$ok_any" = 1 ]
}
pktws_check_hostfake()
{
# $1 - test function
# $2 - domain
# $3 - payload_type
# $4 - PRE args for nfqws2
local testf=$1 domain="$2" pre="$4"
local ok ttls attls f fooling
local PAYLOAD="--payload=$3"
[ "$MAX_TTL" = 0 ] || ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
[ "$MAX_AUTOTTL_DELTA" = 0 ] || attls=$(seq -s ' ' $MIN_AUTOTTL_DELTA $MAX_AUTOTTL_DELTA)
need_hostfakesplit=0
ok=0
for ttl in $ttls; do
# orig-ttl=1 with start/cutoff limiter drops empty ACK packet in response to SYN,ACK. it does not reach DPI or server.
# missing ACK is transmitted in the first data packet of TLS/HTTP proto
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_hostfake_vary $testf $domain "ip${IPVV}_ttl=$ttl" "$pre" "$f" && [ "$SCANLEVEL" != force ] && break
done
[ "$ok" = 1 ] && break
done
for fooling in $FOOLINGS_TCP; do
pktws_hostfake_vary $testf $domain "$fooling" "$pre"
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
for ttl in $attls; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_hostfake_vary $testf $domain "ip${IPVV}_autottl=-$ttl,3-20" "$pre" "$f" && [ "$SCANLEVEL" != force ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ $ok = 0 -a "$SCANLEVEL" != force ] && need_hostfakesplit=1
[ $ok = 1 ]
}
pktws_check_http()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_HOSTFAKE_HTTP" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_hostfake $1 "$2" http_req
}
pktws_check_https_tls()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
pktws_check_hostfake $1 "$2" tls_client_hello "$3"
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_HOSTFAKE_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2" && [ "$SCANLEVEL" != force ] && return
# do not use 'need' values obtained with wssize
local need_hostfakesplit_save=$need_hostfakesplit
pktws_check_https_tls "$1" "$2" --lua-desync=wssize:wsize=1:scale=6
need_hostfakesplit=$need_hostfakesplit_save
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_HOSTFAKE_HTTPS" = 1 ] && { echo "SKIPPED"; return; }
pktws_check_https_tls "$1" "$2"
}
+174
View File
@@ -0,0 +1,174 @@
. "$TESTDIR/def.inc"
pktws_check_http()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_MULTI_HTTP" = 1 ] && { echo "SKIPPED"; return 0; }
local testf=$1 domain="$2"
local ok ttls attls f ff fake fooling splitf splitfs= split splits='method+2 midsld method+2,midsld'
local PAYLOAD="--payload=http_req"
if [ -n "$FAKE_HTTP" ]; then
fake=fake_http
else
fake=fake_default_http
fi
[ "$MAX_TTL" = 0 ] || ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
[ "$MAX_AUTOTTL_DELTA" = 0 ] || attls=$(seq -s ' ' $MIN_AUTOTTL_DELTA $MAX_AUTOTTL_DELTA)
# do not test fake + multisplit if multisplit works
[ "$need_multisplit" = 0 -a "$SCANLEVEL" != force ] || splitfs=multisplit
# do not test fake + multidisorder if multidisorder works
[ "$need_multidisorder" = 0 -a "$SCANLEVEL" != force ] || splitfs="${splitfs:+$splitfs }$MULTIDISORDER"
for splitf in $splitfs; do
ok=0
for ttl in $ttls; do
for split in $splits; do
# orig-ttl=1 with start/cutoff limiter drops empty ACK packet in response to SYN,ACK. it does not reach DPI or server.
# missing ACK is transmitted in the first data packet of TLS/HTTP proto
for ff in $fake 0x00000000; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }$PAYLOAD "--lua-desync=fake:blob=${ff}:ip${IPVV}_ttl=$ttl:repeats=$FAKE_REPEATS" --lua-desync=$splitf:pos=$split $f && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
done
done
[ "$ok" = 1 ] && break
done
for fooling in $FOOLINGS_TCP; do
for split in $splits; do
for ff in $fake 0x00000000; do
pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }$PAYLOAD --lua-desync=fake:blob=$ff:$fooling:repeats=$FAKE_REPEATS --lua-desync=$splitf:pos=$split && ok=1
# duplicate SYN with MD5
contains "$fooling" tcp_md5 && pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=fake_http:@"$FAKE_HTTP" }$PAYLOAD --lua-desync=fake:blob=$ff:$fooling:repeats=$FAKE_REPEATS --lua-desync=$splitf:pos=$split --payload=empty "--out-range=<s1" --lua-desync=send:$TCP_MD5 && ok=1
done
done
done
for ttl in $attls; do
for split in $splits; do
for ff in $fake 0x00000000; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }$PAYLOAD --lua-desync=fake:blob=$ff:ip${IPVV}_autottl=-$ttl,3-20:repeats=$FAKE_REPEATS --lua-desync=$splitf:pos=$split $f && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
done
done
done
done
}
pktws_fake_https_vary_()
{
local ok_any=0 testf=$1 domain="$2" fooling="$3" pre="$4" post="$5"
shift; shift; shift
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=$fake:$fooling:repeats=$FAKE_REPEATS --lua-desync=$splitf:pos=$split $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain $pre $PAYLOAD --lua-desync=fake:blob=0x00000000:$fooling:repeats=$FAKE_REPEATS --lua-desync=$splitf:pos=$split $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=0x00000000:$fooling:repeats=$FAKE_REPEATS --lua-desync=fake:blob=$fake:$fooling:tls_mod=rnd,dupsid:repeats=$FAKE_REPEATS --lua-desync=$splitf:pos=$split $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }$pre $PAYLOAD --lua-desync=multisplit:blob=$fake:$fooling:pos=2:nodrop:repeats=$FAKE_REPEATS --lua-desync=$splitf:pos=$split $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=$fake:$fooling:tls_mod=rnd,dupsid,padencap:repeats=$FAKE_REPEATS --lua-desync=$splitf:pos=$split $post && ok_any=1
[ "$ok_any" = 1 ] && ok=1
}
pktws_fake_https_vary()
{
local ok_any=0 fooling="$3"
pktws_fake_https_vary_ "$1" "$2" "$3" "$4" "$5" && ok_any=1
# duplicate SYN with MD5
contains "$fooling" tcp_md5 && \
pktws_fake_https_vary_ "$1" "$2" "$3" "$4" "${5:+$5 }--payload=empty --out-range=<s1 --lua-desync=send:$TCP_MD5" && ok_any=1
[ "$ok_any" = 1 ]
}
pktws_check_https_tls()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
local testf=$1 domain="$2" pre="$3"
local ok ok_any ttls attls f fake fooling splitf splitfs= split splits='2 1 sniext+1 sniext+4 host+1 midsld 1,midsld 1,midsld,1220 1,sniext+1,host+1,midsld-2,midsld,midsld+2,endhost-1'
local PAYLOAD="--payload=tls_client_hello"
shift; shift
if [ -n "$FAKE_HTTPS" ]; then
fake=fake_tls
else
fake=fake_default_tls
fi
[ "$MAX_TTL" = 0 ] || ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
[ "$MAX_AUTOTTL_DELTA" = 0 ] || attls=$(seq -s ' ' $MIN_AUTOTTL_DELTA $MAX_AUTOTTL_DELTA)
# do not test fake + multisplit if multisplit works
[ "$need_multisplit" = 0 -a "$SCANLEVEL" != force ] || splitfs=multisplit
# do not test fake + multidisorder if multidisorder works
[ "$need_multidisorder" = 0 -a "$SCANLEVEL" != force ] || splitfs="${splitfs:+$splitfs }$MULTIDISORDER"
ok_any=0
for splitf in $splitfs; do
ok=0
for ttl in $ttls; do
for split in $splits; do
# orig-ttl=1 with start/cutoff limiter drops empty ACK packet in response to SYN,ACK. it does not reach DPI or server.
# missing ACK is transmitted in the first data packet of TLS/HTTP proto
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_fake_https_vary $testf $domain "ip${IPVV}_ttl=$ttl" "$pre" "$f" && [ "$SCANLEVEL" != force ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$ok" = 1 ] && break
done
for fooling in $FOOLINGS_TCP; do
for split in $splits; do
pktws_fake_https_vary $testf $domain "$fooling" "$pre"
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
for ttl in $attls; do
for split in $splits; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_fake_https_vary $testf $domain "ip${IPVV}_autottl=-$ttl,3-20" "$pre" "$f" && [ "$SCANLEVEL" != force ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$ok" = 1 ] && ok_any=1
[ "$SCANLEVEL" = veryquick -a "$ok_any" = 1 ] && break
done
[ "$ok_any" = 1 ]
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_MULTI_HTTPS" = 1 ] && { echo "SKIPPED"; return 0; }
pktws_check_https_tls "$1" "$2" && [ "$SCANLEVEL" != force ] && return
pktws_check_https_tls "$1" "$2" --lua-desync=wssize:wsize=1:scale=6
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_MULTI_HTTPS" = 1 ] && { echo "SKIPPED"; return 0; }
pktws_check_https_tls "$1" "$2"
}
+181
View File
@@ -0,0 +1,181 @@
. "$TESTDIR/def.inc"
pktws_check_http()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_FAKED_HTTP" = 1 ] && { echo "SKIPPED"; return 0; }
local testf=$1 domain="$2"
local ok ttls attls f ff fake fooling splitf splitfs= split splits='method+2 midsld method+2,midsld'
local PAYLOAD="--payload=http_req"
if [ -n "$FAKE_HTTP" ]; then
fake=fake_http
else
fake=fake_default_http
fi
[ "$MAX_TTL" = 0 ] || ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
[ "$MAX_AUTOTTL_DELTA" = 0 ] || attls=$(seq -s ' ' $MIN_AUTOTTL_DELTA $MAX_AUTOTTL_DELTA)
# do not test fake + multisplit if multisplit works
[ "$need_fakedsplit" = 0 -a "$SCANLEVEL" != force ] || splitfs=fakedsplit
# do not test fake + fakeddisorder if fakeddisorder works
[ "$need_fakeddisorder" = 0 -a "$SCANLEVEL" != force ] || splitfs="${splitfs:+$splitfs }fakeddisorder"
for splitf in $splitfs; do
ok=0
for ttl in $ttls; do
for split in $splits; do
# orig-ttl=1 with start/cutoff limiter drops empty ACK packet in response to SYN,ACK. it does not reach DPI or server.
# missing ACK is transmitted in the first data packet of TLS/HTTP proto
for ff in $fake 0x00000000; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }${FAKED_PATTERN_HTTP:+--blob=faked_pat:@"$FAKED_PATTERN_HTTP" }$PAYLOAD "--lua-desync=fake:blob=${ff}:ip${IPVV}_ttl=$ttl:repeats=$FAKE_REPEATS" --lua-desync=$splitf:${FAKED_PATTERN_HTTP:+pattern=faked_pat:}pos=$split:ip${IPVV}_ttl=$ttl:repeats=$FAKE_REPEATS $f && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$ok" = 1 ] && break
done
for fooling in $FOOLINGS_TCP; do
for split in $splits; do
for ff in $fake 0x00000000; do
pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }${FAKED_PATTERN_HTTP:+--blob=faked_pat:@"$FAKED_PATTERN_HTTP" }$PAYLOAD --lua-desync=fake:blob=$ff:$fooling:repeats=$FAKE_REPEATS --lua-desync=$splitf:${FAKED_PATTERN_HTTP:+pattern=faked_pat:}pos=$split:$fooling:repeats=$FAKE_REPEATS && ok=1
# duplicate SYN with MD5
contains "$fooling" tcp_md5 && pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }${FAKED_PATTERN_HTTP:+--blob=faked_pat:@"$FAKED_PATTERN_HTTP" }$PAYLOAD --lua-desync=fake:blob=$ff:$fooling:repeats=$FAKE_REPEATS --lua-desync=$splitf:${FAKED_PATTERN_HTTP:+pattern=faked_pat:}pos=$split:$fooling:repeats=$FAKE_REPEATS --payload=empty "--out-range=<s1" --lua-desync=send:$TCP_MD5 && ok=1
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
for ttl in $attls; do
for split in $splits; do
for ff in $fake 0x00000000; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_curl_test_update $testf $domain ${FAKE_HTTP:+--blob=$fake:@"$FAKE_HTTP" }${FAKED_PATTERN_HTTP:+--blob=faked_pat:@"$FAKED_PATTERN_HTTP" }$PAYLOAD --lua-desync=fake:blob=$ff:ip${IPVV}_autottl=-$ttl,3-20:repeats=$FAKE_REPEATS --lua-desync=$splitf:${FAKED_PATTERN_HTTP:+pattern=faked_pat:}pos=$split:ip${IPVV}_autottl=-$ttl,3-20:repeats=$FAKE_REPEATS $f && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
}
pktws_fake_https_vary_()
{
local ok_any=0 testf=$1 domain="$2" fooling="$3" pre="$4" post="$5"
shift; shift; shift
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }${FAKED_PATTERN_HTTPS:+--blob=faked_pat:@"$FAKED_PATTERN_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=$fake:$fooling:repeats=$FAKE_REPEATS --lua-desync=$splitf:${FAKED_PATTERN_HTTPS:+pattern=faked_pat:}pos=$split:$fooling $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKED_PATTERN_HTTPS:+--blob=faked_pat:@"$FAKED_PATTERN_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=0x00000000:$fooling:repeats=$FAKE_REPEATS --lua-desync=$splitf:${FAKED_PATTERN_HTTPS:+pattern=faked_pat:}pos=$split:$fooling $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }${FAKED_PATTERN_HTTPS:+--blob=faked_pat:@"$FAKED_PATTERN_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=0x00000000:$fooling:repeats=$FAKE_REPEATS --lua-desync=fake:blob=$fake:$fooling:tls_mod=rnd,dupsid:repeats=$FAKE_REPEATS --lua-desync=$splitf:${FAKED_PATTERN_HTTPS:+pattern=faked_pat:}pos=$split:$fooling $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }${FAKED_PATTERN_HTTPS:+--blob=faked_pat:@"$FAKED_PATTERN_HTTPS" }$pre $PAYLOAD --lua-desync=multisplit:blob=$fake:$fooling:pos=2:nodrop:repeats=$FAKE_REPEATS --lua-desync=$splitf:${FAKED_PATTERN_HTTPS:+pattern=faked_pat:}pos=$split:$fooling $post && ok_any=1
[ "$ok_any" = 1 -a "$SCANLEVEL" = veryquick ] && { ok=1; return 0; }
pktws_curl_test_update $testf $domain ${FAKE_HTTPS:+--blob=$fake:@"$FAKE_HTTPS" }${FAKED_PATTERN_HTTPS:+--blob=faked_pat:@"$FAKED_PATTERN_HTTPS" }$pre $PAYLOAD --lua-desync=fake:blob=$fake:$fooling:tls_mod=rnd,dupsid,padencap:repeats=$FAKE_REPEATS --lua-desync=$splitf:${FAKED_PATTERN_HTTPS:+pattern=faked_pat:}pos=$split:$fooling $post && ok_any=1
[ "$ok_any" = 1 ] && ok=1
}
pktws_fake_https_vary()
{
local ok_any=0 fooling="$3"
pktws_fake_https_vary_ "$1" "$2" "$3" "$4" "$5" && ok_any=1
# duplicate SYN with MD5
contains "$fooling" tcp_md5 && \
pktws_fake_https_vary_ "$1" "$2" "$3" "$4" "${5:+$5 }--payload=empty --out-range=<s1 --lua-desync=send:$TCP_MD5" && ok_any=1
[ "$ok_any" = 1 ]
}
pktws_check_https_tls()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
local testf=$1 domain="$2" pre="$3"
local ok ok_any ttls attls f fake fooling splitf splitfs= split splits='2 1 sniext+1 sniext+4 host+1 midsld 1,midsld 1,sniext+1,host+1,midsld-2,midsld,midsld+2,endhost-1'
local PAYLOAD="--payload=tls_client_hello"
shift; shift
if [ -n "$FAKE_HTTPS" ]; then
fake=fake_tls
else
fake=fake_default_tls
fi
[ "$MAX_TTL" = 0 ] || ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
[ "$MAX_AUTOTTL_DELTA" = 0 ] || attls=$(seq -s ' ' $MIN_AUTOTTL_DELTA $MAX_AUTOTTL_DELTA)
# do not test fake + fakedsplit if fakedsplit works
[ "$need_fakedsplit" = 0 -a "$SCANLEVEL" != force ] || splitfs=fakedsplit
# do not test fake + fakeddisorder if fakeddisorder works
[ "$need_fakeddisorder" = 0 -a "$SCANLEVEL" != force ] || splitfs="${splitfs:+$splitfs }fakeddisorder"
ok_any=0
for splitf in $splitfs; do
ok=0
for ttl in $ttls; do
for split in $splits; do
# orig-ttl=1 with start/cutoff limiter drops empty ACK packet in response to SYN,ACK. it does not reach DPI or server.
# missing ACK is transmitted in the first data packet of TLS/HTTP proto
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_fake_https_vary $testf $domain "ip${IPVV}_ttl=$ttl" "$pre" "$f" && [ "$SCANLEVEL" != force ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$ok" = 1 ] && break
done
for fooling in $FOOLINGS_TCP; do
for split in $splits; do
pktws_fake_https_vary $testf $domain "$fooling" "$pre"
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
for ttl in $attls; do
for split in $splits; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_fake_https_vary $testf $domain "ip${IPVV}_autottl=-$ttl,3-20" "$pre" "$f" && [ "$SCANLEVEL" != force ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$ok" = 1 ] && ok_any=1
[ "$SCANLEVEL" = veryquick -a "$ok_any" = 1 ] && break
done
[ "$ok_any" = 1 ]
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_FAKED_HTTPS" = 1 ] && { echo "SKIPPED"; return 0; }
pktws_check_https_tls "$1" "$2" && [ "$SCANLEVEL" != force ] && return
pktws_check_https_tls "$1" "$2" --lua-desync=wssize:wsize=1:scale=6
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_FAKED_HTTPS" = 1 ] && { echo "SKIPPED"; return 0; }
pktws_check_https_tls "$1" "$2"
}
+125
View File
@@ -0,0 +1,125 @@
. "$TESTDIR/def.inc"
pktws_hostfake_vary_()
{
local testf=$1 domain="$2" fooling="$3" pre="$4" post="$5" disorder
shift; shift; shift
for disorder in '' 'disorder_after:'; do
pktws_curl_test_update $testf $domain $pre ${FAKE:+--blob=$fake:@"$FAKE" }$PAYLOAD --lua-desync=fake:blob=$fake:$fooling:repeats=$FAKE_REPEATS --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}$fooling:repeats=$FAKE_REPEATS $post && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" = veryquick ] && return 0
pktws_curl_test_update $testf $domain $pre ${FAKE:+--blob=$fake:@"$FAKE" }$PAYLOAD --lua-desync=fake:blob=$fake:$fooling:repeats=$FAKE_REPEATS --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}nofake1:$fooling:repeats=$FAKE_REPEATS $post && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" = veryquick ] && return 0
pktws_curl_test_update $testf $domain $pre ${FAKE:+--blob=$fake:@"$FAKE" }$PAYLOAD --lua-desync=fake:blob=$fake:$fooling:repeats=$FAKE_REPEATS --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}nofake2:$fooling:repeats=$FAKE_REPEATS $post && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" = veryquick ] && return 0
pktws_curl_test_update $testf $domain $pre ${FAKE:+--blob=$fake:@"$FAKE" }$PAYLOAD --lua-desync=fake:blob=$fake:$fooling:repeats=$FAKE_REPEATS --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}midhost=midsld:$fooling:repeats=$FAKE_REPEATS $post && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" = veryquick ] && return 0
pktws_curl_test_update $testf $domain $pre ${FAKE:+--blob=$fake:@"$FAKE" }$PAYLOAD --lua-desync=fake:blob=$fake:$fooling:repeats=$FAKE_REPEATS --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}nofake1:midhost=midsld:$fooling:repeats=$FAKE_REPEATS $post && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" = veryquick ] && return 0
pktws_curl_test_update $testf $domain $pre ${FAKE:+--blob=$fake:@"$FAKE" }$PAYLOAD --lua-desync=fake:blob=$fake:$fooling:repeats=$FAKE_REPEATS --lua-desync=hostfakesplit:${HOSTFAKE:+host=${HOSTFAKE}:}${disorder}nofake2:midhost=midsld:$fooling:repeats=$FAKE_REPEATS $post && ok=1
[ "$ok" = 1 -a "$SCANLEVEL" = veryquick ] && return 0
done
}
pktws_hostfake_vary()
{
local fooling="$3"
pktws_hostfake_vary_ "$1" "$2" "$3" "$4" "$5"
# duplicate SYN with MD5
contains "$fooling" tcp_md5 && \
pktws_hostfake_vary_ "$1" "$2" "$3" "$4" "${5:+$5 }--payload=empty --out-range=<s1 --lua-desync=send:$TCP_MD5"
}
pktws_check_hostfake()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
local testf=$1 domain="$2" pre="$3"
local ok ttls attls f fooling
[ "$need_hostfakesplit" = 0 ] && return 0
[ "$MAX_TTL" = 0 ] || ttls=$(seq -s ' ' $MIN_TTL $MAX_TTL)
[ "$MAX_AUTOTTL_DELTA" = 0 ] || attls=$(seq -s ' ' $MIN_AUTOTTL_DELTA $MAX_AUTOTTL_DELTA)
ok=0
for ttl in $ttls; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_hostfake_vary $testf $domain "ip${IPVV}_ttl=$ttl" "$pre" "$f" && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
[ "$ok" = 1 ] && break
done
for fooling in $FOOLINGS_TCP; do
pktws_hostfake_vary $testf $domain "$fooling" "$pre" && ok=1
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
for ttl in $attls; do
for f in '' "--payload=empty --out-range=s1<d1 --lua-desync=pktmod:ip${IPVV}_ttl=1"; do
pktws_hostfake_vary $testf $domain "ip${IPVV}_autottl=-$ttl,3-20" "$pre" "$f" && {
ok=1
[ "$SCANLEVEL" = force ] || break
}
done
[ "$SCANLEVEL" = veryquick -a "$ok" = 1 ] && break
done
[ "$ok" = 1 ]
}
pktws_check_http()
{
[ "$NOTEST_FAKE_HOSTFAKE_HTTP" = 1 ] && { echo "SKIPPED"; return 0; }
local PAYLOAD="--payload=http_req"
local FAKE="$FAKE_HTTP"
if [ -n "$FAKE_HTTP" ]; then
fake=fake_http
else
fake=fake_default_http
fi
pktws_check_hostfake "$1" "$2"
}
pktws_check_https_tls()
{
# $1 - test function
# $2 - domain
# $3 - PRE args for nfqws2
local PAYLOAD="--payload=tls_client_hello"
local FAKE="$FAKE_HTTPS"
if [ -n "$FAKE_HTTPS" ]; then
fake=fake_tls
else
fake=fake_default_tls
fi
pktws_check_hostfake "$1" "$2" "$3"
}
pktws_check_https_tls12()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_HOSTFAKE_HTTPS" = 1 ] && { echo "SKIPPED"; return 0; }
pktws_check_https_tls "$1" "$2" && [ "$SCANLEVEL" != force ] && return
pktws_check_https_tls "$1" "$2" --lua-desync=wssize:wsize=1:scale=6
}
pktws_check_https_tls13()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_FAKE_HOSTFAKE_HTTPS" = 1 ] && { echo "SKIPPED"; return 0; }
pktws_check_https_tls "$1" "$2"
}
+36
View File
@@ -0,0 +1,36 @@
. "$TESTDIR/def.inc"
pktws_check_http3()
{
# $1 - test function
# $2 - domain
[ "$NOTEST_QUIC" = 1 ] && { echo "SKIPPED"; return; }
local repeats fake pos fool
local PAYLOAD="--payload=quic_initial"
if [ -n "$FAKE_QUIC" ]; then
fake=fake_quic
else
fake=fake_default_quic
fi
for repeats in 1 2 5 10 20; do
pktws_curl_test_update $1 $2 ${FAKE_QUIC:+--blob=$fake:@"$FAKE_QUIC" }$PAYLOAD --lua-desync=fake:blob=$fake:repeats=$repeats && [ "$SCANLEVEL" != force ] && break
done
[ "$IPV" = 6 ] && {
for fool in ip6_hopbyhop ip6_destopt ip6_hopbyhop:ip6_destopt; do
pktws_curl_test_update $1 $2 $PAYLOAD --lua-desync=send:$fool --lua-desync=drop
done
}
for pos in 8 16 32 64; do
pktws_curl_test_update $1 $2 $PAYLOAD --lua-desync=send:ipfrag:ipfrag_pos_udp=$pos --lua-desync=drop && [ "$SCANLEVEL" != force ] && break
done
for pos in 8 16 32 64; do
pktws_curl_test_update $1 $2 ${FAKE_QUIC:+--blob=$fake:@"$FAKE_QUIC" }$PAYLOAD --lua-desync=fake:blob=$fake:repeats=$FAKE_REPEATS --lua-desync=send:ipfrag:ipfrag_pos_udp=$pos --lua-desync=drop && [ "$SCANLEVEL" != force ] && break
done
}
+21
View File
@@ -0,0 +1,21 @@
FOOLINGS46_TCP=${FOOLINGS46_TCP:-"tcp_md5 badsum tcp_seq=-3000 tcp_seq=1000000 tcp_ack=-66000:tcp_ts_up tcp_ts=-1000 tcp_flags_unset=ACK tcp_flags_set=SYN"}
FOOLINGS6_TCP=${FOOLINGS6_TCP:-"ip6_hopbyhop ip6_hopbyhop:ip6_hopbyhop2 ip6_destopt ip6_routing ip6_ah"}
FOOLINGS_TCP="$FOOLINGS46_TCP"
[ "$IPV" = 6 ] && FOOLINGS_TCP="$FOOLINGS_TCP $FOOLINGS6_TCP"
FOOLINGS6_UDP="${FOOLINGS6_UDP:-$FOOLINGS6_TCP}"
FOOLINGS_UDP="${FOOLINGS_UDP:-badsum}"
[ "$IPV" = 6 ] && FOOLINGS_UDP="$FOOLINGS_UDP $FOOLINGS6_UDP"
FAKE_REPEATS=${FAKE_REPEATS:-1}
MIN_TTL=${MIN_TTL:-1}
MAX_TTL=${MAX_TTL:-12}
MIN_AUTOTTL_DELTA=${MIN_AUTOTTL_DELTA:-1}
MAX_AUTOTTL_DELTA=${MAX_AUTOTTL_DELTA:-5}
# can use MULTIDISORER=multidisorder_legacy
MULTIDISORDER=${MULTIDISORDER:-multidisorder}
TCP_MD5=tcp_md5
# OpenBSD can occupy 24 bytes in tcp options in SYN packet leaving no space for the md5 header
[ "$UNAME" = OpenBSD ] && TCP_MD5=$TCP_MD5:tcp_nop_del
Executable
+2105
View File
File diff suppressed because it is too large. Load diff
+35 -20
View File
@@ -4,6 +4,10 @@ which()
# 'command -v' replacement does not work exactly the same way. it outputs shell aliases if present
# $1 - executable name
local IFS=:
[ "$1" != "${1#/}" ] && [ -x "$1" ] && {
echo "$1"
return 0
}
for p in $PATH; do
[ -x "$p/$1" ] && {
echo "$p/$1"
@@ -91,7 +95,7 @@ end_with_newline()
}
trim()
{
awk '{gsub(/^ +| +$/,"")}1'
awk '{gsub(/^[ \t]+|[ \t]+$/,"")}1'
}
split_by_separator()
{
@@ -105,13 +109,17 @@ split_by_separator()
[ -n "$3" ] && eval $3="\$before"
[ -n "$4" ] && eval $4="\$after"
}
tolower()
{
echo "$@" | tr 'A-Z' 'a-z'
}
dir_is_not_empty()
{
# $1 - directory
local n
[ -d "$1" ] || return 1
n=$(ls "$1" | wc -c | xargs)
n=$(ls -A "$1" | wc -c | xargs)
[ "$n" != 0 ]
}
@@ -164,15 +172,23 @@ unique()
is_linked_to_busybox()
{
local IFS F P
local IFS F P BB
BB="$(which busybox)"
IFS=:
for path in $PATH; do
F=$path/$1
P="$(readlink $F)"
if [ -z "$P" ] && [ -x $F ] && [ ! -L $F ]; then return 1; fi
[ "${P%busybox*}" != "$P" ] && return
F="$path/$1"
if [ -L "$F" ]; then
P="$(readlink $F)"
if [ -z "$P" ] && [ -x $F ] && [ ! -L $F ]; then return 1; fi
[ "${P%busybox*}" != "$P" ] && return
elif [ -f "$F" -a -n "$BB" ]; then
# possible hardlink
[ $(get_dir_inode "$F") = $(get_dir_inode "$BB") ] && return
fi
done
return 1
}
get_dir_inode()
{
@@ -327,7 +343,7 @@ setup_md5()
{
[ -n "$MD5" ] && return
MD5=md5sum
exists $MD5 || MD5=md5
exists $MD5 || MD5="md5 -q"
}
md5f()
@@ -350,7 +366,7 @@ random()
local r rs
setup_random
if [ -c /dev/urandom ]; then
read rs </dev/urandom
rs=$(dd if=/dev/urandom count=1 bs=16 2>/dev/null | hexdump -e '1 "%02x"')
else
rs="$RANDOM$RANDOM$(date)"
fi
@@ -378,9 +394,9 @@ shell_name()
process_exists()
{
if exists pgrep; then
pgrep ^$1$ >/dev/null
pgrep "^$1$" >/dev/null
elif exists pidof; then
pidof $1 >/dev/null
pidof "$1" >/dev/null
else
return 1
fi
@@ -410,14 +426,6 @@ alloc_num()
eval $1="$v"
}
std_ports()
{
NFQWS2_PORTS_TCP_IPT=$(replace_char - : $NFQWS_PORTS_TCP)
NFQWS2_PORTS_TCP_KEEPALIVE_IPT=$(replace_char - : $NFQWS_PORTS_TCP_KEEPALIVE)
NFQWS2_PORTS_UDP_IPT=$(replace_char - : $NFQWS_PORTS_UDP)
NFQWS2_PORTS_UDP_KEEPALIVE_IPT=$(replace_char - : $NFQWS_PORTS_UDP_KEEPALIVE)
}
has_bad_ws_options()
{
# $1 - nfqws2 opts
@@ -430,6 +438,13 @@ has_bad_ws_options()
echo "Kernel ipsets should be used instead. Write custom scripts and filter IPs in kernel."
echo
}
contains "$1" "--ipset=$ZAPRET_BASE" || contains "$1" "--ipset-exclude=$ZAPRET_BASE" ||
contains "$1" "--hostlist=$ZAPRET_BASE" || contains "$1" "--hostlist-exclude=$ZAPRET_BASE" && {
echo
echo "WARNING !!! you store ipset or hostlist files inside '$ZAPRET_BASE'"
echo "It's not recommended. install_easy.sh will delete them during update."
echo
}
return 1
}
+34
View File
@@ -0,0 +1,34 @@
custom_runner()
{
# $1 - function name
# $2+ - params
[ "$DISABLE_CUSTOM" = 1 ] && return 0
local n script FUNC=$1
shift
[ -d "$CUSTOM_DIR/custom.d" ] && {
dir_is_not_empty "$CUSTOM_DIR/custom.d" && {
for script in "$CUSTOM_DIR/custom.d/"*; do
[ -f "$script" ] || continue
unset -f $FUNC
. "$script"
existf $FUNC && $FUNC "$@"
done
}
}
}
alloc_qnum()
{
# $1 - target var name
alloc_num NUMPOOL_QNUM $1 65300 65399
}
alloc_dnum()
{
# alloc daemon number
# $1 - target var name
alloc_num NUMPOOL_DNUM $1 2000 2999
}
+57
View File
@@ -0,0 +1,57 @@
read_yes_no()
{
# $1 - default (Y/N)
local A
read A
[ -z "$A" ] || ([ "$A" != "Y" ] && [ "$A" != "y" ] && [ "$A" != "N" ] && [ "$A" != "n" ]) && A=$1
[ "$A" = "Y" ] || [ "$A" = "y" ] || [ "$A" = "1" ]
}
ask_yes_no()
{
# $1 - default (Y/N or 0/1)
# $2 - text
local DEFAULT=$1
[ "$1" = "1" ] && DEFAULT=Y
[ "$1" = "0" ] && DEFAULT=N
[ -z "$DEFAULT" ] && DEFAULT=N
printf "$2 (default : $DEFAULT) (Y/N) ? "
read_yes_no $DEFAULT
}
ask_yes_no_var()
{
# $1 - variable name for answer : 0/1
# $2 - text
local DEFAULT
eval DEFAULT="\$$1"
if ask_yes_no "$DEFAULT" "$2"; then
eval $1=1
else
eval $1=0
fi
}
ask_list()
{
# $1 - mode var
# $2 - space separated value list
# $3 - (optional) default value
local M_DEFAULT
eval M_DEFAULT="\$$1"
local M_DEFAULT_VAR="$M_DEFAULT"
local M="" m
[ -n "$3" ] && { find_str_in_list "$M_DEFAULT" "$2" || M_DEFAULT="$3" ;}
n=1
for m in $2; do
echo $n : $m
n=$(($n+1))
done
printf "your choice (default : $M_DEFAULT) : "
read m
[ -n "$m" ] && M=$(echo $2 | cut -d ' ' -f$m 2>/dev/null)
[ -z "$M" ] && M="$M_DEFAULT"
echo selected : $M
eval $1="\"$M\""
[ "$M" != "$M_DEFAULT_VAR" ]
}
+28
View File
@@ -0,0 +1,28 @@
require_root()
{
local exe preserve_env
echo \* checking privileges
[ $(id -u) -ne "0" ] && {
echo root is required
exe="$EXEDIR/$(basename "$0")"
exists sudo && {
echo elevating with sudo
exec sudo -E sh "$exe"
}
exists su && {
echo elevating with su
case "$UNAME" in
Linux)
preserve_env="--preserve-environment"
;;
FreeBSD|OpenBSD|Darwin)
preserve_env="-m"
;;
esac
exec su $preserve_env root -c "sh \"$exe\""
}
echo su or sudo not found
exitp 2
}
HAVE_ROOT=1
}
+64
View File
@@ -0,0 +1,64 @@
linux_ipt_avail()
{
exists iptables && exists ip6tables
}
linux_maybe_iptables_fwtype()
{
linux_ipt_avail && FWTYPE=iptables
}
linux_nft_avail()
{
exists nft
}
linux_fwtype()
{
[ -n "$FWTYPE" ] && return
FWTYPE=unsupported
linux_get_subsys
if [ "$SUBSYS" = openwrt ] ; then
# linux kernel is new enough if fw4 is there
if [ -x /sbin/fw4 ] && linux_nft_avail ; then
FWTYPE=nftables
else
linux_maybe_iptables_fwtype
fi
else
SUBSYS=
# generic linux
# flowtable is implemented since kernel 4.16
if linux_nft_avail && linux_min_version 4 16; then
FWTYPE=nftables
else
linux_maybe_iptables_fwtype
fi
fi
export FWTYPE
}
get_fwtype()
{
[ -n "$FWTYPE" ] && return
local UNAME="$(uname)"
case "$UNAME" in
Linux)
linux_fwtype
;;
FreeBSD)
if exists ipfw ; then
FWTYPE=ipfw
else
FWTYPE=unsupported
fi
;;
*)
FWTYPE=unsupported
;;
esac
export FWTYPE
}
+801
View File
@@ -0,0 +1,801 @@
GET_LIST_PREFIX=/ipset/get_
SYSTEMD_DIR=/lib/systemd
[ -d "$SYSTEMD_DIR" ] || SYSTEMD_DIR=/usr/lib/systemd
[ -d "$SYSTEMD_DIR" ] && SYSTEMD_SYSTEM_DIR="$SYSTEMD_DIR/system"
INIT_SCRIPT=/etc/init.d/zapret2
exitp()
{
echo
echo press enter to continue
read A
exit $1
}
extract_var_def()
{
# $1 - var name
# this sed script parses single or multi line shell var assignments with optional ' or " enclosure
sed -n \
"/^$1=\"/ {
:s1
/\".*\"/ {
p
b
}
N
t c1
b s1
:c1
}
/^$1='/ {
:s2
/'.*'/ {
p
b
}
N
t c2
b s2
:c2
}
/^$1=/p
"
}
replace_var_def()
{
# $1 - var name
# $2 - new val
# $3 - conf file
# this sed script replaces single or multi line shell var assignments with optional ' or " enclosure
local repl
if [ -z "$2" ]; then
repl="#$1="
elif contains "$2" " "; then
repl="$1=\"$2\""
else
repl="$1=$2"
fi
local script=\
"/^#*[[:space:]]*$1=\"/ {
:s1
/\".*\"/ {
c\\
$repl
b
}
N
t c1
b s1
:c1
}
/^#*[[:space:]]*$1='/ {
:s2
/'.*'/ {
c\\
$repl
b
}
N
t c2
b s2
:c2
}
/^#*[[:space:]]*$1=/c\\
$repl"
# there's incompatibility with -i option on BSD and busybox/GNU
if [ "$UNAME" = "Linux" ]; then
sed -i -e "$script" "$3"
else
sed -i '' -e "$script" "$3"
fi
}
parse_var_checked()
{
# $1 - file name
# $2 - var name
local tmp="/tmp/zvar-pid-$$.sh"
local v
cat "$1" | extract_var_def "$2" >"$tmp"
. "$tmp"
rm -f "$tmp"
eval v="\$$2"
# trim
v="$(echo "$v" | trim)"
eval $2=\""$v"\"
}
parse_vars_checked()
{
# $1 - file name
# $2,$3,... - var names
local f="$1"
shift
while [ -n "$1" ]; do
parse_var_checked "$f" $1
shift
done
}
edit_file()
{
# $1 - file name
local ed="$EDITOR"
[ -n "$ed" ] || {
for e in mcedit nano vim vi; do
exists "$e" && {
ed="$e"
break
}
done
}
[ -n "$ed" ] && "$ed" "$1"
}
echo_var()
{
local v delimeter delims=
eval v="\$$1"
if find_str_in_list $1 "$EDITVAR_NEWLINE_VARS"; then
echo "$1=\""
for delimeter in $EDITVAR_NEWLINE_DELIMETERS; do
delims="${delims:+$delims }-e "'"'"s/$delimeter/"'\\n'"$delimeter/g"'"'
done
echo "$v\"" | tr '\n' ' ' | tr -d '\r' | eval sed -e 's/^\ *//' -e 's/\ *$//' $delims
else
if contains "$v" " "; then
echo $1=\"$v\"
else
echo $1=$v
fi
fi
}
edit_vars()
{
# $1,$2,... - var names
local n=1 var tmp="/tmp/zvars-pid-$$.txt"
rm -f "$tmp"
while : ; do
eval var="\${$n}"
[ -n "$var" ] || break
echo_var $var >> "$tmp"
n=$(($n+1))
done
edit_file "$tmp" && parse_vars_checked "$tmp" "$@"
rm -f "$tmp"
}
list_vars()
{
while [ -n "$1" ] ; do
echo_var $1
shift
done
echo
}
openrc_test()
{
exists rc-update || return 1
# some systems do not usse openrc-init but launch openrc from inittab
[ "$INIT" = "openrc-init" ] || grep -qE "sysinit.*openrc" /etc/inittab 2>/dev/null
}
check_system()
{
# $1 - nonempty = do not fail on unknown rc system
echo \* checking system
SYSTEM=
SUBSYS=
SYSTEMCTL="$(whichq systemctl)"
get_fwtype
OPENWRT_FW3=
OPENWRT_FW4=
local info
UNAME=$(uname)
if [ "$UNAME" = "Linux" ]; then
# do not use 'exe' because it requires root
local INIT="$(sed 's/\x0/\n/g' /proc/1/cmdline | head -n 1)"
[ -L "$INIT" ] && INIT=$(readlink "$INIT")
INIT="$(basename "$INIT")"
# some distros include systemctl without systemd
if [ -d "$SYSTEMD_DIR" ] && [ -x "$SYSTEMCTL" ] && [ "$INIT" = "systemd" ]; then
SYSTEM=systemd
[ -f "$EXEDIR/init.d/sysv/functions" ] && . "$EXEDIR/init.d/sysv/functions"
elif [ -f "/etc/openwrt_release" ] && exists opkg || exists apk && exists uci && [ "$INIT" = "procd" ] ; then
SYSTEM=openwrt
OPENWRT_PACKAGER=opkg
OPENWRT_PACKAGER_INSTALL="opkg install"
OPENWRT_PACKAGER_UPDATE="opkg update"
# do not use apk if it does not have database
[ -d /lib/apk/db ] && exists apk && {
OPENWRT_PACKAGER=apk
OPENWRT_PACKAGER_INSTALL="apk add"
OPENWRT_PACKAGER_UPDATE=
}
info="package manager $OPENWRT_PACKAGER\n"
if openwrt_fw3 ; then
OPENWRT_FW3=1
info="${info}firewall fw3"
if is_ipt_flow_offload_avail; then
info="$info. hardware flow offloading requires iptables."
else
info="$info. flow offloading unavailable."
fi
elif openwrt_fw4; then
OPENWRT_FW4=1
info="${info}firewall fw4. flow offloading requires nftables."
fi
[ -f "$EXEDIR/init.d/openwrt/functions" ] && . "$EXEDIR/init.d/openwrt/functions"
elif openrc_test; then
SYSTEM=openrc
[ -f "$EXEDIR/init.d/sysv/functions" ] && . "$EXEDIR/init.d/sysv/functions"
else
echo system is not either systemd, openrc or openwrt based
echo easy installer can set up config settings but can\'t configure auto start
echo you have to do it manually. check readme.md for manual setup info.
if [ -n "$1" ] || ask_yes_no N "do you want to continue"; then
SYSTEM=linux
else
exitp 5
fi
[ -f "$EXEDIR/init.d/sysv/functions" ] && . "$EXEDIR/init.d/sysv/functions"
fi
linux_get_subsys
else
echo easy installer only supports Linux. check readme.md for supported systems and manual setup info.
exitp 5
fi
echo system is based on $SYSTEM
[ -n "$info" ] && printf "${info}\n"
}
get_free_space_mb()
{
df -m "$1" | awk '/[0-9]%/{print $(NF-2)}'
}
get_ram_kb()
{
grep MemTotal /proc/meminfo | awk '{print $2}'
}
get_ram_mb()
{
local R=$(get_ram_kb)
echo $(($R/1024))
}
crontab_del()
{
exists crontab || return
echo \* removing crontab entry
CRONTMP=/tmp/cron.tmp
crontab -l >$CRONTMP 2>/dev/null
if grep -q "$GET_LIST_PREFIX" $CRONTMP; then
echo removing following entries from crontab :
grep "$GET_LIST_PREFIX" $CRONTMP
grep -v "$GET_LIST_PREFIX" $CRONTMP >$CRONTMP.2
crontab $CRONTMP.2
rm -f $CRONTMP.2
fi
rm -f $CRONTMP
}
crontab_del_quiet()
{
exists crontab || return
CRONTMP=/tmp/cron.tmp
crontab -l >$CRONTMP 2>/dev/null
if grep -q "$GET_LIST_PREFIX" $CRONTMP; then
grep -v "$GET_LIST_PREFIX" $CRONTMP >$CRONTMP.2
crontab $CRONTMP.2
rm -f $CRONTMP.2
fi
rm -f $CRONTMP
}
crontab_add()
{
# $1 - hour min
# $2 - hour max
[ -x "$GET_LIST" ] && {
echo \* adding crontab entry
if exists crontab; then
CRONTMP=/tmp/cron.tmp
crontab -l >$CRONTMP 2>/dev/null
if grep -q "$GET_LIST_PREFIX" $CRONTMP; then
echo some entries already exist in crontab. check if this is corrent :
grep "$GET_LIST_PREFIX" $CRONTMP
else
end_with_newline <"$CRONTMP" || echo >>"$CRONTMP"
echo "$(random 0 59) $(random $1 $2) */2 * * $GET_LIST" >>$CRONTMP
crontab $CRONTMP
fi
rm -f $CRONTMP
else
echo '!!! CRON IS ABSENT !!! LISTS AUTO UPDATE WILL NOT WORK !!!'
fi
}
}
cron_ensure_running()
{
# if no crontabs present in /etc/cron openwrt init script does not launch crond. this is default
[ "$SYSTEM" = "openwrt" ] && {
/etc/init.d/cron enable
/etc/init.d/cron start
}
}
service_start_systemd()
{
echo \* starting zapret2 service
"$SYSTEMCTL" start zapret2 || {
echo could not start zapret2 service
exitp 30
}
}
service_stop_systemd()
{
echo \* stopping zapret2 service
"$SYSTEMCTL" daemon-reload
"$SYSTEMCTL" disable zapret2
"$SYSTEMCTL" stop zapret2
}
service_remove_systemd()
{
echo \* removing zapret2 service
rm -f "$SYSTEMD_SYSTEM_DIR/zapret2.service"
"$SYSTEMCTL" daemon-reload
}
timer_remove_systemd()
{
echo \* removing zapret2-list-update timer
"$SYSTEMCTL" daemon-reload
"$SYSTEMCTL" disable zapret2-list-update.timer
"$SYSTEMCTL" stop zapret2-list-update.timer
rm -f "$SYSTEMD_SYSTEM_DIR/zapret2-list-update.service" "$SYSTEMD_SYSTEM_DIR/zapret2-list-update.timer"
"$SYSTEMCTL" daemon-reload
}
install_sysv_init()
{
# $1 - "0"=disable
echo \* installing init script
[ -x "$INIT_SCRIPT" ] && {
"$INIT_SCRIPT" stop
"$INIT_SCRIPT" disable
}
ln -fs "$INIT_SCRIPT_SRC" "$INIT_SCRIPT"
[ "$1" != "0" ] && "$INIT_SCRIPT" enable
}
install_openrc_init()
{
# $1 - "0"=disable
echo \* installing init script
[ -x "$INIT_SCRIPT" ] && {
"$INIT_SCRIPT" stop
rc-update del zapret2
}
ln -fs "$INIT_SCRIPT_SRC" "$INIT_SCRIPT"
[ "$1" != "0" ] && rc-update add zapret2
}
service_remove_openrc()
{
echo \* removing zapret2 service
[ -x "$INIT_SCRIPT" ] && {
rc-update del zapret2
"$INIT_SCRIPT" stop
}
rm -f "$INIT_SCRIPT"
}
service_start_sysv()
{
[ -x "$INIT_SCRIPT" ] && {
echo \* starting zapret2 service
"$INIT_SCRIPT" start || {
echo could not start zapret2 service
exitp 30
}
}
}
service_stop_sysv()
{
[ -x "$INIT_SCRIPT" ] && {
echo \* stopping zapret2 service
"$INIT_SCRIPT" stop
}
}
service_remove_sysv()
{
echo \* removing zapret2 service
[ -x "$INIT_SCRIPT" ] && {
"$INIT_SCRIPT" disable
"$INIT_SCRIPT" stop
}
rm -f "$INIT_SCRIPT"
}
check_kmod()
{
[ -f "/lib/modules/$(uname -r)/$1.ko" ]
}
check_package_exists_openwrt()
{
[ -n "$($OPENWRT_PACKAGER list $1)" ]
}
check_package_openwrt()
{
case $OPENWRT_PACKAGER in
opkg)
[ -n "$(opkg list-installed $1)" ] && return 0
local what="$(opkg whatprovides $1 | tail -n +2 | head -n 1)"
[ -n "$what" ] || return 1
[ -n "$(opkg list-installed $what)" ]
;;
apk)
apk info -e $1
;;
esac
}
check_packages_openwrt()
{
for pkg in $@; do
check_package_openwrt $pkg || return
done
}
install_openwrt_iface_hook()
{
echo \* installing ifup hook
ln -fs "$OPENWRT_IFACE_HOOK" /etc/hotplug.d/iface
}
remove_openwrt_iface_hook()
{
echo \* removing ifup hook
rm -f /etc/hotplug.d/iface/??-zapret2
}
openwrt_fw_section_find()
{
# $1 - fw include postfix
# echoes section number
i=0
while true
do
path=$(uci -q get firewall.@include[$i].path)
[ -n "$path" ] || break
[ "$path" = "$OPENWRT_FW_INCLUDE$1" ] && {
echo $i
return 0
}
i=$(($i+1))
done
return 1
}
openwrt_fw_section_del()
{
# $1 - fw include postfix
local id="$(openwrt_fw_section_find $1)"
[ -n "$id" ] && {
uci delete firewall.@include[$id] && uci commit firewall
rm -f "$OPENWRT_FW_INCLUDE$1"
}
}
openwrt_fw_section_add()
{
openwrt_fw_section_find ||
{
uci add firewall include >/dev/null || return
echo -1
}
}
openwrt_fw_section_configure()
{
local id="$(openwrt_fw_section_add $1)"
[ -z "$id" ] ||
! uci set firewall.@include[$id].path="$OPENWRT_FW_INCLUDE" ||
! uci set firewall.@include[$id].reload="1" ||
! uci commit firewall &&
{
echo could not add firewall include
exitp 50
}
}
install_openwrt_firewall()
{
echo \* installing firewall script $1
echo "linking : $FW_SCRIPT_SRC => $OPENWRT_FW_INCLUDE"
ln -fs "$FW_SCRIPT_SRC" "$OPENWRT_FW_INCLUDE"
openwrt_fw_section_configure $1
}
restart_openwrt_firewall()
{
echo \* restarting firewall
local FW=fw4
[ -n "$OPENWRT_FW3" ] && FW=fw3
exists $FW && $FW -q restart || {
echo could not restart firewall $FW
}
}
remove_openwrt_firewall()
{
echo \* removing firewall script
openwrt_fw_section_del
}
clear_ipset()
{
echo "* clearing ipset(s)"
# free some RAM
"$IPSET_DIR/create_ipset.sh" clear
}
write_config_var()
{
# $1 - mode var
local M
eval M="\$$1"
# replace / => \/
#M=${M//\//\\\/}
M=$(echo $M | sed 's/\//\\\//g' | trim)
grep -q "^[[:space:]]*$1=\|^#*[[:space:]]*$1=" "$ZAPRET_CONFIG" || {
# var does not exist in config. add it
echo $1= >>"$ZAPRET_CONFIG"
}
replace_var_def $1 "$M" "$ZAPRET_CONFIG"
}
no_prereq_exit()
{
echo could not install prerequisites
exitp 6
}
check_prerequisites_linux()
{
echo \* checking prerequisites
local s cmd PKGS UTILS req="curl curl"
local APTGET DNF YUM PACMAN ZYPPER EOPKG APK
case "$FWTYPE" in
iptables)
req="$req iptables iptables ip6tables iptables ipset ipset"
;;
nftables)
req="$req nft nftables"
;;
esac
PKGS=$(for s in $req; do echo $s; done |
while read cmd; do
read pkg
exists $cmd || echo $pkg
done | sort -u | xargs)
UTILS=$(for s in $req; do echo $s; done |
while read cmd; do
read pkg
echo $cmd
done | sort -u | xargs)
if [ -z "$PKGS" ] ; then
echo required utilities exist : $UTILS
else
echo \* installing prerequisites
echo packages required : $PKGS
APTGET=$(whichq apt-get)
DNF=$(whichq dnf)
YUM=$(whichq yum)
PACMAN=$(whichq pacman)
ZYPPER=$(whichq zypper)
EOPKG=$(whichq eopkg)
APK=$(whichq apk)
if [ -x "$APTGET" ] ; then
"$APTGET" update
"$APTGET" install -y --no-install-recommends $PKGS dnsutils || no_prereq_exit
elif [ -x "$DNF" ] ; then
"$DNF" -y install $PKGS || no_prereq_exit
elif [ -x "$YUM" ] ; then
"$YUM" -y install $PKGS || no_prereq_exit
elif [ -x "$PACMAN" ] ; then
"$PACMAN" -Syy
"$PACMAN" --noconfirm -S $PKGS || no_prereq_exit
elif [ -x "$ZYPPER" ] ; then
"$ZYPPER" --non-interactive install $PKGS || no_prereq_exit
elif [ -x "$EOPKG" ] ; then
"$EOPKG" -y install $PKGS || no_prereq_exit
elif [ -x "$APK" ] ; then
"$APK" update
# for alpine
[ "$FWTYPE" = iptables ] && [ -n "$($APK list ip6tables)" ] && PKGS="$PKGS ip6tables"
"$APK" add $PKGS || no_prereq_exit
else
echo supported package manager not found
echo you must manually install : $UTILS
exitp 5
fi
fi
}
removable_pkgs_openwrt()
{
local pkg PKGS2
[ -n "$OPENWRT_FW4" ] && PKGS2="$PKGS2 iptables-zz-legacy iptables ip6tables-zz-legacy ip6tables"
[ -n "$OPENWRT_FW3" ] && PKGS2="$PKGS2 nftables-json nftables-nojson nftables"
PKGS=
for pkg in $PKGS2; do
check_package_exists_openwrt $pkg && PKGS="${PKGS:+$PKGS }$pkg"
done
PKGS="ipset iptables-mod-extra iptables-mod-nfqueue iptables-mod-filter iptables-mod-ipopt iptables-mod-conntrack-extra iptables-mod-u32 ip6tables-mod-nat ip6tables-extra kmod-nft-queue gzip coreutils-sort coreutils-sleep curl $PKGS"
}
openwrt_fix_broken_apk_uninstall_scripts()
{
# at least in early snapshots with apk removing gnu gzip, sort, ... does not restore links to busybox
# system may become unusable
exists sort || { echo fixing missing sort; ln -fs /bin/busybox /usr/bin/sort; }
exists gzip || { echo fixing missing gzip; ln -fs /bin/busybox /bin/gzip; }
exists sleep || { echo fixing missing sleep; ln -fs /bin/busybox /bin/sleep; }
}
remove_extra_pkgs_openwrt()
{
local PKGS
echo \* remove dependencies
removable_pkgs_openwrt
echo these packages may have been installed by install_easy.sh : $PKGS
ask_yes_no N "do you want to remove them" && {
case $OPENWRT_PACKAGER in
opkg)
opkg remove --autoremove $PKGS
;;
apk)
apk del $PKGS
openwrt_fix_broken_apk_uninstall_scripts
;;
esac
}
}
check_prerequisites_openwrt()
{
echo \* checking prerequisites
local PKGS="curl" UPD=0 local pkg_iptables
case "$FWTYPE" in
iptables)
pkg_iptables=iptables
check_package_exists_openwrt iptables-zz-legacy && pkg_iptables=iptables-zz-legacy
PKGS="$PKGS ipset $pkg_iptables iptables-mod-extra iptables-mod-nfqueue iptables-mod-filter iptables-mod-ipopt iptables-mod-conntrack-extra iptables-mod-u32"
check_package_exists_openwrt ip6tables-zz-legacy && pkg_iptables=ip6tables-zz-legacy
[ "$DISABLE_IPV6" = 1 ] || PKGS="$PKGS $pkg_iptables ip6tables-mod-nat ip6tables-extra"
;;
nftables)
PKGS="$PKGS nftables kmod-nft-nat kmod-nft-offload kmod-nft-queue"
;;
esac
if check_packages_openwrt $PKGS ; then
echo everything is present
else
echo \* installing prerequisites
$OPENWRT_PACKAGER_UPDATE
UPD=1
$OPENWRT_PACKAGER_INSTALL $PKGS || {
echo could not install prerequisites
exitp 6
}
fi
is_linked_to_busybox gzip && {
echo
echo your system uses default busybox gzip. its several times slower than GNU gzip.
echo ip/host list scripts will run much faster with GNU gzip
echo installer can install GNU gzip but it requires about 100 Kb space
if ask_yes_no N "do you want to install GNU gzip"; then
[ "$UPD" = "0" ] && {
$OPENWRT_PACKAGER_UPDATE
UPD=1
}
$OPENWRT_PACKAGER_INSTALL --force-overwrite gzip
fi
}
is_linked_to_busybox sort && {
echo
echo your system uses default busybox sort. its much slower and consumes much more RAM than GNU sort
echo ip/host list scripts will run much faster with GNU sort
echo installer can install GNU sort but it requires about 100 Kb space
if ask_yes_no N "do you want to install GNU sort"; then
[ "$UPD" = "0" ] && {
$OPENWRT_PACKAGER_UPDATE
UPD=1
}
$OPENWRT_PACKAGER_INSTALL --force-overwrite coreutils-sort
fi
}
[ "$FSLEEP" = 0 ] && is_linked_to_busybox sleep && {
echo
echo no methods of sub-second sleep were found.
echo if you want to speed up blockcheck install coreutils-sleep. it requires about 40 Kb space
if ask_yes_no N "do you want to install COREUTILS sleep"; then
[ "$UPD" = "0" ] && {
$OPENWRT_PACKAGER_UPDATE
UPD=1
}
$OPENWRT_PACKAGER_INSTALL --force-overwrite coreutils-sleep
fsleep_setup
fi
}
}
select_ipv6()
{
local T=N
[ "$DISABLE_IPV6" != '1' ] && T=Y
local old6=$DISABLE_IPV6
echo
if ask_yes_no $T "enable ipv6 support"; then
DISABLE_IPV6=0
else
DISABLE_IPV6=1
fi
[ "$old6" != "$DISABLE_IPV6" ] && write_config_var DISABLE_IPV6
}
select_fwtype()
{
echo
[ $(get_ram_mb) -le 400 ] && {
echo WARNING ! you are running a low RAM system
echo WARNING ! nft requires lots of RAM to load huge ip sets, much more than ipsets require
echo WARNING ! if you need large lists it may be necessary to fall back to iptables+ipset firewall
}
echo select firewall type :
ask_list FWTYPE "iptables nftables" "$FWTYPE"
# always write config var to prevent auto discovery every time
write_config_var FWTYPE
}
dry_run_nfqws_()
{
local NFQWS="$ZAPRET_BASE/nfq2/nfqws2"
echo verifying nfqws options
"$NFQWS" --dry-run ${WS_USER:+--user=$WS_USER} "$@"
}
dry_run_nfqws()
{
[ "$NFQWS2_ENABLE" = 1 ] || return 0
local opt="$NFQWS2_OPT" qn=${QNUM:-300}
filter_apply_hostlist_target opt
dry_run_nfqws_ --qnum=$qn $opt
echo NOTE ! LUA code validity cannot be verified at this stage !
}
+348
View File
@@ -0,0 +1,348 @@
ipt_connbytes="-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes"
IPSET_EXCLUDE="-m set ! --match-set nozapret"
IPSET_EXCLUDE6="-m set ! --match-set nozapret6"
IPSET_PORTS_NAME=zport
ipt()
{
iptables $FW_EXTRA_PRE -C "$@" $FW_EXTRA_POST >/dev/null 2>/dev/null || iptables $FW_EXTRA_PRE -I "$@" $FW_EXTRA_POST
}
ipta()
{
iptables $FW_EXTRA_PRE -C "$@" $FW_EXTRA_POST >/dev/null 2>/dev/null || iptables $FW_EXTRA_PRE -A "$@" $FW_EXTRA_POST
}
ipt_del()
{
iptables $FW_EXTRA_PRE -C "$@" $FW_EXTRA_POST >/dev/null 2>/dev/null && iptables $FW_EXTRA_PRE -D "$@" $FW_EXTRA_POST
}
ipt_add_del()
{
on_off_function ipt ipt_del "$@"
}
ipta_add_del()
{
on_off_function ipta ipt_del "$@"
}
ipt6()
{
ip6tables -C "$@" >/dev/null 2>/dev/null || ip6tables -I "$@"
}
ipt6a()
{
ip6tables -C "$@" >/dev/null 2>/dev/null || ip6tables -A "$@"
}
ipt6_del()
{
ip6tables -C "$@" >/dev/null 2>/dev/null && ip6tables -D "$@"
}
ipt6_add_del()
{
on_off_function ipt6 ipt6_del "$@"
}
ipt6a_add_del()
{
on_off_function ipt6a ipt6_del "$@"
}
is_ipt_flow_offload_avail()
{
# $1 = '' for ipv4, '6' for ipv6
grep -q FLOWOFFLOAD 2>/dev/null /proc/net/ip$1_tables_targets
}
filter_apply_ipset_target4()
{
# $1 - var name of ipv4 iptables filter
if [ "$MODE_FILTER" = "ipset" ]; then
eval $1="\"\$$1 -m set --match-set zapret dst\""
fi
}
filter_apply_ipset_target6()
{
# $1 - var name of ipv6 iptables filter
if [ "$MODE_FILTER" = "ipset" ]; then
eval $1="\"\$$1 -m set --match-set zapret6 dst\""
fi
}
filter_apply_ipset_target()
{
# $1 - var name of ipv4 iptables filter
# $2 - var name of ipv6 iptables filter
filter_apply_ipset_target4 $1
filter_apply_ipset_target6 $2
}
reverse_nfqws_rule_stream()
{
sed -e 's/-o /-i /g' -e 's/--dport /--sport /g' -e 's/--dports /--sports /g' -e 's/ dst$/ src/' -e 's/ dst / src /g' -e 's/--connbytes-dir=original/--connbytes-dir=reply/g' -e "s/-m mark ! --mark $DESYNC_MARK\/$DESYNC_MARK//g"
}
reverse_nfqws_rule()
{
echo "$@" | reverse_nfqws_rule_stream
}
ipt_mark_filter()
{
[ -n "$FILTER_MARK" ] && echo "-m mark --mark $FILTER_MARK/$FILTER_MARK"
}
ipt_print_op()
{
if [ "$1" = "1" ]; then
echo "Inserting ip$4tables rule for $3 : $2"
else
echo "Deleting ip$4tables rule for $3 : $2"
fi
}
_fw_nfqws_post4()
{
# $1 - 1 - add, 0 - del
# $2 - iptable filter for ipv4
# $3 - queue number
# $4 - wan interface names space separated
[ "$DISABLE_IPV4" = "1" -o -z "$2" ] || {
local i
ipt_print_op $1 "$2" "nfqws postrouting (qnum $3)"
rule="$(ipt_mark_filter) -m mark ! --mark $DESYNC_MARK/$DESYNC_MARK $2 $IPSET_EXCLUDE dst -j NFQUEUE --queue-num $3 --queue-bypass"
if [ -n "$4" ] ; then
for i in $4; do
ipt_add_del $1 POSTROUTING -t mangle -o $i $rule
done
else
ipt_add_del $1 POSTROUTING -t mangle $rule
fi
}
}
_fw_nfqws_post6()
{
# $1 - 1 - add, 0 - del
# $2 - iptable filter for ipv6
# $3 - queue number
# $4 - wan interface names space separated
[ "$DISABLE_IPV6" = "1" -o -z "$2" ] || {
local i
ipt_print_op $1 "$2" "nfqws postrouting (qnum $3)" 6
rule="$(ipt_mark_filter) -m mark ! --mark $DESYNC_MARK/$DESYNC_MARK $2 $IPSET_EXCLUDE6 dst -j NFQUEUE --queue-num $3 --queue-bypass"
if [ -n "$4" ] ; then
for i in $4; do
ipt6_add_del $1 POSTROUTING -t mangle -o $i $rule
done
else
ipt6_add_del $1 POSTROUTING -t mangle $rule
fi
}
}
fw_nfqws_post()
{
# $1 - 1 - add, 0 - del
# $2 - iptable filter for ipv4
# $3 - iptable filter for ipv6
# $4 - queue number
fw_nfqws_post4 $1 "$2" $4
fw_nfqws_post6 $1 "$3" $4
}
_fw_nfqws_pre4()
{
# $1 - 1 - add, 0 - del
# $2 - iptable filter for ipv4
# $3 - queue number
# $4 - wan interface names space separated
[ "$DISABLE_IPV4" = "1" -o -z "$2" ] || {
local i
ipt_print_op $1 "$2" "nfqws input+forward (qnum $3)"
rule="$2 $IPSET_EXCLUDE src -j NFQUEUE --queue-num $3 --queue-bypass"
if [ -n "$4" ] ; then
for i in $4; do
# iptables PREROUTING chain is before NAT. not possible to have DNATed ip's there
ipt_add_del $1 INPUT -t mangle -i $i $rule
ipt_add_del $1 FORWARD -t mangle -i $i $rule
done
else
ipt_add_del $1 INPUT -t mangle $rule
ipt_add_del $1 FORWARD -t mangle $rule
fi
}
}
_fw_nfqws_pre6()
{
# $1 - 1 - add, 0 - del
# $2 - iptable filter for ipv6
# $3 - queue number
# $4 - wan interface names space separated
[ "$DISABLE_IPV6" = "1" -o -z "$2" ] || {
local i
ipt_print_op $1 "$2" "nfqws input+forward (qnum $3)" 6
rule="$2 $IPSET_EXCLUDE6 src -j NFQUEUE --queue-num $3 --queue-bypass"
if [ -n "$4" ] ; then
for i in $4; do
# iptables PREROUTING chain is before NAT. not possible to have DNATed ip's there
ipt6_add_del $1 INPUT -t mangle -i $i $rule
ipt6_add_del $1 FORWARD -t mangle -i $i $rule
done
else
ipt6_add_del $1 INPUT -t mangle $rule
ipt6_add_del $1 FORWARD -t mangle $rule
fi
}
}
fw_nfqws_pre()
{
# $1 - 1 - add, 0 - del
# $2 - iptable filter for ipv4
# $3 - iptable filter for ipv6
# $4 - queue number
fw_nfqws_pre4 $1 "$2" $4
fw_nfqws_pre6 $1 "$3" $4
}
fw_reverse_nfqws_rule4()
{
fw_nfqws_pre4 $1 "$(reverse_nfqws_rule "$2")" $3
}
fw_reverse_nfqws_rule6()
{
fw_nfqws_pre6 $1 "$(reverse_nfqws_rule "$2")" $3
}
fw_reverse_nfqws_rule()
{
# ensure that modes relying on incoming traffic work
# $1 - 1 - add, 0 - del
# $2 - rule4
# $3 - rule6
# $4 - queue number
fw_reverse_nfqws_rule4 $1 "$2" $4
fw_reverse_nfqws_rule6 $1 "$3" $4
}
ipt_port_ipset()
{
# $1 - ipset name
# $2 - ports
ipset -q flush $1 || {
ipset create $1 bitmap:port range 0-65535 || return
}
echo "$2" | tr ',' '\n' | sed -nEe "s/^.+$/add $1 &/p" | ipset -! restore
}
ipt_first_packets()
{
# $1 - packet count
[ -n "$1" -a "$1" != keepalive ] && [ "$1" -ge 1 ] && echo "$ipt_connbytes 1:$1"
}
ipt_do_nfqws_in_out()
{
# $1 - 1 - add, 0 - del
# $2 - tcp,udp
# $3 - ports
# $4 - PKT. special value : 'keepalive'
# $5 - 1 - out, 0 - in
# $6 - ipset base name
local f f4 f6 first_packets_only ipset
[ -n "$3" ] || return
ipset="${6}_$2"
[ "$4" = keepalive ] && ipset="${ipset}_k"
[ "$1" = 1 ] && ipt_port_ipset $ipset "$3"
[ -n "$4" -a "$4" != 0 ] &&
{
first_packets_only="$(ipt_first_packets $4)"
f4="-p $2 -m set --match-set $ipset"
if [ "$5" = 1 ]; then
f4="$f4 dst"
f=fw_nfqws_post
else
f4="$f4 src"
f=fw_reverse_nfqws_rule
fi
f4="$f4 $first_packets_only"
f6=$f4
filter_apply_ipset_target f4 f6
$f $1 "$f4" "$f6" $QNUM
}
[ "$1" = 1 ] || ipset -q destroy $ipset
}
zapret_do_firewall_standard_nfqws_rules_ipt()
{
# $1 - 1 - add, 0 - del
[ "$NFQWS2_ENABLE" = 1 ] && {
ipt_do_nfqws_in_out $1 tcp "$NFQWS2_PORTS_TCP" "$NFQWS2_TCP_PKT_OUT" 1 $IPSET_PORTS_NAME
ipt_do_nfqws_in_out $1 tcp "$NFQWS2_PORTS_TCP" "$NFQWS2_TCP_PKT_IN" 0 $IPSET_PORTS_NAME
ipt_do_nfqws_in_out $1 tcp "$NFQWS2_PORTS_TCP_KEEPALIVE" keepalive 1 $IPSET_PORTS_NAME
ipt_do_nfqws_in_out $1 udp "$NFQWS2_PORTS_UDP" "$NFQWS2_UDP_PKT_OUT" 1 $IPSET_PORTS_NAME
ipt_do_nfqws_in_out $1 udp "$NFQWS2_PORTS_UDP" "$NFQWS2_UDP_PKT_IN" 0 $IPSET_PORTS_NAME
ipt_do_nfqws_in_out $1 udp "$NFQWS2_PORTS_UDP_KEEPALIVE" keepalive 1 $IPSET_PORTS_NAME
}
}
zapret_do_firewall_standard_rules_ipt()
{
# $1 - 1 - add, 0 - del
zapret_do_firewall_standard_nfqws_rules_ipt $1
}
zapret_do_firewall_rules_ipt()
{
# $1 - 1 - add, 0 - del
zapret_do_firewall_standard_rules_ipt $1
custom_runner zapret_custom_firewall $1
zapret_do_icmp_filter $1
}
zapret_do_icmp_filter()
{
# $1 - 1 - add, 0 - del
local FW_EXTRA_PRE= FW_EXTRA_POST=
[ "$FILTER_TTL_EXPIRED_ICMP" = 1 ] && {
[ "$DISABLE_IPV4" = 1 ] || {
ipt_add_del $1 POSTROUTING -t mangle -m mark --mark $DESYNC_MARK/$DESYNC_MARK -j CONNMARK --or-mark $DESYNC_MARK
ipt_add_del $1 INPUT -p icmp -m icmp --icmp-type time-exceeded -m connmark --mark $DESYNC_MARK/$DESYNC_MARK -j DROP
ipt_add_del $1 FORWARD -p icmp -m icmp --icmp-type time-exceeded -m connmark --mark $DESYNC_MARK/$DESYNC_MARK -j DROP
}
[ "$DISABLE_IPV6" = 1 ] || {
ipt6_add_del $1 POSTROUTING -t mangle -m mark --mark $DESYNC_MARK/$DESYNC_MARK -j CONNMARK --or-mark $DESYNC_MARK
ipt6_add_del $1 INPUT -p icmpv6 -m icmp6 --icmpv6-type time-exceeded -m connmark --mark $DESYNC_MARK/$DESYNC_MARK -j DROP
ipt6_add_del $1 FORWARD -p icmpv6 -m icmp6 --icmpv6-type time-exceeded -m connmark --mark $DESYNC_MARK/$DESYNC_MARK -j DROP
}
}
}
zapret_do_firewall_ipt()
{
# $1 - 1 - add, 0 - del
if [ "$1" = 1 ]; then
echo Applying iptables
else
echo Clearing iptables
fi
# always create ipsets. ip_exclude ipset is required
[ "$1" = 1 ] && create_ipset no-update
zapret_do_firewall_rules_ipt "$@"
if [ "$1" = 1 ] ; then
existf flow_offloading_exempt && flow_offloading_exempt
else
existf flow_offloading_unexempt && flow_offloading_unexempt
fi
return 0
}
+33
View File
@@ -0,0 +1,33 @@
standard_mode_nfqws()
{
# $1 - 1 - run, 0 - stop
local opt
[ "$NFQWS2_ENABLE" = 1 ] && check_bad_ws_options $1 "$NFQWS2_OPT" && {
opt="--qnum=$QNUM $NFQWS2_OPT"
filter_apply_hostlist_target opt
do_nfqws $1 1 "$opt"
}
}
standard_mode_daemons()
{
# $1 - 1 - run, 0 - stop
standard_mode_nfqws $1
}
zapret_do_daemons()
{
# $1 - 1 - run, 0 - stop
standard_mode_daemons $1
custom_runner zapret_custom_daemons $1
return 0
}
zapret_run_daemons()
{
zapret_do_daemons 1 "$@"
}
zapret_stop_daemons()
{
zapret_do_daemons 0 "$@"
}
+40
View File
@@ -0,0 +1,40 @@
set_conntrack_liberal_mode()
{
[ -n "$SKIP_CONNTRACK_LIBERAL_MODE" ] || sysctl -w net.netfilter.nf_conntrack_tcp_be_liberal=$1
}
zapret_do_firewall()
{
linux_fwtype
[ "$1" = 1 -a -n "$INIT_FW_PRE_UP_HOOK" ] && $INIT_FW_PRE_UP_HOOK
[ "$1" = 0 -a -n "$INIT_FW_PRE_DOWN_HOOK" ] && $INIT_FW_PRE_DOWN_HOOK
case "$FWTYPE" in
iptables)
zapret_do_firewall_ipt "$@"
;;
nftables)
zapret_do_firewall_nft "$@"
;;
esac
# russian DPI sends RST,ACK with wrong ACK.
# this is sometimes treated by conntrack as invalid and connbytes fw rules do not pass RST packet to nfqws.
# switch on liberal mode on zapret firewall start and switch off on zapret firewall stop
# this is only required for processing incoming bad RSTs. incoming rules are only applied in autohostlist mode
# calling this after firewall because conntrack module can be not loaded before applying conntrack firewall rules
[ "$MODE_FILTER" = "autohostlist" ] && set_conntrack_liberal_mode $1
[ "$1" = 1 -a -n "$INIT_FW_POST_UP_HOOK" ] && $INIT_FW_POST_UP_HOOK
[ "$1" = 0 -a -n "$INIT_FW_POST_DOWN_HOOK" ] && $INIT_FW_POST_DOWN_HOOK
return 0
}
zapret_apply_firewall()
{
zapret_do_firewall 1 "$@"
}
zapret_unapply_firewall()
{
zapret_do_firewall 0 "$@"
}
+24
View File
@@ -0,0 +1,24 @@
get_uevent_devtype()
{
local DEVTYPE INTERFACE IFINDEX OF_NAME OF_FULLNAME OF_COMPATIBLE_N
[ -f "/sys/class/net/$1/uevent" ] && {
. "/sys/class/net/$1/uevent"
echo -n $DEVTYPE
}
}
resolve_lower_devices()
{
# $1 - bridge interface name
[ -d "/sys/class/net/$1" ] && {
find "/sys/class/net/$1" -follow -maxdepth 1 -name "lower_*" |
{
local l lower lowers
while read lower; do
lower="$(basename "$lower")"
l="${lower#lower_*}"
[ "$l" != "$lower" ] && append_separator_list lowers ' ' '' "$l"
done
printf "$lowers"
}
}
}
+60
View File
@@ -0,0 +1,60 @@
HOSTLIST_MARKER="<HOSTLIST>"
HOSTLIST_NOAUTO_MARKER="<HOSTLIST_NOAUTO>"
find_hostlists()
{
[ -n "$HOSTLIST_BASE" ] || HOSTLIST_BASE="$ZAPRET_BASE/ipset"
HOSTLIST="$HOSTLIST_BASE/zapret-hosts.txt.gz"
[ -f "$HOSTLIST" ] || HOSTLIST="$HOSTLIST_BASE/zapret-hosts.txt"
[ -f "$HOSTLIST" ] || HOSTLIST=
HOSTLIST_USER="$HOSTLIST_BASE/zapret-hosts-user.txt.gz"
[ -f "$HOSTLIST_USER" ] || HOSTLIST_USER="$HOSTLIST_BASE/zapret-hosts-user.txt"
[ -f "$HOSTLIST_USER" ] || HOSTLIST_USER=
HOSTLIST_EXCLUDE="$HOSTLIST_BASE/zapret-hosts-user-exclude.txt.gz"
[ -f "$HOSTLIST_EXCLUDE" ] || HOSTLIST_EXCLUDE="$HOSTLIST_BASE/zapret-hosts-user-exclude.txt"
[ -f "$HOSTLIST_EXCLUDE" ] || HOSTLIST_EXCLUDE=
HOSTLIST_AUTO="$HOSTLIST_BASE/zapret-hosts-auto.txt"
HOSTLIST_AUTO_DEBUGLOG="$HOSTLIST_BASE/zapret-hosts-auto-debug.log"
}
filter_apply_hostlist_target()
{
# $1 - var name of nfqws params
local v parm parm1 parm2 parm3 parm4 parm5 parm6 parm7 parm8 parm9 parm10 parm11 parm12 parm13 parmNA
eval v="\$$1"
if contains "$v" "$HOSTLIST_MARKER" || contains "$v" "$HOSTLIST_NOAUTO_MARKER"; then
[ "$MODE_FILTER" = hostlist -o "$MODE_FILTER" = autohostlist ] &&
{
find_hostlists
parm1="${HOSTLIST_USER:+--hostlist=$HOSTLIST_USER}"
parm2="${HOSTLIST:+--hostlist=$HOSTLIST}"
parm3="${HOSTLIST_EXCLUDE:+--hostlist-exclude=$HOSTLIST_EXCLUDE}"
[ "$MODE_FILTER" = autohostlist ] &&
{
parm4="--hostlist-auto=$HOSTLIST_AUTO"
parm5="${AUTOHOSTLIST_FAIL_THRESHOLD:+--hostlist-auto-fail-threshold=$AUTOHOSTLIST_FAIL_THRESHOLD}"
parm6="${AUTOHOSTLIST_FAIL_TIME:+--hostlist-auto-fail-time=$AUTOHOSTLIST_FAIL_TIME}"
parm7="${AUTOHOSTLIST_RETRANS_THRESHOLD:+--hostlist-auto-retrans-threshold=$AUTOHOSTLIST_RETRANS_THRESHOLD}"
parm8="${AUTOHOSTLIST_RETRANS_RESET:+--hostlist-auto-retrans-reset=$AUTOHOSTLIST_RETRANS_RESET}"
parm9="${AUTOHOSTLIST_RETRANS_MAXSEQ:+--hostlist-auto-retrans-maxseq=$AUTOHOSTLIST_RETRANS_MAXSEQ}"
parm10="${AUTOHOSTLIST_INCOMING_MAXSEQ:+--hostlist-auto-incoming-maxseq=$AUTOHOSTLIST_INCOMING_MAXSEQ}"
parm11="${AUTOHOSTLIST_UDP_IN:+--hostlist-auto-udp-in=$AUTOHOSTLIST_UDP_IN}"
parm12="${AUTOHOSTLIST_UDP_OUT:+--hostlist-auto-udp-out=$AUTOHOSTLIST_UDP_OUT}"
parm13="--hostlist=$HOSTLIST_AUTO"
}
parm="$parm1${parm2:+ $parm2}${parm3:+ $parm3}${parm4:+ $parm4}${parm5:+ $parm5}${parm6:+ $parm6}${parm7:+ $parm7}${parm8:+ $parm8}${parm9:+ $parm9}${parm10:+ $parm10}${parm11:+ $parm11}${parm12:+ $parm12}"
parmNA="$parm1${parm2:+ $parm2}${parm3:+ $parm3}${parm13:+ $parm13}"
}
v="$(replace_str $HOSTLIST_NOAUTO_MARKER "$parmNA" "$v")"
v="$(replace_str $HOSTLIST_MARKER "$parm" "$v")"
[ "$MODE_FILTER" = autohostlist -a "$AUTOHOSTLIST_DEBUGLOG" = 1 ] && {
v="$v --hostlist-auto-debug=$HOSTLIST_AUTO_DEBUGLOG"
}
eval $1=\""$v"\"
fi
}
+726
View File
@@ -0,0 +1,726 @@
[ -n "$ZAPRET_NFT_TABLE" ] || ZAPRET_NFT_TABLE=zapret2
nft_connbytes="ct original packets"
# required for : nft -f -
create_dev_stdin
nft_create_table()
{
nft add table inet $ZAPRET_NFT_TABLE
}
nft_del_table()
{
nft delete table inet $ZAPRET_NFT_TABLE 2>/dev/null
}
nft_list_table()
{
nft -t list table inet $ZAPRET_NFT_TABLE
}
nft_add_chain()
{
# $1 - chain
# $2 - params
nft add chain inet $ZAPRET_NFT_TABLE $1 "{ $2 }"
}
nft_del_chain()
{
# $1 - chain
nft delete chain inet $ZAPRET_NFT_TABLE $1
}
nft_create_set()
{
# $1 - set name
# $2 - params
nft create set inet $ZAPRET_NFT_TABLE $1 "{ $2 }" 2>/dev/null
}
nft_del_set()
{
# $1 - set name
nft delete set inet $ZAPRET_NFT_TABLE $1
}
nft_flush_set()
{
# $1 - set name
nft flush set inet $ZAPRET_NFT_TABLE $1
}
nft_flush_chain()
{
# $1 - set name
nft flush chain inet $ZAPRET_NFT_TABLE $1
}
nft_set_exists()
{
# $1 - set name
nft -t list set inet $ZAPRET_NFT_TABLE $1 2>/dev/null >/dev/null
}
nft_flush_chain()
{
# $1 - chain name
nft flush chain inet $ZAPRET_NFT_TABLE $1
}
nft_chain_empty()
{
# $1 - chain name
local count=$(nft list chain inet $ZAPRET_NFT_TABLE $1 | wc -l)
[ "$count" -le 4 ]
}
nft_rule_exists()
{
# $1 - chain
# $2 - rule
local rule
# convert rule to nft output form
nft_flush_chain ruletest
nft_add_rule ruletest "$2"
rule=$(nft list chain inet $ZAPRET_NFT_TABLE ruletest | sed -n '3s/\t//gp')
nft_flush_chain ruletest
nft list chain inet $ZAPRET_NFT_TABLE $1 | trim | grep -qxF "$rule"
}
nft_del_all_chains_from_table()
{
# $1 - table_name with or without family
# delete all chains with possible references to each other
# cannot just delete all in the list because of references
# avoid infinite loops
local chains deleted=1 error=1
while [ -n "$deleted" -a -n "$error" ]; do
chains=$(nft -t list table $1 2>/dev/null | sed -nre "s/^[ ]*chain ([^ ]+) \{/\1/p" | xargs)
[ -n "$chains" ] || break
deleted=
error=
for chain in $chains; do
if nft delete chain $1 $chain 2>/dev/null; then
deleted=1
else
error=1
fi
done
done
}
# ipset checks cost some CPU. do not populate jump from hook until something is added to the chain
nft_activate_chain4()
{
# $1 - chain name
# $2 - saddr/daddr
local b rule markf= act flt_ifname
[ "$DISABLE_IPV4" = "1" ] || {
eval act="\$${1}_act4"
[ -n "$act" ] && return
b=0
nft_wanif_filter_present && b=1
flt_ifname="oifname"
starts_with "$1" pre && flt_ifname="iifname"
[ "$2" = daddr ] && markf=$(nft_mark_filter)
rule="meta mark and $DESYNC_MARK == 0 $markf"
[ $b = 1 ] && rule="$rule $flt_ifname @wanif"
rule="$rule ip $2 != @nozapret jump $1"
nft_rule_exists ${1}_hook "$rule" || nft_add_rule ${1}_hook $rule
eval ${1}_act4=1
}
}
nft_activate_chain6()
{
# $1 - chain name
# $2 - saddr/daddr
local b rule markf= act flt_ifname
[ "$DISABLE_IPV6" = "1" ] || {
eval act="\$${1}_act6"
[ -n "$act" ] && return
b=0
nft_wanif6_filter_present && b=1
flt_ifname="oifname"
starts_with "$1" pre && flt_ifname="iifname"
[ "$2" = daddr ] && markf=$(nft_mark_filter)
rule="meta mark and $DESYNC_MARK == 0 $markf"
[ $b = 1 ] && rule="$rule $flt_ifname @wanif6"
rule="$rule ip6 $2 != @nozapret6 jump $1"
nft_rule_exists ${1}_hook "$rule" || nft_add_rule ${1}_hook $rule
eval ${1}_act6=1
}
}
nft_create_chains()
{
cat << EOF | nft -f -
add chain inet $ZAPRET_NFT_TABLE forward_hook { type filter hook forward priority -1; }
flush chain inet $ZAPRET_NFT_TABLE forward_hook
add chain inet $ZAPRET_NFT_TABLE flow_offload
flush chain inet $ZAPRET_NFT_TABLE flow_offload
add chain inet $ZAPRET_NFT_TABLE flow_offload_zapret
flush chain inet $ZAPRET_NFT_TABLE flow_offload_zapret
add chain inet $ZAPRET_NFT_TABLE flow_offload_always
flush chain inet $ZAPRET_NFT_TABLE flow_offload_always
add chain inet $ZAPRET_NFT_TABLE postrouting
flush chain inet $ZAPRET_NFT_TABLE postrouting
add chain inet $ZAPRET_NFT_TABLE postrouting_hook { type filter hook postrouting priority 99; }
flush chain inet $ZAPRET_NFT_TABLE postrouting_hook
add chain inet $ZAPRET_NFT_TABLE postnat
flush chain inet $ZAPRET_NFT_TABLE postnat
add chain inet $ZAPRET_NFT_TABLE postnat_hook { type filter hook postrouting priority 101; }
flush chain inet $ZAPRET_NFT_TABLE postnat_hook
add chain inet $ZAPRET_NFT_TABLE prerouting
flush chain inet $ZAPRET_NFT_TABLE prerouting
add chain inet $ZAPRET_NFT_TABLE prerouting_hook { type filter hook prerouting priority -99; }
flush chain inet $ZAPRET_NFT_TABLE prerouting_hook
add chain inet $ZAPRET_NFT_TABLE prenat_hook { type filter hook prerouting priority -101; }
flush chain inet $ZAPRET_NFT_TABLE prenat_hook
add chain inet $ZAPRET_NFT_TABLE prenat
flush chain inet $ZAPRET_NFT_TABLE prenat
add chain inet $ZAPRET_NFT_TABLE predefrag { type filter hook output priority -401; }
flush chain inet $ZAPRET_NFT_TABLE predefrag
add chain inet $ZAPRET_NFT_TABLE predefrag_nfqws
flush chain inet $ZAPRET_NFT_TABLE predefrag_nfqws
add rule inet $ZAPRET_NFT_TABLE predefrag mark and $DESYNC_MARK !=0 jump predefrag_nfqws comment "nfqws generated : avoid drop by INVALID conntrack state"
add rule inet $ZAPRET_NFT_TABLE predefrag_nfqws mark and $DESYNC_MARK_POSTNAT !=0 notrack comment "postnat traffic"
add rule inet $ZAPRET_NFT_TABLE predefrag_nfqws ip frag-off & 0x1fff != 0 notrack comment "ipfrag"
add rule inet $ZAPRET_NFT_TABLE predefrag_nfqws exthdr frag exists notrack comment "ipfrag"
add rule inet $ZAPRET_NFT_TABLE predefrag_nfqws tcp flags ! syn,rst,ack notrack comment "datanoack"
add set inet $ZAPRET_NFT_TABLE wanif { type ifname; }
add set inet $ZAPRET_NFT_TABLE wanif6 { type ifname; }
add set inet $ZAPRET_NFT_TABLE lanif { type ifname; }
add chain inet $ZAPRET_NFT_TABLE ruletest
flush chain inet $ZAPRET_NFT_TABLE ruletest
EOF
[ -n "$POSTNAT_ALL" ] && {
nft_flush_chain predefrag_nfqws
nft_add_rule predefrag_nfqws notrack comment \"do not track nfqws generated packets to avoid nat tampering and defragmentation\"
}
[ "$FILTER_TTL_EXPIRED_ICMP" = 1 ] && {
if is_postnat; then
# can be caused by untracked nfqws-generated packets
nft_add_rule prerouting_hook icmp type time-exceeded ct state invalid drop
else
nft_add_rule postrouting_hook mark and $DESYNC_MARK != 0 ct mark set ct mark or $DESYNC_MARK comment \"nfqws related : prevent ttl expired socket errors\"
fi
[ "$DISABLE_IPV4" = "1" ] || {
nft_add_rule prerouting_hook icmp type time-exceeded ct mark and $DESYNC_MARK != 0 drop comment \"nfqws related : prevent ttl expired socket errors\"
}
[ "$DISABLE_IPV6" = "1" ] || {
nft_add_rule prerouting_hook icmpv6 type time-exceeded ct mark and $DESYNC_MARK != 0 drop comment \"nfqws related : prevent ttl expired socket errors\"
}
}
}
nft_del_chains()
{
# do not delete all chains because of additional user hooks
# they must be inside zapret table to use nfsets
cat << EOF | nft -f - 2>/dev/null
delete chain inet $ZAPRET_NFT_TABLE postrouting_hook
delete chain inet $ZAPRET_NFT_TABLE postnat_hook
delete chain inet $ZAPRET_NFT_TABLE prerouting_hook
delete chain inet $ZAPRET_NFT_TABLE prenat_hook
delete chain inet $ZAPRET_NFT_TABLE forward_hook
delete chain inet $ZAPRET_NFT_TABLE postrouting
delete chain inet $ZAPRET_NFT_TABLE postnat
delete chain inet $ZAPRET_NFT_TABLE prerouting
delete chain inet $ZAPRET_NFT_TABLE prenat
delete chain inet $ZAPRET_NFT_TABLE predefrag
delete chain inet $ZAPRET_NFT_TABLE predefrag_nfqws
delete chain inet $ZAPRET_NFT_TABLE flow_offload
delete chain inet $ZAPRET_NFT_TABLE flow_offload_zapret
delete chain inet $ZAPRET_NFT_TABLE flow_offload_always
delete chain inet $ZAPRET_NFT_TABLE ruletest
EOF
}
nft_del_flowtable()
{
nft delete flowtable inet $ZAPRET_NFT_TABLE ft 2>/dev/null
}
nft_create_or_update_flowtable()
{
# $1 = flags ('offload' for hw offload)
# $2,$3,$4,... - interfaces
# can be called multiple times to add interfaces. interfaces can only be added , not removed
local flags=$1 devices makelist
shift
# warning ! nft versions at least up to 1.0.1 do not allow interface names starting with digit in flowtable and do not allow quoting
# warning ! openwrt fixes this in post-21.x snapshots with special nft patch
# warning ! in traditional linux distros nft is unpatched and will fail with quoted interface definitions if unfixed
[ -n "$flags" ] && flags="flags $flags;"
for makelist in make_quoted_comma_list make_comma_list; do
$makelist devices "$@"
[ -n "$devices" ] && devices="devices={$devices};"
nft add flowtable inet $ZAPRET_NFT_TABLE ft "{ hook ingress priority -1; $flags $devices }" && break
done
}
nft_flush_ifsets()
{
cat << EOF | nft -f - 2>/dev/null
for set in wanif wanif6 lanif; do
flush set inet $ZAPRET_NFT_TABLE $set
done
EOF
}
nft_list_ifsets()
{
for set in wanif wanif6 lanif; do
nft list set inet $ZAPRET_NFT_TABLE $set
done
nft list flowtable inet $ZAPRET_NFT_TABLE ft 2>/dev/null
}
nft_create_firewall()
{
nft_create_table
nft_del_flowtable
nft_create_chains
}
nft_del_firewall()
{
nft_del_chains
nft_del_flowtable
# leave ifsets and ipsets because they may be used by custom rules
}
nft_add_rule()
{
# $1 - chain
# $2,$3,... - rule(s)
local chain="$1"
shift
nft add rule inet $ZAPRET_NFT_TABLE $chain $FW_EXTRA_PRE "$@"
}
nft_insert_rule()
{
# $1 - chain
# $2,$3,... - rule(s)
local chain="$1"
shift
nft insert rule inet $ZAPRET_NFT_TABLE $chain $FW_EXTRA_PRE "$@"
}
nft_add_set_element()
{
# $1 - set or map name
# $2 - element
[ -z "$2" ] || nft add element inet $ZAPRET_NFT_TABLE $1 "{ $2 }"
}
nft_add_set_elements()
{
# $1 - set or map name
# $2,$3,... - element(s)
local set="$1" elements
shift
make_comma_list elements "$@"
nft_add_set_element $set "$elements"
}
nft_reverse_nfqws_rule()
{
echo "$@" | sed -e 's/oifname /iifname /g' -e 's/dport /sport /g' -e 's/daddr /saddr /g' -e 's/ct original /ct reply /g' -e "s/mark and $DESYNC_MARK == 0//g"
}
nft_add_nfqws_flow_exempt_rule()
{
# $1 - rule (must be all filters in one var)
local FW_EXTRA_POST= FW_EXTRA_PRE=
[ "$FLOWOFFLOAD" = 'software' -o "$FLOWOFFLOAD" = 'hardware' ] && \
nft_insert_rule flow_offload_zapret "$1" return comment \"direct flow offloading exemption\"
}
nft_apply_flow_offloading()
{
# ft can be absent
nft_add_rule flow_offload_always flow add @ft 2>/dev/null && {
nft_add_rule flow_offload_always counter comment \"if offload works here must not be too much traffic\"
[ "$DISABLE_IPV4" = "1" ] || {
# allow only outgoing packets to initiate flow offload
nft_add_rule forward_hook meta l4proto "{ tcp, udp }" oifname @wanif jump flow_offload
nft_add_rule flow_offload ip daddr == @nozapret goto flow_offload_always
}
[ "$DISABLE_IPV6" = "1" ] || {
nft_add_rule forward_hook meta l4proto "{ tcp, udp }" oifname @wanif6 jump flow_offload
nft_add_rule flow_offload ip6 daddr == @nozapret6 goto flow_offload_always
}
nft_add_rule flow_offload jump flow_offload_zapret
nft_add_rule flow_offload_zapret goto flow_offload_always
}
}
nft_filter_apply_ipset_target4()
{
# $1 - var name of ipv4 nftables filter
if [ "$MODE_FILTER" = "ipset" ]; then
eval $1="\"\$$1 ip daddr @zapret\""
fi
}
nft_filter_apply_ipset_target6()
{
# $1 - var name of ipv6 nftables filter
if [ "$MODE_FILTER" = "ipset" ]; then
eval $1="\"\$$1 ip6 daddr @zapret6\""
fi
}
nft_filter_apply_ipset_target()
{
# $1 - var name of ipv4 nftables filter
# $2 - var name of ipv6 nftables filter
nft_filter_apply_ipset_target4 $1
nft_filter_apply_ipset_target6 $2
}
nft_mark_filter()
{
[ -n "$FILTER_MARK" ] && echo "mark and $FILTER_MARK != 0"
}
nft_script_add_ifset_element()
{
# $1 - set name
# $2 - space separated elements
local elements
[ -n "$2" ] && {
make_quoted_comma_list elements $2
script="${script}
add element inet $ZAPRET_NFT_TABLE $1 { $elements }"
}
}
nft_fill_ifsets()
{
# $1 - space separated lan interface names
# $2 - space separated wan interface names
# $3 - space separated wan6 interface names
# 4,5,6 is needed for pppoe+openwrt case. looks like it's not easily possible to resolve ethernet device behind a pppoe interface
# $4 - space separated lan physical interface names (optional)
# $5 - space separated wan physical interface names (optional)
# $6 - space separated wan6 physical interface names (optional)
local script i j ALLDEVS devs b
# if large sets exist nft works very ineffectively
# looks like it analyzes the whole table blob to find required data pieces
# calling all in one shot helps not to waste cpu time many times
script="flush set inet $ZAPRET_NFT_TABLE wanif
flush set inet $ZAPRET_NFT_TABLE wanif6
flush set inet $ZAPRET_NFT_TABLE lanif"
nft_script_add_ifset_element lanif "$1"
[ "$DISABLE_IPV4" = "1" ] || nft_script_add_ifset_element wanif "$2"
[ "$DISABLE_IPV6" = "1" ] || nft_script_add_ifset_element wanif6 "$3"
echo "$script" | nft -f -
case "$FLOWOFFLOAD" in
software)
ALLDEVS=$(unique $1 $2 $3)
# unbound flowtable may cause error in older nft version
nft_create_or_update_flowtable '' $ALLDEVS 2>/dev/null
;;
hardware)
ALLDEVS=$(unique $1 $2 $3 $4 $5 $6)
# first create unbound flowtable. may cause error in older nft version
nft_create_or_update_flowtable 'offload' 2>/dev/null
# then add elements. some of them can cause error because unsupported
for i in $ALLDEVS; do
# bridge members must be added instead of the bridge itself
# some members may not support hw offload. example : lan1 lan2 lan3 support, wlan0 wlan1 - not
b=
devs=$(resolve_lower_devices $i)
for j in $devs; do
# do not display error if addition failed
nft_create_or_update_flowtable 'offload' $j && b=1 2>/dev/null
done
[ -n "$b" ] || {
# no lower devices added ? try to add interface itself
nft_create_or_update_flowtable 'offload' $i 2>/dev/null
}
done
;;
esac
}
nft_only()
{
linux_fwtype
case "$FWTYPE" in
nftables)
"$@"
;;
esac
}
nft_print_op()
{
echo "Inserting nftables ipv$3 rule for $2 : $1"
}
is_postnat()
{
[ "$POSTNAT" != 0 -o "$POSTNAT_ALL" = 1 ]
}
get_postchain()
{
if is_postnat ; then
echo -n postnat
else
echo -n postrouting
fi
}
get_prechain()
{
if is_postnat ; then
echo -n prenat
else
echo -n prerouting
fi
}
_nft_fw_nfqws_post4()
{
# $1 - filter ipv4
# $2 - queue number
# $3 - not-empty if wan interface filtering required
[ "$DISABLE_IPV4" = "1" -o -z "$1" ] || {
local filter="$1" port="$2" rule chain=$(get_postchain) setmark
nft_print_op "$filter" "nfqws postrouting (qnum $port)" 4
rule="meta nfproto ipv4 $filter"
is_postnat && setmark="meta mark set meta mark or $DESYNC_MARK_POSTNAT"
nft_insert_rule $chain $rule $setmark $CONNMARKER $FW_EXTRA_POST queue num $port bypass
nft_add_nfqws_flow_exempt_rule "$rule"
nft_activate_chain4 $chain daddr
}
}
_nft_fw_nfqws_post6()
{
# $1 - filter ipv6
# $2 - queue number
# $3 - not-empty if wan interface filtering required
[ "$DISABLE_IPV6" = "1" -o -z "$1" ] || {
local filter="$1" port="$2" rule chain=$(get_postchain) setmark
nft_print_op "$filter" "nfqws postrouting (qnum $port)" 6
rule="meta nfproto ipv6 $filter"
is_postnat && setmark="meta mark set meta mark or $DESYNC_MARK_POSTNAT"
nft_insert_rule $chain $rule $setmark $CONNMARKER $FW_EXTRA_POST queue num $port bypass
nft_add_nfqws_flow_exempt_rule "$rule"
nft_activate_chain6 $chain daddr
}
}
nft_fw_nfqws_post()
{
# $1 - filter ipv4
# $2 - filter ipv6
# $3 - queue number
nft_fw_nfqws_post4 "$1" $3
nft_fw_nfqws_post6 "$2" $3
}
_nft_fw_nfqws_pre4()
{
# $1 - filter ipv4
# $2 - queue number
# $3 - not-empty if wan interface filtering required
[ "$DISABLE_IPV4" = "1" -o -z "$1" ] || {
local filter="$1" port="$2" rule chain=$(get_prechain)
nft_print_op "$filter" "nfqws prerouting (qnum $port)" 4
rule="meta nfproto ipv4 $filter"
nft_insert_rule $chain $rule $CONNMARKER $FW_EXTRA_POST queue num $port bypass
nft_activate_chain4 $chain saddr
}
}
_nft_fw_nfqws_pre6()
{
# $1 - filter ipv6
# $2 - queue number
# $3 - not-empty if wan interface filtering required
[ "$DISABLE_IPV6" = "1" -o -z "$1" ] || {
local filter="$1" port="$2" rule chain=$(get_prechain)
nft_print_op "$filter" "nfqws prerouting (qnum $port)" 6
rule="meta nfproto ipv6 $filter"
nft_insert_rule $chain $rule $CONNMARKER $FW_EXTRA_POST queue num $port bypass
nft_activate_chain6 $chain saddr
}
}
nft_fw_nfqws_pre()
{
# $1 - filter ipv4
# $2 - filter ipv6
# $3 - queue number
nft_fw_nfqws_pre4 "$1" $3
nft_fw_nfqws_pre6 "$2" $3
}
nft_fw_nfqws_both4()
{
# $1 - filter ipv4
# $2 - queue number
nft_fw_nfqws_post4 "$@"
nft_fw_nfqws_pre4 "$(nft_reverse_nfqws_rule $1)" $2
}
nft_fw_nfqws_both6()
{
# $1 - filter ipv6
# $2 - queue number
nft_fw_nfqws_post6 "$@"
nft_fw_nfqws_pre6 "$(nft_reverse_nfqws_rule $1)" $2
}
nft_fw_nfqws_both()
{
# $1 - filter ipv4
# $2 - filter ipv6
# $3 - queue number
nft_fw_nfqws_both4 "$1" "$3"
nft_fw_nfqws_both6 "$2" "$3"
}
zapret_reload_ifsets()
{
nft_only nft_create_table ; nft_fill_ifsets_overload
return 0
}
zapret_list_ifsets()
{
nft_only nft_list_ifsets
return 0
}
zapret_list_table()
{
nft_only nft_list_table
return 0
}
nft_fw_reverse_nfqws_rule4()
{
nft_fw_nfqws_pre4 "$(nft_reverse_nfqws_rule "$1")" $2
}
nft_fw_reverse_nfqws_rule6()
{
nft_fw_nfqws_pre6 "$(nft_reverse_nfqws_rule "$1")" $2
}
nft_fw_reverse_nfqws_rule()
{
# ensure that modes relying on incoming traffic work
# $1 - rule4
# $2 - rule6
# $3 - queue number
nft_fw_reverse_nfqws_rule4 "$1" $3
nft_fw_reverse_nfqws_rule6 "$2" $3
}
nft_first_packets()
{
# $1 - packet count
[ -n "$1" -a "$1" != keepalive ] && [ "$1" -ge 1 ] &&
{
if [ "$1" = 1 ] ; then
echo "$nft_connbytes 1"
else
echo "$nft_connbytes 1-$1"
fi
}
}
nft_apply_nfqws_in_out()
{
# $1 - tcp,udp
# $2 - ports
# $3 - PKT_OUT. special value : 'keepalive'
# $4 - PKT_IN
local f4 f6 first_packets_only
[ -n "$2" ] || return
[ -n "$3" -a "$3" != 0 ] &&
{
first_packets_only="$(nft_first_packets $3)"
f4="$1 dport {$2} $first_packets_only"
f6=$f4
nft_filter_apply_ipset_target f4 f6
nft_fw_nfqws_post "$f4" "$f6" $QNUM
}
[ -n "$4" -a "$4" != 0 ] &&
{
first_packets_only="$(nft_first_packets $4)"
f4="$1 dport {$2} $first_packets_only"
f6=$f4
nft_filter_apply_ipset_target f4 f6
nft_fw_reverse_nfqws_rule "$f4" "$f6" $QNUM
}
}
zapret_apply_firewall_standard_nfqws_rules_nft()
{
[ "$NFQWS2_ENABLE" = 1 ] && {
nft_apply_nfqws_in_out tcp "$NFQWS2_PORTS_TCP" "$NFQWS2_TCP_PKT_OUT" "$NFQWS2_TCP_PKT_IN"
nft_apply_nfqws_in_out tcp "$NFQWS2_PORTS_TCP_KEEPALIVE" keepalive "$NFQWS2_TCP_PKT_IN"
nft_apply_nfqws_in_out udp "$NFQWS2_PORTS_UDP" "$NFQWS2_UDP_PKT_OUT" "$NFQWS2_UDP_PKT_IN"
nft_apply_nfqws_in_out udp "$NFQWS2_PORTS_UDP_KEEPALIVE" keepalive "$NFQWS2_UDP_PKT_IN"
}
}
zapret_apply_firewall_standard_rules_nft()
{
zapret_apply_firewall_standard_nfqws_rules_nft
}
zapret_apply_firewall_rules_nft()
{
zapret_apply_firewall_standard_rules_nft
custom_runner zapret_custom_firewall_nft
}
zapret_apply_firewall_nft()
{
echo Applying nftables
create_ipset no-update
nft_create_firewall
nft_fill_ifsets_overload
zapret_apply_firewall_rules_nft
[ "$FLOWOFFLOAD" = 'software' -o "$FLOWOFFLOAD" = 'hardware' ] && nft_apply_flow_offloading
return 0
}
zapret_unapply_firewall_nft()
{
echo Clearing nftables
nft_del_firewall
custom_runner zapret_custom_firewall_nft_flush
return 0
}
zapret_do_firewall_nft()
{
# $1 - 1 - add, 0 - del
if [ "$1" = 0 ] ; then
zapret_unapply_firewall_nft
else
zapret_apply_firewall_nft
fi
return 0
}
# ctmark is not available in POSTNAT mode
CONNMARKER=
[ "$FILTER_TTL_EXPIRED_ICMP" = 1 ] && is_postnat && CONNMARKER="ct mark set ct mark or $DESYNC_MARK"
+39
View File
@@ -0,0 +1,39 @@
get_virt()
{
local vm s v UNAME
UNAME=$(uname)
case "$UNAME" in
Linux)
if exists systemd-detect-virt; then
vm=$(systemd-detect-virt --vm)
elif [ -f /sys/class/dmi/id/product_name ]; then
read s </sys/class/dmi/id/product_name
for v in KVM QEMU VMware VMW VirtualBox Xen Bochs Parallels BHYVE Hyper-V; do
case "$s" in
"$v"*)
vm=$v
break
;;
esac
done
fi
;;
esac
echo "$vm" | awk '{print tolower($0)}'
}
check_virt()
{
echo \* checking virtualization
local vm="$(get_virt)"
if [ -n "$vm" ]; then
if [ "$vm" = "none" ]; then
echo running on bare metal
else
echo "!!! WARNING. $vm virtualization detected !!!"
echo '!!! WARNING. vmware and virtualbox are known to break most of the DPI bypass techniques when network is NATed using internal hypervisor NAT !!!'
echo '!!! WARNING. if this is your case make sure you are bridged not NATed !!!'
fi
else
echo cannot detect
fi
}
+136
View File
@@ -0,0 +1,136 @@
# this file is included from init scripts
# change values here
# can help in case /tmp has not enough space
#TMPDIR=/opt/zapret2/tmp
# redefine user for zapret daemons. required on Keenetic
#WS_USER=nobody
# override firewall type : iptables,nftables,ipfw
#FWTYPE=iptables
# nftables only : set this to 0 to use pre-nat mode. default is post-nat.
# pre-nat mode disables some bypass techniques for forwarded traffic but allows to see client IP addresses in debug log
#POSTNAT=0
# options for ipsets
# maximum number of elements in sets. also used for nft sets
SET_MAXELEM=522288
# too low hashsize can cause memory allocation errors on low RAM systems , even if RAM is enough
# too large hashsize will waste lots of RAM
IPSET_OPT="hashsize 262144 maxelem $SET_MAXELEM"
# dynamically generate additional ip. $1 = ipset/nfset/table name
#IPSET_HOOK="/etc/zapret2.ipset.hook"
# options for ip2net. "-4" or "-6" auto added by ipset create script
IP2NET_OPT4="--prefix-length=22-30 --v4-threshold=3/4"
IP2NET_OPT6="--prefix-length=56-64 --v6-threshold=5"
# options for auto hostlist
# NOTE : in order for these adjustment to work it's required to redirect enough starting packets
# NOTE : set PKT_IN, PKT_OUT variables appropriately
AUTOHOSTLIST_INCOMING_MAXSEQ=4096
AUTOHOSTLIST_RETRANS_MAXSEQ=32768
AUTOHOSTLIST_RETRANS_RESET=1
AUTOHOSTLIST_RETRANS_THRESHOLD=3
AUTOHOSTLIST_FAIL_THRESHOLD=3
AUTOHOSTLIST_FAIL_TIME=60
AUTOHOSTLIST_UDP_IN=1
AUTOHOSTLIST_UDP_OUT=4
# 1 = debug autohostlist positives to ipset/zapret-hosts-auto-debug.log
AUTOHOSTLIST_DEBUGLOG=0
# number of parallel threads for domain list resolves
MDIG_THREADS=30
# EAI_AGAIN retries
MDIG_EAGAIN=10
# delay between EAI_AGAIN retries (ms)
MDIG_EAGAIN_DELAY=500
# ipset/*.sh can compress large lists
GZIP_LISTS=1
# command to reload ip/host lists after update
# comment or leave empty for auto backend selection : ipset or ipfw if present
# on BSD systems with PF no auto reloading happens. you must provide your own command
# set to "-" to disable reload
#LISTS_RELOAD="pfctl -f /etc/pf.conf"
# mark bit used by nfqws to prevent loop
DESYNC_MARK=0x40000000
DESYNC_MARK_POSTNAT=0x20000000
# do not pass outgoing traffic to nfqws not marked with this bit
# this setting allows to write your own rules to limit traffic that should be fooled
# for example based on source IP or incoming interface name
# no filter if not defined
#FILTER_MARK=0x10000000
NFQWS2_ENABLE=0
# redirect outgoing traffic with connbytes limiter applied in both directions.
NFQWS2_PORTS_TCP=80,443
NFQWS2_PORTS_UDP=443
# PKT_OUT means connbytes dir original
# PKT_IN means connbytes dir reply
NFQWS2_TCP_PKT_OUT=20
NFQWS2_TCP_PKT_IN=10
NFQWS2_UDP_PKT_OUT=5
NFQWS2_UDP_PKT_IN=3
# redirect outgoing traffic without connbytes limiter and incoming with connbytes limiter
# normally it's needed only for stateless DPI that matches every packet in a single TCP session
# typical example are plain HTTP keep alives
# this mode can be very CPU consuming. enable with care !
#NFQWS2_PORTS_TCP_KEEPALIVE=80
#NFQWS2_PORTS_UDP_KEEPALIVE=
# use <HOSTLIST> and <HOSTLIST_NOAUTO> placeholders to engage standard hostlists and autohostlist in ipset dir
# hostlist markers are replaced to empty string if MODE_FILTER does not satisfy
# <HOSTLIST_NOAUTO> appends ipset/zapret-hosts-auto.txt as normal list
NFQWS2_OPT="
--filter-tcp=80 --filter-l7=http <HOSTLIST> --payload=http_req --lua-desync=fake:blob=fake_default_http:tcp_md5 --lua-desync=multisplit:pos=method+2 --new
--filter-tcp=443 --filter-l7=tls <HOSTLIST> --payload=tls_client_hello --lua-desync=fake:blob=fake_default_tls:tcp_md5:tcp_seq=-10000 --lua-desync=multidisorder:pos=1,midsld --new
--filter-udp=443 --filter-l7=quic <HOSTLIST_NOAUTO> --payload=quic_initial --lua-desync=fake:blob=fake_default_quic:repeats=6
"
# none,ipset,hostlist,autohostlist
MODE_FILTER=none
# donttouch,none,software,hardware
FLOWOFFLOAD=donttouch
# openwrt: specify networks to be treated as LAN. default is "lan"
#OPENWRT_LAN="lan lan2 lan3"
# openwrt: specify networks to be treated as WAN. default wans are interfaces with default route
#OPENWRT_WAN4="wan vpn"
#OPENWRT_WAN6="wan6 vpn6"
# for routers based on classic linux. has no effect in openwrt.
# CHOOSE LAN and optinally WAN/WAN6 NETWORK INTERFACES
# or leave them commented if its not router
# it's possible to specify multiple interfaces like this : IFACE_WAN="eth0 eth1 eth2"
# if IFACE_WAN6 is not defined it take the value of IFACE_WAN
#IFACE_LAN=eth0
#IFACE_WAN=eth1
#IFACE_WAN6="ipsec0 wireguard0 he_net"
# should start/stop command of init scripts apply firewall rules ?
# not applicable to openwrt with firewall3+iptables
INIT_APPLY_FW=1
# firewall apply hooks
#INIT_FW_PRE_UP_HOOK="/etc/firewall.zapret2.hook.pre_up"
#INIT_FW_POST_UP_HOOK="/etc/firewall.zapret2.hook.post_up"
#INIT_FW_PRE_DOWN_HOOK="/etc/firewall.zapret2.hook.pre_down"
#INIT_FW_POST_DOWN_HOOK="/etc/firewall.zapret2.hook.post_down"
# do not work with ipv4
#DISABLE_IPV4=1
# do not work with ipv6
DISABLE_IPV6=1
# drop icmp time exceeded messages for nfqws tampered connections
# in POSTNAT mode this can interfere with default mtr/traceroute in tcp or udp mode. use source port not redirected to nfqws
# set to 0 if you are not expecting connection breakage due to icmp in response to TCP SYN or UDP
FILTER_TTL_EXPIRED_ICMP=1
# select which init script will be used to get ip or host list
# possible values : get_user.sh get_antizapret.sh get_combined.sh get_reestr.sh get_hostlist.sh
# comment if not required
#GETLIST=
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2016-2025 bol-van
Copyright (c) 2016-2026 bol-van
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+335
View File
@@ -18,3 +18,338 @@ v0.1.4
* winws2: set low mandatory level in process token if possible : no --wlan-filter or --nlm-filter (no windivert reinit required)
* nfqws2: optimize debug logging to file
v0.1.5
* nfqws2: # and % arg substitution
* zapret-antidpi: luaexec
* zapret-pcap: simple packet capture to .cap file
v0.2
* blockcheck2
* nfqws2: several crash fixes
* nfqws2: bu8,bu16,bu24,bu32,swap16,swap32 functions now work with negative int
* nfqws2: getpid,gettid,uname,get_clock luacalls
* zapret-lib: bugfixes
* zapret-lib: remove ip6_hopbyhop_x2 fooling, separately add second hopbyhop header using ip6_hopbyhop2
* zapret-pcap
v0.3
* init.d launch scripts
* init.d: 40-webserver custom script
* install_easy
v0.4
* nfqws2: profile names and cookies
* nfqws2: profile templates
* nfqws2: remove stun_binding_req, replace to stun. no more message type details
* nfqws2: proper conntack position for replayed packets
* nfqws2: execution_plan, execution_plan_cancel
* blockcheck2: fix broken dns cache
* nfqws2: LUA_COMPAT_VER tracking
v0.5
* nfqws2: u8add,u16add,u24add,u32add luacalls
* nfqws2: abandon any arithmetics beyond 32bit (because lua 5.1 does not support 64 bit integers, store everything as double)
* nfqws2: fix issues with 32-bit lua_Integer in lua<5.3 on 32-bit platforms
* nfqws2: instance_cutoff luacall just warns and do nothing if ctx is nil
* actions: build nfqws2 x86 binary with LUA 5.4, not with luajit
* zapret-lib: http_reply, url and nld dissectors
* zapret-lib: instance_cutoff_shim
* zapret-auto: circular orchestrator
v0.5.1
* zapret-auto: separate failure detection logic
* blockcheck2: fix broken http3 test
v0.6
* zapret-lib,zapret-antidpi: tls_mod_shim supports sni=%var subst
* blockcheck2: syndata tests
* nfqws2: reasm support negative overlaps. gaps are not supported.
* nfqws2,zapret-auto: changed retransmission detection scheme.
* zapret-auto: udp_in/udp_out failure detection
v0.6.1
* zapret-lib, zapret-auto: condition and stopif orchestrators
* zapret-lib: detect_payload_str - sample lua payload detector
* blockcheck2: unterminated string fix
v0.7
* nfqws2, zapret-lib : fix non-working % and # arg substitution under orchestrator
* nfqws2, zapret-lib : structure conntrack in/out positions. pass in desync.track.pos.{client,server,direct,reverse} position tables
* nfqws2: autohostlist: trigger RST and http redirect failures only within specified relative sequence
* nfqws2: autohostlist: trigger http redirect failure if payload is http_req without connection proto check
* nfqws2: push desync.track.pos.dt as float with nsec accuracy
* zapret-auto: override host autostate key in automate_host_record
* nfqws2: rewrite udp autohostlist failure detector logic
v0.7.1
* init.d: nft fix non-working incoming redirect
* nfqws2: cancel reasm if server window size is smaller than expected reasm size
* nfqws2: add EOL at the end of truncated buffered DLOG line if it's too large. increase log line buffer
* nfqws2: autohostlist reset fail counter if udp_in > threshold
* nfqws2: reduced default retrans maxseq to 32768
* nfqws2: solved inability to get SSID using nl80211 on kernels 5.19+
v0.7.2
* zapret-lib: fix broken is_retransmission()
* zapret-auto: add success detector logic
* nfqws2: clean lua cutoff on profile change
* zapret-auto: separate hostkey function
v0.7.4
* nfqws2, zapret-lib : check tcp sequence range overflow
* zapret-lib: seq compare functions
* nfqws2: add l3_len, l4_len to dissect
* nfqws2: fix broken l7proto profile rediscovery
* winws2: harden sandbox. disable child process execution , some UI interaction and desktop settings change
v0.7.5
* zapret-auto: orchestrator "repeater"
* blockcheck2: check http3 with ipv6 exthdr
* github actions: separate target arm-old with LUA classic, not JIT
* zapret-auto: iff/neg in repeater
* zapret-antidpi: multidisorder_legacy
* ipset: remove get_reestr_hostlist.sh and get_reestr_resolve.sh because zapret-info does not and will probably not ever update
* nfqws2: fix "reasm cancelled" if no incoming traffic redirected
* blockcheck2: MULTIDISORDER=multidisorder_legacy
v0.7.6
* nfqws2: reevaluate profile on l7/host discovery in any direction
* nfqws2: dtls protocol detection
* nfqws2: autohostlist reset retransmitter to break long wait
* zapret-auto: stadard_failure_detector reset retransmitter to break long wait
* nfqws2, init.d, windivert : dht and wg detection changes
v0.8.0
* init.d: 50-dht4all NFQWS_OPT_DHT_PKT_OUT
* nfqws2: (LUA_COMPAT_VER=4) support 48-bit arithmetics
* github actions: remove arm-old target - luajit fail reason revealed
* nfqws2: do not treat quic handshake messages as initials
* zapret-lib: tls dissector/reconstructor
* zapret-antidpi: tls_client_hello_clone
* zapret-antidpi: "optional" arg to blob taking functions
* nfqws2: support gzipped lua file. auto use script.lua.gz
v0.8.1
* nfqws2: fix bu48 crash and wrong results in bitset
* zapret-lib: http_reconstruct_req
* zapret-antidpi: http_unixeol
* blockcheck2: http_unixeol test
v0.8.2
* nfqws2: do not start if NFQWS2_COMPAT_VER unexpected
* nfqws2: cache dns response IP addresses if --ipcache-hostname enabled
* winws2: remove hardcoded filter for loopback
* init.d: ressurect @lanif in nft scheme
* init.d: fix broken @wanif/@wanif6 fill in sysv nft scheme
* init.d: 80-dns-intercept
* winws2: --wf-filter-loopback
* blockcheck2: NOTEST_MISC_HTTP[S], NOTEST_SYNDATA_HTTP[S]
v0.8.3
* nfqws2, zapret-lib: gzip compression and decompression
* nfqws2: ignore trailing spaces and tabs in hostlists and ipsets. "host.com " or "1.2.3.4 " are ok now
* init.d: 99-lan-filter custom script
* mdig: --eagain, --eagain-delay
v0.8.4
* winws2: fix loopback large packets processing (up to 64K)
* zapret-lib, zapret-antidpi: use numeric indexes in http dissects
* nfqws2: move ctx from lightuserdata to userdata. prevents crashes on specific ARM cpus
* nfqws2: alternative representation of payload filter in execution_plan item
* nfqws2: --payload-disable
* nfqws2: gracefully shutdown on SIGINT and SIGTERM
* nfqws2: harden wireguard detection. do not detect if reserved bytes 1..3 != 0
v0.8.5
* nfqws2: do not require / in the beginning of URI in http
* zapret-lib: rawsend_dissect_segmented support URG
* zapret-antidpi: oob
* blockcheck2: 17-oob.sh
* nfqws2: set desync.tcp_mss to minimum of both ends or default if at least one is unknown
* zapret-lib: tcp_nop_del
* blockcheck2: tcp_nop_del in SYN packets with md5 in openbsd
v0.8.6
* winws2, blockcheck2: allow multiple instances in windows, linux, freebsd (not openbsd)
* nfqws2: fix critical bug - wrong ipv6 dissection
* zapret-auto: fix standard_failure_detector http redirect regression
v0.9.0
* nfqws2: removed hard check for host: presence in http_req
* nfqws2: file open test before destroying in-memory content of ipset/hostlist
* github actions: lua 5.5
* nfqws2: enable dead reasm protection in wsize=0 case
* nfqws2: --intercept
* winws2: changed icon to multi-res png up to 256px
* nfqws2: support icmp and ipp
* nfqws2: VERDICT_PRESERVE_NEXT
* nfqws2: keepsum reconstruct option
* nfqws2: more helpers
* zapret-obfs: ippxor, udp2icmp, synhide
* nfqws2: LUA_COMPAT_VER=5
* winws2: --wf-raw-filter
* nfqws2: conntrack_feed
* winws2: use windivert bulk mode
* nfqws2: template free import
v0.9.1
* nfqws2: 'stat', 'clock_getfloattime' luacalls
* nfqws2: bcryptorandom normalize behavior when system entropy is low. prevent blocks
* nfqws2: --new[=name]
* winws2: fix not setting signal handlers
v0.9.2
* nfqws2: bt and utp_bt protocol detectors
* nfqws2: localtime,gmtime,timelocal,timegm luacalls
* winws2: load wlanapi.dll dynamically only if needed
* winws2: fixed lost windivert deinit on logical network disappear
v0.9.3
* nfqws2: handling of incoming fragmented packets (no reconstruct, raw ip payload)
* zapret-auto: per_instance_condition orchestrator
* zapret-auto: "instances" argument in condition orchestrator
* zapret-auto: cond_tcp_has_ts, cond_lua iff functions
* zapret-lib: replay_execution_plan and plan_clear max parameter
* init.d: use bitmap:port ipset for standard dports
* github: reduce executables files size
* install_bin: added linux-riscv64 scan dir
* github actions: added linux-riscv64 arch
v0.9.4
* github actions: update upx to 5.1.0. use upx for linux-riscv5
* github actions: stronger zip and gz compression
* nfqws2: --chdir
* nfqws2: fixed wrong scale factor application to winsize
* nfqws2: very old kernels compat
v0.9.4.2
* builder_linux: simple scripts to build static linux bins for any supported architecture
* zapret-auto: incompatible change. cond_lua "code" parameter => "cond_code". to avoid collision with luaexec
v0.9.4.3
* nfqws2: fix broken wifi ssid update
* github: revert to upx 4.2.4 for all archs except riscv64
* zapret-lib: apply_fooling throws error if tcp_ts,tcp_seq,tcp_ack,ip_ttl,ip6_ttl,ip_autottl,ip6_autottl are empty or invalid
0.9.4.4
* winws2, dvtws2: ASLR
* github, linux-builder: reduce arm executable size by 20% - move to armv7+thumb
* init.d: warn if hostlist/ipset files are inside zapret2 root
* zapret-lib: do not call apply_arg_prefix in apply_execution_plan - call it right before instance execute
0.9.4.5
* github: rollback to lj_alloc in luajit for arm64 and mips64
* github: use 16K page size for android arm64 build
* nfqws2: join fragments in quic CRYPTO reconstruction. allow intersections.
0.9.4.6
* nfqws2: fix TLS payload reassemble if L7 protocol is not TLS
0.9.4.7
* nfqws2: do not fail tls_mod if dupsid,rndsni,padencap fail
0.9.5
* nfqws2: timers
0.9.5.1
* nfqws2: timer_info, timer_enum
0.9.5.2
* nfqws2: rewrite time counting algorithm, remove --timer-res
1.0
* zapret-lib,zapret-antidpi: delay parameter in "send" desync function
* zapret-lib: fix oob urp=b case in rawsend_dissect_segmented
* nfqws2, zapret-lib: (LUA_COMPAT_VER=6) fix wrong spelling : WRITEABLE -> WRITABLE
1.0.1
* install_easy: do not use apk in openwrt if it doesn't have db in /lib/apk/db
* nfqws2: fix UAF if a timer is deleted in timer function
1.0.2
* nfqws2: fix 60 msec lua-gc default to 60 sec
1.0.3
* nfqws2: accept string or function in timer_set(). remember function as a function, not as a string.
* nfqws2: limit delayed packet queue to 64 packets (anti-ddos)
* init.d: add udp ports range 19294-19344 to discord media
* blockcheck2: use cygstart in windows to avoid fork problems (without cygwin rebase)
1.0.4
* blockcheck2: revert cygstart method as it brings more problems than profit
* nfqws2: stop execution plan in C code if a blob is unavailable
* nfqws2: desync_timer_name includes now instance name
* builder_linux: optional build with zlib-ng : set ZLIB_NG=1 variable
* github: remove high_entropy_va patch for windivert.dll, but leave dynamic_base
1.0.5
* blockcheck2: use --wf-raw-filter in Windows instead of --ipset to limit target IP addresses
* github, builder_linux: lua 5.5.1
* nfqws2: negate SSID/NLM filters
* nfqws2: desync function can explicitly return nil as a synonym of VERDICT_PASS
* nfqws2: pad tcp options with 0x00 in reconstruct. strip 0x00 ending options in dissect.
* nfqws2: --filter-mark
* zapret-lib: luaexec now passes returned verdict code
* blockcheck2: fix script crash on bad strategies from the file in custom/10-list.sh
1.0.5.1
* nfqws2: optimize profile search. fast checks first
1.0.5.2
* nfqws2: more profile search optimizations
1.0.6
* zapret-lib: dissect quic tvb values that can't fit into 52-bit mantissa into raw strings
* zapret-lib, nfqws2: treat ? and # characters as domain end in URL
* blockcheck2: in 10-list.sh try space separated logic as fallback if eval fails (useful for copy-paste from blockcheck2)
* blockcheck2: CURL_PAD - add junk headers to increase request size and trigger 16-kb block without large downloaded data
* blockcheck2: in addition to COMMON print COVERAGE section with how many domains worked for each strategy
* blockcheck2: sweep old temp files after hard kill or crash. sweep ip/nf tables in linux
* blockcheck2: pktws guard timer in all OS
* blockcheck2: request PACE-ing
* blockcheck2: veryquick scan level
+34 -6
View File
@@ -1,16 +1,44 @@
debian,ubuntu :
* debian,ubuntu :
apt install make gcc zlib1g-dev libcap-dev libnetfilter-queue-dev libmnl-dev libsystemd-dev libluajit2-5.1-dev
apt install make gcc zlib1g-dev libcap-dev libnetfilter-queue-dev libmnl-dev libsystemd-dev libluajit-5.1-dev
make -C /opt/zapret2 systemd
FreeBSD :
* fedora, rhel, centos, alma
dnf install make gcc zlib-ng-compat-devel libcap-devel libnetfilter_queue-devel libmnl-devel systemd-devel luajit-devel
make -C /opt/zapret2 systemd
* linux static :
need any x86_64 classic linux distribution
tested on debian/ubuntu/fedora 2020+
if your distro is very exotic, old or not glibc based you can debootstrap a modern debian/ubuntu system and chroot to it
NOTE: it's not possible to build luajit in chroot under standard openwrt kernel. build process requires 32-bit x86 support, kernel is compiled without it.
NOTE: toolchains are pre-compiled for x86_64 glibc. they can't run on arm or anything that is not x86_64.
optionally review "common.inc" for Lua and LuaJIT versions
debian/ubuntu: apt install curl xz-utils bzip2 unzip make gcc gcc-multilib libc6-dev libcap-dev pkg-config
fedora: dnf install curl xz bzip2 unzip make gcc glibc-devel glibc-devel.i686 libcap-devel pkg-config
copy directory "builder-linux" somethere with enough free disk space (up to 2G for all toolchains)
run "get_toolchains.sh"
select architectures you need or "ALL"
run "build_deps.sh", select "ALL"
run "build_zapret2.sh", select "ALL"
get static musl bins from "binaries" folder
"zapret2" is downloaded from github master branch. if you need specific version - download manually to "zapret2" dir
i586 and riscv64 targets are built with classic PUC Lua
* FreeBSD :
pkg install pkgconf
pkg search luajit-2
# see what's the version available
pkg install luajit-2.1.0.20250728
make -C /opt/zapret2
OpenBSD :
* OpenBSD :
pkg_add luajit gmake bsd
gmake -C /opt/zapret2
pkg_add luajit gmake
gmake -C /opt/zapret2 bsd
+4 -4
View File
@@ -11,9 +11,9 @@ setup-x86_64.exe --allow-unsupported-windows --no-verify --site http://ctm.crouc
4) install and compile luajit from here : https://github.com/openresty/luajit2
download latest releast, unpack, cd to it's directory
download latest release, unpack, cd to it's directory
make BUILDMODE=static CFLAGS="-Os"
make BUILDMODE=static CFLAGS="-Os -DLUAJIT_DISABLE_FFI -ffat-lto-objects -flto=auto -ffunction-sections -fdata-sections -fvisibility=hidden"
make install
5) cd to %ZAPRET_BASE%/nfq2
@@ -32,5 +32,5 @@ Choose version 2.2.2 for Windows 10 and 2.2.0 for Windows 7.
8) Copy cygwin1.dll, winws2.exe, windivert.dll and windivert64.sys to one folder.
9) Run winws2.exe from cmd.exe running as administrator.
winws will not run from cygwin shell with cygwin1.dll copy in it's folder.
winws will not run without cygwin1.dll outside of cygwin shell.
winws2 will not run from cygwin shell with cygwin1.dll copy in it's folder.
winws2 will not run without cygwin1.dll outside of cygwin shell.
+122
View File
@@ -0,0 +1,122 @@
#!/bin/bash
EXEDIR="$(dirname "$0")"
EXEDIR="$(cd "$EXEDIR"; pwd)"
. "$EXEDIR/common.inc"
dl_deps()
{
[ -d "$DEPS" ] || mkdir -p "$DEPS"
(
cd "$DEPS"
exists_dir libnfnetlink-* ||
curl $CURL_OPT -Lo - https://www.netfilter.org/pub/libnfnetlink/libnfnetlink-1.0.2.tar.bz2 | tar -xj || exit 5
exists_dir libmnl-* ||
curl $CURL_OPT -Lo - https://www.netfilter.org/pub/libmnl/libmnl-1.0.5.tar.bz2 | tar -xj || exit 5
exists_dir libnetfilter_queue-* ||
curl $CURL_OPT -Lo - https://www.netfilter.org/pub/libnetfilter_queue/libnetfilter_queue-1.0.5.tar.bz2 | tar -xj || exit 5
exists_dir zlib-ng-${ZLIB_NG_VER} ||
curl $CURL_OPT -Lo - https://github.com/zlib-ng/zlib-ng/archive/refs/tags/${ZLIB_NG_VER}.tar.gz | tar -xz || exit 5
exists_dir zlib-${ZLIB_VER} ||
curl $CURL_OPT -Lo - https://zlib.net/fossils/zlib-${ZLIB_VER}.tar.gz | tar -xz || exit 5
exists_dir luajit2-* ||
curl $CURL_OPT -Lo - https://github.com/openresty/luajit2/archive/refs/tags/v${LUAJIT_RELEASE}.tar.gz | tar -xz || exit 5
exists_dir lua-* ||
curl $CURL_OPT -Lo - https://www.lua.org/ftp/lua-${LUA_RELEASE}.tar.gz | tar -xz || exit 5
)
}
build_netlink()
{
for i in libmnl libnfnetlink libnetfilter_queue ; do
(
cd $i-*
[ -f "Makefile" ] && make clean
CFLAGS="$OPTIMIZE $MINSIZE $CFLAGS" \
LDFLAGS="$LDMINSIZE $LDFLAGS" \
./configure --prefix= --host=$TARGET CC=$CC LD=$LD --enable-static --disable-shared --disable-dependency-tracking
make install -j$nproc DESTDIR=$STAGING_DIR
)
sed -i "s|^prefix=.*|prefix=$STAGING_DIR|g" $STAGING_DIR/lib/pkgconfig/$i.pc
done
}
build_zlib()
{
(
if [ "$ZLIB_NG" = 1 ]; then
cd zlib-ng-${ZLIB_NG_VER}
else
cd zlib-${ZLIB_VER}
fi
[ -f "Makefile" ] && make clean
CFLAGS="$OPTIMIZE $MINSIZE $CFLAGS" \
LDFLAGS="$LDMINSIZE $LDFLAGS" \
./configure --prefix= --static --zlib-compat
make install -j$nproc DESTDIR=$STAGING_DIR
)
}
build_lua()
{
(
cd lua-${LUA_RELEASE}
make clean
make CC="$CC" AR="$AR rc" CFLAGS="$OPTIMIZE $MINSIZE $CFLAGS" LDFLAGS="$LDMINSIZE $LDFLAGS" linux -j$nproc
make install INSTALL_TOP="$STAGING_DIR" INSTALL_BIN="$STAGING_DIR/bin" INSTALL_INC="$STAGING_DIR/include/lua${LUA_VER}" INSTALL_LIB="$STAGING_DIR/lib"
)
}
build_luajit()
{
local CFL="$CFLAGS"
local SYSMALLOC=
(
cd luajit2-*
CFLAGS="-Os"
make clean
case $TARGET in
aarch64*|mips64*)
# sysmalloc can cause troubles without GC64. GC64 slows down by 10-15%. better not to use sysmalloc and leave lj_alloc.
;;
*)
# save some exe size
SYSMALLOC=-DLUAJIT_USE_SYSMALLOC
esac
make BUILDMODE=static XCFLAGS="$SYSMALLOC -DLUAJIT_DISABLE_FFI $CFLAGS_PIC" HOST_CC="$HOST_CC" CROSS= CC="$CC" TARGET_AR="$AR rcus" TARGET_STRIP=$STRIP TARGET_CFLAGS="$OPTIMIZE $MINSIZE $CFL" TARGET_LDFLAGS="$CPU $LDMINSIZE $LDFLAGS"
make install PREFIX= DESTDIR="$STAGING_DIR"
)
}
build_luajit_for_target()
{
target_has_luajit $1 && {
case "$1" in
*64*)
HOST_CC="$HOSTCC"
;;
*)
HOST_CC="$HOSTCC -m32"
;;
esac
build_luajit
}
}
check_prog curl tar gzip bzip2 sed make cc pkg-config
check_h_files
dl_deps
check_toolchains
ask_target
CFLAGS_BASE="$CFLAGS"
for t in $TGT; do
CFLAGS="$CFLAGS_BASE"
buildenv $t
CFLAGS="$CFLAGS $CFLAGS_PIC"
pushd "$DEPS"
install_h_files
build_zlib
build_netlink
build_lua
build_luajit_for_target $t
popd
buildenv_clear
done
+64
View File
@@ -0,0 +1,64 @@
#!/bin/bash
EXEDIR="$(dirname "$0")"
EXEDIR="$(cd "$EXEDIR"; pwd)"
. "$EXEDIR/common.inc"
ZDIR="zapret"
ZBASE="$EXEDIR"
BRANCH=master
ZURL=https://github.com/bol-van/zapret/archive/refs/heads/${BRANCH}.zip
ZBIN="$EXEDIR/binaries"
dl_zapret1()
{
if [ -d "$ZBASE/$ZDIR" ]; then
dir_is_not_empty "$ZBASE/$ZDIR" && {
echo "zapret dir is not empty. if you want to redownload - delete it."
return
}
rmdir "$ZBASE/$ZDIR"
fi
(
cd "$ZBASE"
curl $CURL_OPT -Lo /tmp/zapret.zip "$ZURL"
unzip /tmp/zapret.zip
rm /tmp/zapret.zip
mv zapret-${BRANCH} $ZDIR
)
}
check_prog curl unzip make
dl_zapret1
check_toolchains
ask_target
[ -d "$ZBIN" ] || mkdir -p "$ZBIN"
CFLAGS_BASE="$CFLAGS"
for t in $TGT; do
CFLAGS="$CFLAGS_BASE $MINSIZE"
buildenv $t
translate_target $t || {
echo COULD NOT TRANSLATE TARGET $t TO BIN DIR
continue
}
pushd $ZBASE/$ZDIR
make clean
OPTIMIZE=$OPTIMIZE \
CFLAGS="-static-libgcc -I$STAGING_DIR/include $CFLAGS $CFLAGS_PIC" \
LDFLAGS="-L$STAGING_DIR/lib $LDMINSIZE $LDFLAGS_PIE $LDFLAGS" \
make
[ -d "$ZBIN/$ZBINTARGET" ] || mkdir "$ZBIN/$ZBINTARGET"
cp -f binaries/my/* "$ZBIN/$ZBINTARGET"
popd
buildenv_clear
done
+75
View File
@@ -0,0 +1,75 @@
#!/bin/bash
EXEDIR="$(dirname "$0")"
EXEDIR="$(cd "$EXEDIR"; pwd)"
. "$EXEDIR/common.inc"
ZDIR="zapret2"
ZBASE="$EXEDIR"
BRANCH=master
ZURL=https://github.com/bol-van/zapret2/archive/refs/heads/${BRANCH}.zip
ZBIN="$EXEDIR/binaries"
dl_zapret2()
{
if [ -d "$ZBASE/$ZDIR" ]; then
dir_is_not_empty "$ZBASE/$ZDIR" && {
echo "zapret2 dir is not empty. if you want to redownload - delete it."
return
}
rmdir "$ZBASE/$ZDIR"
fi
(
cd "$ZBASE"
curl $CURL_OPT -Lo /tmp/zapret2.zip "$ZURL"
unzip /tmp/zapret2.zip
rm /tmp/zapret2.zip
mv zapret2-${BRANCH} $ZDIR
)
}
check_prog curl unzip make
dl_zapret2
check_toolchains
ask_target
[ -d "$ZBIN" ] || mkdir -p "$ZBIN"
CFLAGS_BASE="$CFLAGS"
for t in $TGT; do
CFLAGS="$CFLAGS_BASE"
buildenv $t
translate_target $t || {
echo COULD NOT TRANSLATE TARGET $t TO BIN DIR
continue
}
pushd $ZBASE/$ZDIR
LUA_JIT=0
LCFLAGS="-I${STAGING_DIR}/include/lua${LUA_VER}"
LLIB="-L${STAGING_DIR}/lib -llua"
target_has_luajit $t && {
LUA_JIT=1
LCFLAGS="-I${STAGING_DIR}/include/luajit-${LUAJIT_VER}"
LLIB="-L${STAGING_DIR}/lib -lluajit-${LUAJIT_LUA_VER}"
}
make clean
LUA_JIT=$LUA_JIT LUA_VER=$LUA_VER LUAJIT_LUA_VER=$LUAJIT_LUA_VER \
OPTIMIZE=$OPTIMIZE \
MINSIZE=$MINSIZE \
CFLAGS="-static-libgcc -I$STAGING_DIR/include $CFLAGS" \
LDFLAGS="-L$STAGING_DIR/lib $LDFLAGS" \
make CFLAGS_PIC="$CFLAGS_PIC" LDFLAGS_PIE="$LDFLAGS_PIE" LUA_JIT=$LJIT LUA_CFLAGS="$LCFLAGS" LUA_LIB="$LLIB"
[ -d "$ZBIN/$ZBINTARGET" ] || mkdir "$ZBIN/$ZBINTARGET"
cp -f binaries/my/* "$ZBIN/$ZBINTARGET"
popd
buildenv_clear
done
+311
View File
@@ -0,0 +1,311 @@
EXEDIR="$(dirname "$0")"
EXEDIR="$(cd "$EXEDIR"; pwd)"
CURL_OPT="--connect-timeout 5 --max-time 120 --retry 5 --retry-delay 30"
TOOLCHAINS="$EXEDIR/toolchain"
DEPS="$EXEDIR/deps"
STAGE="$EXEDIR/staging"
OPTIMIZE=${OPTIMIZE:--Oz}
#MINSIZE="${MINSIZE:--flto=auto -ffunction-sections -fdata-sections}"
MINSIZE="${MINSIZE:--ffunction-sections -fdata-sections}"
LDMINSIZE="${LDMINSIZE:--Wl,--gc-sections -flto=auto}"
#CFLAGS=""
LDFLAGS="-lgcc_eh $LDFLAGS"
# PIE makes ASLR working but adds 5% to size
# PIE does not work for arm32 and all mips
PIE=${PIE:-0}
HOSTCC=${HOSTCC:-cc}
ZLIB_VER=${ZLIB_VER:-1.3.2}
ZLIB_NG_VER=${ZLIB_NG_VER:-2.3.3}
LUA_VER=${LUA_VER:-5.5}
LUA_RELEASE=${LUA_RELEASE:-5.5.1}
LUAJIT_VER=${LUAJIT_VER:-2.1}
LUAJIT_RELEASE=${LUAJIT_RELEASE:-2.1-20250826}
LUAJIT_LUA_VER=${LUAJIT_LUA_VER:-5.1}
nproc=$(nproc)
TARGETS="\
aarch64-unknown-linux-musl \
armv6-unknown-linux-musleabi \
i586-unknown-linux-musl \
x86_64-unknown-linux-musl \
mips-unknown-linux-muslsf \
mips64-unknown-linux-musl \
mips64el-unknown-linux-musl \
mipsel-unknown-linux-muslsf \
powerpc-unknown-linux-musl \
riscv64-unknown-linux-musl \
"
target_has_luajit()
{
case "$1" in
aarch64-unknown-linux-musl| \
armv6-unknown-linux-musleabi| \
x86_64-unknown-linux-musl| \
mips-unknown-linux-muslsf| \
mips64-unknown-linux-musl| \
mips64el-unknown-linux-musl| \
mipsel-unknown-linux-muslsf| \
powerpc-unknown-linux-musl) \
return 0
;;
esac
return 1
}
REQD_H_FILES="/usr/include/sys/capability.h /usr/include/bits/libc-header-start.h"
REQD_QUEUE_1="/usr/include/sys/queue.h"
REQD_QUEUE_2="/usr/include/x86_64-linux-gnu/sys/queue.h"
check_h_files()
{
[ ! -f "$REQD_QUEUE_1" -a ! -f "$REQD_QUEUE_2" ] && {
echo "could not find $REQD_QUEUE_1 or $REQD_QUEUE_2"
help_pkg
exit 10
}
check_file $REQD_H_FILES
}
install_h_files()
{
if [ -f "$REQD_QUEUE_1" ]; then
install -Dm644 -t $STAGING_DIR/include/sys $REQD_QUEUE_1
elif [ -f "$REQD_QUEUE_2" ]; then
install -Dm644 -t $STAGING_DIR/include/sys $REQD_QUEUE_2
fi
install -Dm644 -t $STAGING_DIR/include/sys $REQD_H_FILES
}
buildenv()
{
# $1 = arch
export TARGET=$1
export CC=$TARGET-gcc
export LD=$TARGET-ld
export AR=$TARGET-ar
export NM=$TARGET-nm
export STRIP=$TARGET-strip
export STAGING_DIR="$EXEDIR/staging/$TARGET"
[ -d "$STAGING_DIR" ] || {
mkdir -p "$STAGING_DIR"
mkdir -p "$STAGING_DIR/lib/pkgconfig"
mkdir -p "$STAGING_DIR/bin"
mkdir -p "$STAGING_DIR/include"
}
export PKG_CONFIG_PATH=$STAGING_DIR/lib/pkgconfig
OLDPATH="$PATH"
export PATH="$PATH:$TOOLCHAINS/$TARGET/bin"
CPU=
CFLAGS_PIC=
LDFLAGS_PIE=-static
# not all archs support -static-pie. if does not support - it produces dynamic executable
# "-static -static-pie" causes segfaults
case $1 in
armv6-*)
CPU="-mthumb -msoft-float"
CFLAGS="$CPU $CFLAGS"
;;
mips*)
;;
*)
[ "$PIE" = 1 ] && {
CFLAGS_PIC=-fPIC
LDFLAGS_PIE="-static-pie"
}
esac
}
buildenv_clear()
{
export PATH="$OLDPATH" TARGET= CC= LD= AR= NM= STRIP= STAGING_DIR= PKG_CONFIG_PATH=
OLDPATH=
}
which()
{
# on some systems 'which' command is considered deprecated and not installed by default
# 'command -v' replacement does not work exactly the same way. it outputs shell aliases if present
# $1 - executable name
local IFS=:
[ "$1" != "${1#/}" ] && [ -x "$1" ] && {
echo "$1"
return 0
}
for p in $PATH; do
[ -x "$p/$1" ] && {
echo "$p/$1"
return 0
}
done
return 1
}
exists()
{
which "$1" >/dev/null 2>/dev/null
}
exists_dir()
{
# use $1, ignore other args
[ -d "$1" ]
}
dir_is_not_empty()
{
# $1 - directory
local n
[ -d "$1" ] || return 1
n=$(ls -A "$1" | wc -c | xargs)
[ "$n" != 0 ]
}
find_str_in_list()
{
# $1 - string
# $2 - space separated values
local v
[ -n "$1" ] && {
for v in $2; do
[ "$v" = "$1" ] && return 0
done
}
return 1
}
ask_list()
{
# $1 - mode var
# $2 - space separated value list
# $3 - (optional) default value
local M_DEFAULT
eval M_DEFAULT="\$$1"
local M_DEFAULT_VAR="$M_DEFAULT"
local M="" m
[ -n "$3" ] && { find_str_in_list "$M_DEFAULT" "$2" || M_DEFAULT="$3" ;}
n=1
for m in $2; do
echo $n : $m
n=$(($n+1))
done
printf "your choice (default : $M_DEFAULT) : "
read m
[ -n "$m" ] && M=$(echo $2 | cut -d ' ' -f$m 2>/dev/null)
[ -z "$M" ] && M="$M_DEFAULT"
echo selected : $M
eval $1="\"$M\""
[ "$M" != "$M_DEFAULT_VAR" ]
}
ask_target()
{
# $1 = 1 = ask all, otherwise ask only present toolchains
# already set ?
[ -n "$TGT" ] && return
local d ALL_TARGETS
[ "$1" = 1 ] || {
if dir_is_not_empty "$TOOLCHAINS"; then
for d in "$TOOLCHAINS"/*; do
[ -d "$d" ] && {
d="$(basename "$d")"
ALL_TARGETS="$ALL_TARGETS $d"
}
done
fi
}
[ -n "$ALL_TARGETS" ] || ALL_TARGETS="$TARGETS"
echo "select target :"
ask_list TARGET "ALL $ALL_TARGETS" "ALL"
echo
echo selected TARGET : $TARGET
echo
if [ $TARGET = ALL ]; then
TGT="$ALL_TARGETS"
else
TGT="$TARGET"
fi
}
check_toolchains()
{
dir_is_not_empty "$TOOLCHAINS" || {
echo DOWNLOAD TOOLCHAINS FIRST
exit 1
}
}
help_pkg()
{
echo "debian/ubuntu: apt install curl xz-utils bzip2 unzip make gcc gcc-multilib libc6-dev libcap-dev pkg-config"
echo "fedora: dnf install curl xz bzip2 unzip make gcc glibc-devel glibc-devel.i686 libcap-devel pkg-config"
}
check_prog()
{
while [ -n "$1" ]; do
exists $1 || {
echo $1 is not available
help_pkg
exit 10
}
shift
done
}
check_file()
{
while [ -n "$1" ]; do
[ -f "$1" ] || {
echo $1 is not available
help_pkg
exit 10
}
shift
done
}
translate_target()
{
case $1 in
aarch64-unknown-linux-musl)
ZBINTARGET=linux-arm64
;;
armv6-unknown-linux-musleabi)
ZBINTARGET=linux-arm
;;
x86_64-unknown-linux-musl)
ZBINTARGET=linux-x86_64
;;
i586-unknown-linux-musl)
ZBINTARGET=linux-x86
;;
mips-unknown-linux-muslsf)
ZBINTARGET=linux-mips
;;
mipsel-unknown-linux-muslsf)
ZBINTARGET=linux-mipsel
;;
mips64-unknown-linux-musl)
ZBINTARGET=linux-mips64
;;
mips64el-unknown-linux-musl)
ZBINTARGET=linux-mipsel64
;;
powerpc-unknown-linux-musl)
ZBINTARGET=linux-ppc
;;
riscv64-unknown-linux-musl)
ZBINTARGET=linux-riscv64
;;
*)
return 1
esac
return 0
}
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
EXEDIR="$(dirname "$0")"
EXEDIR="$(cd "$EXEDIR"; pwd)"
. "$EXEDIR/common.inc"
BASEURL=https://github.com/bol-van/musl-cross/releases/download/latest
check_prog curl tar xz
[ -d "$TOOLCHAINS" ] || mkdir -p "$TOOLCHAINS"
ask_target 1
(
cd "$TOOLCHAINS"
for t in $TGT; do
[ -d "$t" ] && rm -r "$t"
curl $CURL_OPT -Lo - "${BASEURL}/${t}.tar.xz" | tar -Jx
done
)
@@ -24,8 +24,8 @@ define Build/Compile
endef
define Package/ip2net/install
$(INSTALL_DIR) $(1)/opt/zapret/binaries/my
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ip2net $(1)/opt/zapret/binaries/my
$(INSTALL_DIR) $(1)/opt/zapret2/binaries/my
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ip2net $(1)/opt/zapret2/binaries/my
endef
$(eval $(call BuildPackage,ip2net))
@@ -24,8 +24,8 @@ define Build/Compile
endef
define Package/mdig/install
$(INSTALL_DIR) $(1)/opt/zapret/binaries/my
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mdig $(1)/opt/zapret/binaries/my
$(INSTALL_DIR) $(1)/opt/zapret2/binaries/my
$(INSTALL_BIN) $(PKG_BUILD_DIR)/mdig $(1)/opt/zapret2/binaries/my
endef
$(eval $(call BuildPackage,mdig))
@@ -26,12 +26,12 @@ define Package/nfqws2
CATEGORY:=Network
TITLE:=nfqws2
SUBMENU:=Zapret
DEPENDS:=+libnetfilter-queue +lmnl +libcap +zlib +$(LUA_DEP)
DEPENDS:=+libnetfilter-queue +libmnl +libcap +zlib +$(LUA_DEP)
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./nfq/* $(PKG_BUILD_DIR)/
$(CP) ./nfq2/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
@@ -39,8 +39,8 @@ define Build/Compile
endef
define Package/nfqws2/install
$(INSTALL_DIR) $(1)/opt/zapret/binaries/my
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nfqws2 $(1)/opt/zapret/binaries/my
$(INSTALL_DIR) $(1)/opt/zapret2/binaries/my
$(INSTALL_BIN) $(PKG_BUILD_DIR)/nfqws2 $(1)/opt/zapret2/binaries/my
endef
$(eval $(call BuildPackage,nfqws2))
@@ -1 +1 @@
Copy "nfq" folder here !
Copy "nfq2" folder here !
+5693
View File
File diff suppressed because it is too large. Load diff
+5910
View File
File diff suppressed because it is too large. Load diff
+180 -46
View File
@@ -1,4 +1,6 @@
# zapret2 v0.1
## English
[Manual](manual.en.md)
## Зачем это нужно
@@ -7,8 +9,26 @@
VPN. Может использоваться для частичной прозрачной обфускации протоколов.
Проект нацелен прежде всего на маломощные embedded устройства - роутеры, работающие под OpenWrt. Поддерживаются
традиционные Linux-системы, FreeBSD, OpenBSD, Windows. В некоторых случаях возможна самостоятельная прикрутка
решения к различным прошивкам.
традиционные Linux-системы, FreeBSD, OpenBSD, Windows. MacOS не поддерживается и вряд ли будет по техническим причинам.
В некоторых случаях возможна самостоятельная прикрутка решения к различным прошивкам.
[Полный мануал](manual.md)
## Поддержать разработчика. Donations
Если вы считаете проект полезным и желаете поддержать разработку, направляйте ваши пожертвования на следующие адреса криптокошельков :
If you find this project useful and wish to donate here are crypto wallets :
USDT ERC `0x3d52Ce15B7Be734c53fc9526ECbAB8267b63d66E`
USDT TRC `TEzAAtn4VhndqEaAyuCM78xh5W2gCjwWEo`
BTC `bc1qhqew3mrvp47uk2vevt5sctp7p2x9m7m5kkchve`
ETH `0x3d52Ce15B7Be734c53fc9526ECbAB8267b63d66E`
## Чем это отличается от zapret1
@@ -24,25 +44,29 @@ zapret2 является дальнейшим развитием проекта
или хотя бы область , в которой их можно искать, плюс владеющий базовыми навыками программирования.
*nfqws2* оставляет в себе практически тот же функционал - распознавание протоколов, реассемблинг, дешифровка, управление профилями, хостлисты, ipset-ы, базовая фильтрация.
Но он полностью лишается возможностей самостоятельно воздействовать на трафик. Часть "дурения" переносится в скриптовой язык программирования LUA.
Но он полностью лишается возможностей самостоятельно воздействовать на трафик. Часть "дурения" переносится в скриптовой язык программирования Lua.
LUA код получает от C кода структурированное представление приходящих пакетов в виде дерева (диссекты), подобного тем, что вы видите в wireshark.
Lua код получает от C кода структурированное представление приходящих пакетов в виде дерева (диссекты), подобного тем, что вы видите в wireshark.
Туда же приходят результаты сборки или дешифровки частей некоторых протоколов (tls, quic).
С код предоставляет функции-хелперы, позволяющие отсылать пакеты, работать с двоичными данными, разбирать TLS, искать маркер-позции и т.д.
Имеется библиотека хелперов, написанных на LUA, а так же готовая библиотека программ атаки на DPI (стратегий), реализующая функции *nfqws1* в расширенном варианте
С код предоставляет функции-хелперы, позволяющие отсылать пакеты, работать с двоичными данными, разбирать TLS, искать маркер-позиции и т.д.
Имеется библиотека хелперов, написанных на Lua, а так же готовая библиотека программ атаки на DPI (стратегий), реализующая функции *nfqws1* в расширенном варианте
и с большей гибкостью.
Вы всегда сможете взять и дописать что-то свое. В этом и есть смысл, чтобы борьбой с DPI смог заняться любой, кто разбирается в пакетах.
Вы всегда сможете взять и дописать что-то свое. От мелкой частной кустомизации, которую бессмысленно зашивать намертво в C код, до полноценной desync функции.
В этом и есть смысл, чтобы борьбой с DPI смог заняться любой, кто разбирается в пакетах.
Мог "потыкать" его, проверить свои идеи. А потом поделиться с друзьями своим решением "одного клика".
zapret2 - инструмент для таких энтузиастов. Но это не готовое решение для чайников. Проект не ставит себе целью сделать все простым для всех.
Автор считает, что это невозможно в принципе по обьективным причинам.
Борьбой с DPI возможности zapret2 не ограничиваются. По сути это мультиплатформенный пакетный программируемый манипулятор.
Вы можете использовать его для генерации произвольного IPv4/IPv6 трафика, обфускации или шифрования имеющегося, построения нестандартных протоколов обмена через IP сети,
реализации собственных firewall или DPI систем.
## С чего начать
Хотелось бы избежать "талмуда" на главной странице. Поэтому начнем со способа запуска *nfqws2* и описания способов портирования стратегий *nfqws1* - как в *nfqws2* сделать то же самое, что можно было в *nfqws1*.
Когда вы поймете как это работает, вы можете посмотреть LUA код, находящийся "под капотом". Разобрать как он работает, попробовать написать что-то свое.
"талмуд" обязательно будет, как он есть у любых более-менее сложных проектов. Он нужен как справочник.
Хотелось бы избежать [талмуда](manual.md) на главной странице. Поэтому начнем со способа запуска *nfqws2* и описания способов портирования стратегий *nfqws1* - как в *nfqws2* сделать то же самое, что можно было в *nfqws1*.
Когда вы поймете как это работает, вы можете посмотреть Lua код, находящийся "под капотом". Разобрать как он работает, попробовать написать что-то свое, руководствуясь [талмудом](manual.md) как справочником.
### Механика обработки трафика
@@ -83,22 +107,22 @@ windivert вообще не отслеживает соединения. Поэ
Дальше под рутом нужно запустить *nfqws2* с параметрами командной строки. Они строятся примерно следующим образом :
```
nfqws2 --qnum 200 --debug --lua-init=@zapret-lib.lua --lua-init=@zapret-antidpi.lua \
nfqws2 --qnum=200 --debug --lua-init=@zapret-lib.lua --lua-init=@zapret-antidpi.lua \
--filter-tcp=80,443 --filter-l7=tls,http \
--payload=tls_client_hello --lua-desync=fake:blob=fake_default_tls:tcp_md5:tls_mod=rnd,rndsni,dupsid \
--payload=http_req --lua-desync=fake:blob=fake_default_http:tcp_md5 \
--payload=tls_client_hello,http_req --lua-desync=multisplit:pos=1:seqovl=5:seqovl_pattern=0x1603030000
```
Данный пример предполагает, что в той же директории находятся файлы `zapret-lib.lua` - библиотека хелперов на LUA и `zapret-antidpi.lua` - библиотека базовых стратегий.
`--lua-init` может содержать LUA код в виде строки. Так удобно писать простой код, например присвоить константу переменной, чтобы не создавать файлы ради этой мелочи.
Данный пример предполагает, что в той же директории находятся файлы `zapret-lib.lua` - библиотека хелперов на Lua и `zapret-antidpi.lua` - библиотека базовых стратегий.
`--lua-init` может содержать Lua код в виде строки. Так удобно писать простой код, например присвоить константу переменной, чтобы не создавать файлы ради этой мелочи.
Либо подцепляется файл, если значение параметра начинается с `@`. Код из `--lua-init` выполняется 1 раз при старте.
Далее указаны параметры `--lua-desync`. Они содержат имя LUA функции, вызываемой при обработке каждого пакета, проходящего через профиль мультистратегии.
Далее указаны параметры `--lua-desync`. Они содержат имя Lua функции, вызываемой при обработке каждого пакета, проходящего через профиль мультистратегии.
После двоеточия и через двоеточия следуют параметры для данной функции в формате `param[=value]`. В примере реализована стратегия
```
nfqws --qnum 200 --debug \
nfqws --qnum=200 --debug \
--filter-tcp=80,443 --filter-l7=tls,http \
--dpi-desync=fake,multisplit --dpi-desync-fooling=md5sig --dpi-desync-split-pos=1,midsld \
--dpi-desync-split-seqovl=5 --dpi-desync-split-seqovl-pattern=0x1603030000 \
@@ -110,19 +134,19 @@ nfqws --qnum 200 --debug \
Тип пейлоада - тип данных, содержащихся в пакете или группе пакетов. Например, протокол соединения может быть tls, а пейлоады - tls_client_hello, tls_server_hello, unknown.
Другое важное отличие - отсутствие жестко определенных фаз десинхронизации. То, что вы раньше писали как `fake,multisplit` реализуется двумя
последовательно вызываемыми LUA функциями. Их может быть столько, сколько нужно, учитывая логику прохождения пакетов и операций с ними, и у каждой могут быть свои параметры.
последовательно вызываемыми Lua функциями. Их может быть столько, сколько нужно, учитывая логику прохождения пакетов и операций с ними, и у каждой могут быть свои параметры.
Может даже несколько раз вызываться одна и так же функция с разными параметрами. Так, например, можно послать несколько фейков, причем с разными фулингами.
Конкретный вызов `--lua-desync` функции называется инстансом. Инстанс - это связка имени функции, номера вызова внутри профиля и номера самого профиля.
Это похоже на одну программу, которую можно запустить много раз с разными параметрами.
Другое немаловажное отличие - поддержка автоматической tcp сегментации. Вам больше не нужно думать о размерах отсылаемых tcp пакетов.
Другое немаловажное отличие - поддержка автоматической tcp сегментации средствами `zapret-lib.lua`. Вам больше не нужно думать о размерах отсылаемых tcp пакетов.
По каждому соединению отслеживается MSS. Если пакет не влезает в MSS, выполняется сегментация.
Например, это может случиться при отправке tls фейка с kyber. Или если вы режете kyber tls так, что одна из частей получается размером 1600 байт,
что, очевидно, не влезает в MTU. Или если вы задали seqovl=10000. В *nfqws1* такое значение вызвало бы ошибку. В *nfqws2* будет отправлено
что, очевидно, не влезает в MTU. Или если вы задали seqovl=10000. В *nfqws1* такое значение вызвало бы ошибку. Функция Lua `rawsend_dissect_segmented` отправит
несколько tcp сегментов с начальным sequence -10000 общим размером 10000 байт, в последнем из которых будет кусок оригинального сообщения.
В *nfqws2* нет жестко зашитых параметров кастомных фейков типа `--dpi-desync-fake-tls`, `dpi-desync-fake-http` и тд.
Вместо них есть блобы. Блоб (blob) - это переменная LUA типа *string*, содержащая блок двоичных данных произвольной длины. От 1 байта до гигабайтов.
Вместо них есть блобы. Блоб (blob) - это переменная Lua типа *string*, содержащая блок двоичных данных произвольной длины. От 1 байта до гигабайтов.
*nfqws2* автоматически инициализирует блобы со стандартными фейками tls, http, quic, как это и было в *nfqws1*.
Блобы могут быть заданы как hex-строка прямо в параметре desync функции, либо пред-загружены при старте с помощью параметра `--blob=name:0xHEX|[+ofs]@filename`
@@ -131,7 +155,7 @@ nfqws --qnum 200 --debug \
В *nfqws1* они падали на профиль с автолистом.
```
nfqws2 --qnum 200 --debug --lua-init=@zapret-lib.lua --lua-init=@zapret-antidpi.lua \
nfqws2 --qnum=200 --debug --lua-init=@zapret-lib.lua --lua-init=@zapret-antidpi.lua \
--filter-tcp=80 --filter-l7=http --hostlist=mylist1.txt --lua-desync=multisplit --new \
--filter-tcp=80 --filter-l7=http --hostlist-exclude=mylist2.txt --lua-desync=fake:blob=0x00000000:ip_ttl=5:ip6_ttl=3 --lua-desync=multidisorder:pos=5,endhost-1 --new \
--filter-tcp=443 --filter-l7=tls --hostlist=mylist1.txt --lua-desync=multidisorder
@@ -148,22 +172,22 @@ range задается как `mX-mY`, `mX<mY`, `-mY`, `<mY`, `mX-`.
Есть и режимы, не требущие числа - `a` - всегда, `x` - никогда.
Если разделителем указан знак '-' - конечная позиция включительна, а если '<' - не включительна.
Установка по умолчанию `--in-range=x --out-range=a --payload all`. То есть отсекаются все входящие пакеты и берутся все исходящие.
Установка по умолчанию `--in-range=x --out-range=a --payload=all`. То есть отсекаются все входящие пакеты и берутся все исходящие.
`--in-range`, `--out-range` и `--payload` фильтры могут присутствовать множественно в одном профиле.
Их действие распространяется на все последующие `--lua-desync` функции до следующего фильтра того же типа или до конца профиля.
Следующий профиль снова принимает значения по умолчанию.
Что будет, если вы не напишите фильтр `--payload` для fake или multisplit ? В *nfqws1* без `--dpi-desync-any-protocol` они работали только по известным пейлоадам.
В *nfqws2* "any protocol" - режим по умолчанию. Однако, функции из библиотеки `zapret-antidpi.lua` написаны так, что по умолчанию работают только по известные пейлоадам
В *nfqws2* "any protocol" - режим по умолчанию. Однако, функции из библиотеки `zapret-antidpi.lua` написаны так, что по умолчанию работают только по известным пейлоадам
и не работают по пустым пакетам или unknown - точно так же, как это было в *nfqws1*.
Но лучше все-же писать фильтры `--payload`, потому что они работают на уровне C кода, который выполняется существенно быстрее, чем LUA.
Но лучше все-же писать фильтры `--payload`, потому что они работают на уровне C кода, который выполняется существенно быстрее, чем Lua.
Диссект пакета проходит поочередно по всем `--lua-desync` инстансам профиля, для которых не выполняется условие отсечения (cutoff).
Отсечение может быть по range, payload или добровольное отсечение. Последний вариант - когда инстанс сам отказывается обрабатывать пакеты
по входящему, исходящему или обоим направлениям. Например, задача стратегии wsize - отреагировать только на пакет с tcp флагами SYN,ACK. После этого он не нужен, в коде вызывается функция отсечения.
Это сделано для экономии ресурсов процессора.
Если все инстансы в профиле точно никогда больше не будут вызваны по соединению + направлению - вошли в превышение верхней границы range или выполнили добровольный cutoff, то движок LUA не вызывается вообще.
Если все инстансы в профиле точно никогда больше не будут вызваны по соединению + направлению - вошли в превышение верхней границы range или выполнили добровольный cutoff, то движок Lua не вызывается вообще.
От инстанса к инстансу содержимое диссекта может ими меняться. Следующий инстанс видит изменения предыдущего.
Каждый инстанс выносит свой вердикт - что делать с текущим диссектом. VERDICT_PASS - означает отправить как есть,
@@ -229,7 +253,7 @@ nfqws \
nfqws2 \
--blob=tls_google:@tls_clienthello_google_com.bin \
--filter-l7=tls \
--payload tls_client_hello,http_req \
--payload=tls_client_hello,http_req \
--lua-desync=fakedsplit:pattern=tls_google:pos=method+2:nofake1:ip_ttl=1:ip6_ttl=1:ip_autottl=-1,3-20:ip6_autottl=-1,3-20
```
@@ -250,19 +274,19 @@ nfqws2 --lua-desync=wssize:wsize=1:scale=6 --lua-desync=syndata --lua-desync=mul
```
nfqws1 \
--filter-l7 tls \
--filter-l7=tls \
--dpi-desync=fake --dpi-desync-fooling=datanoack --dpi-desync-fake-tls=! \
--dpi-desync-fake-tls-mod=rnd,rndsni,dupsid
nfqws2
--filter-l7 tls \
--filter-l7=tls \
--payload=tls_client_hello --lua-desync=fake:blob=fake_default_tls:tcp_flags_unset=ack:tls_mod=rnd,rndsni,dupsid,padencap \
--payload=empty --out-range="s1<d1" --lua-desync=pktmod:ip_ttl=1:ip6_ttl=1
nfqws2 \
--lua-init="fake_default_tls=tls_mod(fake_default_tls,'rnd,rndsni')" \
--filter-l7 tls \
--filter-l7=tls \
--payload=tls_client_hello --lua-desync=fake:blob=fake_default_tls:tcp_flags_unset=ack:tls_mod=dupsid,padencap \
--payload=empty --out-range="s1<d1" --lua-desync=pktmod:ip_ttl=1:ip6_ttl=1
```
@@ -289,22 +313,21 @@ nfqws2 --lua-desync=send:ipfrag:ipfrag_pos_udp=8 --lua-desync=drop
Но это решаемо. А что не решаемо - это перехват вторых частей kyber tls hello. Их невозможно опознать без связи с предыдущими фрагментами. Поэтому перехватывается весь порт.
Для HTTP вопрос решаемый, поскольку там нет реассемблирования запросов, но http сейчас стал настолько редким, что и смысла нет заморачиваться.
Везде расставлены фильтры профиля мультистратегии `--filter-l7`, фильтры по `--out-range` и по `--payload`.
Зачем ? В основном для сокращения вызовов LUA кода, который заведомо медленнее C кода.
Если пакет не попадет в профили с LUA - ни о каком вызове кода LUA речи быть не может.
Если пакет попал в профиль с LUA, то после первых 10 пакетов с данными наступает отсечение по верхней границе range. Все LUA инстансы входят в состояние instance cutoff,
соединение входит в состояние "lua cutoff" по направлению "out". Значит вызовов LUA не будет вообще. Не просто вызовов, а даже обращения к движку LUA
с какой-либо целью. Будет только C код, который посмотрит на признак "cutoff" и сразу же отпустит пакет.
Везде расставлены фильтры профиля мультистратегии `--filter-l7`, фильтры по `--out-range` и по `--payload`. Зачем ? В основном для сокращения вызовов Lua кода, который заведомо медленнее C кода.
Если пакет не попадет в профили с Lua - ни о каком вызове кода Lua речи быть не может. Если пакет попал в профиль с Lua, то после первых 10 пакетов с данными наступает отсечение по верхней границе range. Все Lua инстансы входят в состояние instance cutoff, соединение входит в состояние "lua cutoff" по направлению "out". Значит вызовов Lua не будет вообще. Не просто вызовов, а даже обращения к движку Lua с какой-либо целью. Будет только C код, который посмотрит на признак "cutoff" и сразу же отпустит пакет.
Так же везде расставлены фильтры по payload type. Отчасти так же с целью сократить вызовы LUA даже в пределах первых 10 пакетов с данными.
Почему именно `-d10` ? Чтобы хватило для отработки большинства вариантов стратегий, учитывая возможные ретрансмиссии и плохую связь. В winws2 по умолчанию включен параметр `--wf-tcp-empty=0`. Он блокирует перехват пустых пакетов с ACK, что позволяет примерно в 2 раза сэкономить на процессоре при интенсивных скачиваниях. Пустые ACK в большинстве стратегий не нужны. Но это же и ломает счетчик "n" - он не будет показывать реальное количество пакетов по соединению. Счетчик "d" работать будет как надо.
Почему нет "-d10" на udp ? Потому что используется windivert фильтр на пейлоад. Счетчики будут считать не реальное количество пакетов в потоке, а количество перехваченных с отфильтрованными пейлоадами. Причем если интервал между ними будет более 1 минуты, то счет будет начинаться заново, поскольку таймаут udp по умолчанию - 60 сек. После таймаута запись conntrack будет удалена. Следующий пакет пойдет как новый поток.
Так же везде расставлены фильтры по payload type. Отчасти так же с целью сократить вызовы Lua даже в пределах первых 10 пакетов с данными.
С другой стороны, даже при совпадении протокола соединения (`--filter-l7`) может пробежать не интересующий нас пейлоад.
По умолчанию многие функции из `zapret-antidpi.lua` реагируют только на известные типы пейлоада, но не на конкретные, а на любые известные.
Если допустить малореальный, но гипотетически возможный сценарий, что в рамках протокола http будет отправлен блок данных с tls или фраза, похожая на сообщение из xmpp,
то тип пейлоада выскочит tls_client_hello или xmpp_stream, например. Лучше от этого сразу уберечься. Тем более что в других видах протоколов - xmpp, например, -
Если допустить малореальный, но гипотетически возможный сценарий, что в рамках протокола http будет отправлен блок данных с tls или фраза, похожая на сообщение из xmpp, то тип пейлоада выскочит tls_client_hello или xmpp_stream, например. Лучше от этого сразу уберечься. Тем более что в других видах протоколов - xmpp, например, -
пейлоады могут проскакивать нескольких типов вполне ожидаемо. Но работать надо не по всем.
В фейке для TLS по умолчанию - fake_default_tls - однократно при старте меняется SNI с "www.microsoft.com" на случайный и рандомизируется поле "random" в TLS handshake.
Это делается простой строчкой LUA кода. Больше нет никаких специальных параметров *nfqws2* для модификации пейлоадов.
Это делается простой строчкой Lua кода. Больше нет никаких специальных параметров *nfqws2* для модификации пейлоадов.
В профиле для youtube на лету меняется SNI на "www.google.com", копируется поле TLS "session id" с обрабатываемого в данный момент TLS handshake.
```
@@ -350,28 +373,139 @@ start "zapret: http,https,quic" /min "%~dp0winws2.exe" ^
--lua-desync=multidisorder:pos=midsld ^
--new ^
--filter-udp=443 --filter-l7=quic --hostlist="%~dp0files\list-youtube.txt" ^
--out-range=-d10 ^
--payload=quic_initial ^
--lua-desync=fake:blob=quic_google:repeats=11 ^
--new ^
--filter-udp=443 --filter-l7=quic ^
--out-range=-d10 ^
--payload=quic_initial ^
--lua-desync=fake:blob=fake_default_quic:repeats=11 ^
--new ^
--filter-l7=wireguard,stun,discord ^
--out-range=-d10 ^
--payload=wireguard_initiation,wireguard_cookie,stun_binding_req,discord_ip_discovery ^
--payload=wireguard_initiation,wireguard_cookie,stun,discord_ip_discovery ^
--lua-desync=fake:blob=0x00000000000000000000000000000000:repeats=2
```
И напоследок стоит продемонстрировать как делаются нестандартные вещи. То, что очень непросто запрограммировать в чисто описательном виде
в фиксированном коде, не превращая программу в монстро-комбайн, перегруженный частными функциями и разваливающийся под своей тяжестью со временем,
когда эти частные функции перестают быть нужны и забываются.
Надо послать исходный запрос с известным пейлоадом с seqovl случайного размера от 5 до 10 символов со случайным содержимым, состоящим из букв от ‘a’ до ‘z’.
Здесь раскрывается не декларативный характер стратегий, а алгоритмический. Стратегия - это программа, и пишите ее вы на языке программирования.
Для облегчения простых или стандартных действий есть готовые средства, так что далеко не всегда надо писать свою функцию.
Частенько можно обойтись простенькими кусками Lua кода в дополнение к имеющимся.
Здесь используется функция `luaexec`, предназначенная для динамического выполнения Lua кода в процессе обработки текущего диссекта.
Она инициализирует требуемый blob, записывая его в таблицу desync, которая передается от инстанса к инстансу.
Следующий инстанс `tcpseg` использует `rnd` как blob - источник seqovl паттерна.
Символы `%` и `#` используются для разименования блобов и подстановки их размера соответственно. Реализовано на уровне C кода.
desync функция получает уже подставленные значения. В данном случае seqovl устанавливается как размер сгенерированного блоба.
Функция `tcpseg` предназначена для отсылки tcp сегмента - части текущего пейлоада (или реасма - сборки нескольких пакетов, например в случае tls kyber).
`pos=0,-1` - это диапазон, состоящий из двух маркеров - начала и конца. 0 - положительный абсолютный маркер, соответствующий началу пакета.
-1 - отрицательный абсолютный маркер, соответствующий концу пакета. Получается, мы отсылаем целиком текущий пейлоад, но с seqovl.
`tcpseg` не дропает пакет. Его надо дропнуть отдельно. По умолчанию `tcpseg` работает только с известными пейлоадами, а функция `drop` - с любыми.
Поэтому нужно ей указать дропать только известные пейлоады.
Такая связка из 3 инстансов решает поставленную задачу без кучи частных параметров вида `--dpi-desync...`.
```
nfqws2 \
--lua-desync=luaexec:code='desync.rnd=brandom_az(math.random(5,10))' \
--lua-desync=tcpseg:pos=0,-1:seqovl=#rnd:seqovl_pattern=rnd \
--lua-desync=drop:payload=known
```
### Какие есть еще параметры
Как узнать какие есть еще функции и какие у них бывают параметры ? Смотрите `zapret-antidpi.lua`. Перед каждой функцией подробно описано какие параметры она берет.
Описание стандартных блоков параметров есть в начале. Позже - по мере сил и возможностей - будет писаться талмуд - справочник с руководством по программированию
*nfqws2* и описание стандартных библиотек.
Описание стандартных блоков параметров есть в начале.
Или сразу читайте [талмуд](manual.md) . Там все документировано.
### Очень важный совет
Научитесь пользоваться `--debug` логом. Без него будет очень сложно понять *nfqws2* на начальном этапе и приспособиться к новой схеме.
Ошибок будет много. Особенно, когда вы начнете писать свой LUA код. Их надо читать.
Ошибок будет много. Особенно, когда вы начнете писать свой Lua код. Их надо читать.
### Не только лишь автономный обман DPI
Рабочий тестовый пример icmp обфускатора udp от винды к серверу на vps.
Для теста используем wireguard. Ничего в конфигах менять не надо - wireguard будет думать, что он работает по udp, но на самом деле он преобразуется в пинги icmp, которые могут проходить NAT.
Если NAT не меняет поле Identifier в icmp (типично для Linux NAT), можно использовать легкий stateless вариант, когда размер пакета не меняется, и он с гарантией влезает в MTU.
Провайдерский CGNAT меняет Identifier. Для его поддержки существует параметр udp2icmp `cgnat`. Клиент увеличит размеры исходящих пакетов на 2 байта, поэтому нужно предварительно
уменьшить MTU интерфейса wireguard на 2, если он выбран "под завязку". В режиме cgnat серверный конец будет вести базу измененных идентификаторов и сохранять их при ответе.
Обычно на CGNAT время жизни icmp identifier небольшое - 30 секунд, но может быть еще меньше, и освежаться может только исходящими пакетами. Поэтому нужен частый keepalive со стороны клиента.
Если этого не сделать, будет обрыв до момента, когда wireguard клиент что-либо пошлет. Некоторые операторы троттлят icmp, поэтому могут быть проблемы со скоростью.
Будем загонять исходящие с клиента в icmp type 8 (echo request) code 199 , исходящие с сервера в icmp type 0 (echo reply) code 199.
Код у обоих концов делаем одинаковый, иначе NAT не соотнесет. Без NAT можно коды делать разными для клиента и сервера.
Особый icmp code нужен для фильтрации от обычных пингов.
По стандарту код должен быть 0, но на практике с большой вероятностью работают любые коды.
Разные имплементации NAT теоретически могут фильтровать ненулевой код, соотносить или не соотносить код вместе с identifier. Linux NAT соотносит.
При любых проблемах убираем wireguard, ставим netcat с обоих концов и пробуем общаться, посматривая в wireshark.
Всегда можно откатиться на нулевой код, но тогда у сервера без фильтра по IP клиента будет плохая защита от обычных пингов - все они будут преобразовываться в udp и направляться в wireguard,
который будет их игнорировать, поскольку передается мусор. Сервер перестанет пингаться.
Другой способ избежать проблемы и уйти от стандартных пингов - использовать другие типы icmp. Работающие пары, пробрасываемые Linux NAT :
- `ctype=8:stype=0` - echo request - echo reply (используется по умолчанию)
- `ctype=13:stype=14` - timestamp - timestamp reply
- `ctype=15:stype=16` - information request - information reply
- `ctype=17:stype=18` - address mask request - address mask reply
На провайдерских NAT или на аппаратном ускорении роутера может быть другой расклад по работающим парам.
Нужно пробовать и смотреть что выходит в сеть после NAT и что приходит на сервер.
Например, Linux NAT вообще не пробрасывает type 42 - extended echo request. Но аппаратная железка может пробросить и провайдер тоже.
Кто знает, может быть DPI настроен сечь icmp тоннели на стандартных пингах, а на других типах icmp нет ?
wireguard server - `1.2.3.4:5555`
```
table ip ztest {
chain post {
type filter hook output priority mangle; policy accept;
meta mark & 0x40000000 == 0x00000000 udp sport 5555 queue flags bypass to 200
}
chain pre {
type filter hook input priority mangle; policy accept;
meta mark & 0x40000000 == 0x00000000 icmp type echo-request icmp code 199 queue flags bypass to 200
}
}
```
```
nfqws2 --qnum=200 --server
--lua-init=@/opt/zapret2/lua/zapret-lib.lua
--lua-init=@/opt/zapret2/lua/zapret-obfs.lua
--in-range=a
--lua-desync=udp2icmp:ccode=199:scode=199
```
Клиент на винде :
```
winws2
--wf-icmp-in=0:199 --wf-udp-out=5555
--wf-raw-filter="ip.SrcAddr=1.2.3.4 or ip.DstAddr=1.2.3.4"
--lua-init=@lua/zapret-lib.lua
--lua-init=@lua/zapret-obfs.lua
--in-range=a
--lua-desync=udp2icmp:ccode=199:scode=199
```
Все лишнее отсекается в ядре в windivert - проц зазря не грузит.
--wf-raw-filter сочетается со всем остальным собранным конструктором по AND. Отсекает по IP адресу сервера.
--wf-icmp-in отсекает входящие icmp типа 0 с кодом 199.
И включаем wireguard.
В шарке сплошняком пинги и реплаи с кодом 199
Если IP клиента постоянен, можно дополнительно на стороне сервера сделать фильтр по IP клиента.
Дополнительно можно сделать dataxor=blob на обоих концах, чтобы поксорить пейлоад.
blob растягивается на размер пакета как pattern. Можно использовать от 1 hex byte до специально нагенеренного рандома. На обоих концах должен быть одинаковый
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
OPTIONS rtsp://10.2.2.2:8554/ RTSP/1.0
CSeq: 2
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)
File renamed without changes.
+1
View File
@@ -0,0 +1 @@
EHLO delta.peach.mil
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,22 @@
# This script fixes keenetic issue with nfqws generated udp packets
# Keenetic uses proprietary ndmmark and does not masquerade without this mark
# If not masqueraded packets go to WAN with LAN IP and get dropped by ISP
# It's advised to set IFACE_WAN in config
zapret_custom_firewall()
{
# $1 - 1 - add, 0 - stop
local wan wanif rule
[ "$DISABLE_IPV4" = "1" ] || {
# use IFACE_WAN if defined. if not - search for interfaces with default route.
wanif=${IFACE_WAN:-$(sed -nre 's/^([^\t]+)\t00000000\t[0-9A-F]{8}\t[0-9A-F]{4}\t[0-9]+\t[0-9]+\t[0-9]+\t00000000.*$/\1/p' /proc/net/route | sort -u | xargs)}
for wan in $wanif; do
rule="-o $wan -p udp -m mark --mark $DESYNC_MARK/$DESYNC_MARK"
ipt_print_op $1 "$rule" "keenetic udp fix"
ipt_add_del $1 POSTROUTING -t nat $rule -j MASQUERADE
done
}
}
@@ -0,0 +1,53 @@
# this custom script runs standard mode with extra firewall rules
# config: use NFQWS2_ENABLE_OVERRIDE to enable standard mode daemons
# standard and override switches cannot be enabled simultaneously !
NFQWS2_ENABLE_OVERRIDE=${NFQWS2_ENABLE_OVERRIDE:-0}
# config: some if these values must be set in config. not setting any of these makes this script meaningless.
# pre vars put ipt/nft code to the rule beginning
#FW_EXTRA_PRE_NFQWS2_IPT="-m mark --mark 0x10000000/0x10000000"
#FW_EXTRA_PRE_NFQWS2_NFT="mark and 0x10000000 != 0"
# post vars put ipt/nft code to the rule end
#FW_EXTRA_POST_NFQWS2_IPT=
#FW_EXTRA_POST_NFQWS2_NFT=
check_std_intersect()
{
[ "$NFQWS2_ENABLE_OVERRIDE" = 1 -a "$NFQWS2_ENABLE" = 1 ] && {
echo "ERROR ! both NFQWS2_ENABLE_OVERRIDE and NFQWS2_ENABLE are enabled"
return 1
}
return 0
}
zapret_custom_daemons()
{
# $1 - 1 - add, 0 - stop
check_std_intersect || return
local NFQWS2_ENABLE=$NFQWS2_ENABLE_OVERRIDE
standard_mode_daemons "$1"
}
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
check_std_intersect || return
local FW_EXTRA_PRE FW_EXTRA_POST NFQWS2_ENABLE=$NFQWS2_ENABLE_OVERRIDE
FW_EXTRA_PRE="$FW_EXTRA_PRE_NFQWS2_IPT" FW_EXTRA_POST="$FW_EXTRA_POST_NFQWS2_IPT"
zapret_do_firewall_standard_nfqws_rules_ipt $1
}
zapret_custom_firewall_nft()
{
# stop logic is not required
check_std_intersect || return
local FW_EXTRA_PRE FW_EXTRA_POST NFQWS2_ENABLE=$NFQWS2_ENABLE_OVERRIDE
FW_EXTRA_PRE="$FW_EXTRA_PRE_NFQWS2_NFT" FW_EXTRA_POST="$FW_EXTRA_POST_NFQWS2_NFT"
zapret_apply_firewall_standard_nfqws_rules_nft
}
@@ -0,0 +1,39 @@
# this custom script runs nfqws2 in server mode for typical webserver
WEBSERVER_DEFAULT_STRATEGY="
--server
--payload=http_reply,tls_server_hello --lua-desync=fake:blob=0x00000000000000000000000000000000:badsum:repeats=2 --lua-desync=multisplit
--payload=empty --lua-desync=synack_split"
# can override in config :
NFQWS_OPT_DESYNC_WEBSERVER="${NFQWS_OPT_DESYNC_WEBSERVER:-$WEBSERVER_DEFAULT_STRATEGY}"
WEBSERVER_PORTS="${WEBSERVER_PORTS:-80,443}"
WEBSERVER_PKT_OUT="${WEBSERVER_PKT_OUT:-15}"
alloc_dnum DNUM_WEBSERVER
alloc_qnum QNUM_WEBSERVER
zapret_custom_daemons()
{
# $1 - 1 - add, 0 - stop
local opt="--qnum=$QNUM_WEBSERVER $NFQWS_OPT_DESYNC_WEBSERVER"
do_nfqws $1 $DNUM_WEBSERVER "$opt"
}
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
local PORTS=$(replace_char - : $WEBSERVER_PORTS)
local first_packets=$(ipt_first_packets $WEBSERVER_PKT_OUT)
local f="-p tcp -m multiport --sports $PORTS $first_packets"
fw_nfqws_post $1 "$f" "$f" $QNUM_WEBSERVER
}
zapret_custom_firewall_nft()
{
# stop logic is not required
local first_packets=$(nft_first_packets $WEBSERVER_PKT_OUT)
local f="tcp sport {$WEBSERVER_PORTS} $first_packets"
nft_fw_nfqws_post "$f" "$f" $QNUM_WEBSERVER
}
+40
View File
@@ -0,0 +1,40 @@
# this custom script runs desync to DHT packets with udp payload length >=5 , without ipset/hostlist filtering
# NOTE: @ih requires nft 1.0.1+ and updated kernel version. it's confirmed to work on 5.15 (openwrt 23) and not work on 5.10 (openwrt 22)
# can override in config :
NFQWS_OPT_DESYNC_DHT="${NFQWS_OPT_DESYNC_DHT:---payload=dht --lua-desync=dht_dn}"
# set it to "keepalive" to fool all packets, not just the first. or set number of packets to be fooled.
NFQWS_OPT_DHT_PKT_OUT=${NFQWS_OPT_DHT_PKT_OUT:-20}
alloc_dnum DNUM_DHT4ALL
alloc_qnum QNUM_DHT4ALL
zapret_custom_daemons()
{
# $1 - 1 - add, 0 - stop
local opt="--qnum=$QNUM_DHT4ALL $NFQWS_OPT_DESYNC_DHT"
do_nfqws $1 $DNUM_DHT4ALL "$opt"
}
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
local f uf4 uf6
local first_packet_only=$(ipt_first_packets $NFQWS_OPT_DHT_PKT_OUT)
f='-p udp -m u32 --u32'
uf4='0>>22&0x3C@4>>16=13:0xFFFF&&0>>22&0x3C@8>>16=0x6431:0x6432'
uf6='44>>16=13:0xFFFF&&48>>16=0x6431:0x6432'
fw_nfqws_post $1 "$f $uf4 $first_packet_only" "$f $uf6 $first_packet_only" $QNUM_DHT4ALL
}
zapret_custom_firewall_nft()
{
# stop logic is not required
local f
local first_packet_only=$(nft_first_packets $NFQWS_OPT_DHT_PKT_OUT)
f="udp length ge 13 meta l4proto udp @ih,0,16 0x6431-0x6432"
nft_fw_nfqws_post "$f $first_packet_only" "$f $first_packet_only" $QNUM_DHT4ALL
}
@@ -0,0 +1,35 @@
# this custom script runs desync to all discord media packets
# NOTE: @ih requires nft 1.0.1+ and updated kernel version. it's confirmed to work on 5.15 (openwrt 23) and not work on 5.10 (openwrt 22)
# can override in config :
NFQWS_OPT_DESYNC_DISCORD_MEDIA="${NFQWS_OPT_DESYNC_DISCORD_MEDIA:---payload=discord_ip_discovery --lua-desync=fake:blob=0x00000000000000000000000000000000:repeats=2}"
DISCORD_MEDIA_PORT_RANGE="${DISCORD_MEDIA_PORT_RANGE:-50000-50099,19294-19344}"
alloc_dnum DNUM_DISCORD_MEDIA
alloc_qnum QNUM_DISCORD_MEDIA
zapret_custom_daemons()
{
# $1 - 1 - add, 0 - stop
local opt="--qnum=$QNUM_DISCORD_MEDIA $NFQWS_OPT_DESYNC_DISCORD_MEDIA"
do_nfqws $1 $DNUM_DISCORD_MEDIA "$opt"
}
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
local DISABLE_IPV6=1
local port_range=$(replace_char - : $DISCORD_MEDIA_PORT_RANGE)
local f="-p udp -m multiport --dports $port_range -m u32 --u32"
# this is simplified test to skip writing monstrous rule. instead of checking 64 bytes for zeroes only check 2 dwords for zero
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=0x52&&0>>22&0x3C@8=0x00010046&&0>>22&0x3C@16=0&&0>>22&0x3C@76=0" '' $QNUM_DISCORD_MEDIA
}
zapret_custom_firewall_nft()
{
# stop logic is not required
local DISABLE_IPV6=1
local f="udp dport {$DISCORD_MEDIA_PORT_RANGE} udp length == 82 @ih,0,32 0x00010046 @ih,64,128 0x00000000000000000000000000000000 @ih,192,128 0x00000000000000000000000000000000 @ih,320,128 0x00000000000000000000000000000000 @ih,448,128 0x00000000000000000000000000000000"
nft_fw_nfqws_post "$f" '' $QNUM_DISCORD_MEDIA
}
@@ -0,0 +1,144 @@
# this custom script demonstrates how to launch extra nfqws instance limited by ipset
# can override in config :
NFQWS2_MY1_OPT="${NFQWS2_MY1_OPT:---filter-udp=* --payload=known,unknown --lua-desync=fake:blob=0x00000000000000000000000000000000:repeats=2:payload=all --new --filter-tcp=* --payload=known,unknown --lua-desync=multisplit}"
NFQWS2_MY1_SUBNETS4="${NFQWS2_MY1_SUBNETS4:-173.194.0.0/16 108.177.0.0/17 74.125.0.0/16 64.233.160.0/19 172.217.0.0/16}"
NFQWS2_MY1_SUBNETS6="${NFQWS2_MY1_SUBNETS6:-2a00:1450::/29}"
NFQWS2_MY1_PORTS_TCP=${NFQWS2_MY1_PORTS_TCP:-$NFQWS2_PORTS_TCP}
NFQWS2_MY1_PORTS_UDP=${NFQWS2_MY1_PORTS_UDP:-$NFQWS2_PORTS_UDP}
NFQWS2_MY1_TCP_PKT_OUT=${NFQWS2_MY1_TCP_PKT_OUT:-$NFQWS2_TCP_PKT_OUT}
NFQWS2_MY1_UDP_PKT_OUT=${NFQWS2_MY1_UDP_PKT_OUT:-$NFQWS2_UDP_PKT_OUT}
NFQWS2_MY1_TCP_PKT_IN=${NFQWS2_MY1_TCP_PKT_IN:-$NFQWS2_TCP_PKT_IN}
NFQWS2_MY1_UDP_PKT_IN=${NFQWS2_MY1_UDP_PKT_IN:-$NFQWS2_UDP_PKT_IN}
NFQWS2_MY1_IPSET_SIZE=${NFQWS2_MY1_IPSET_SIZE:-4096}
NFQWS2_MY1_IPSET_OPT="${NFQWS2_MY1_IPSET_OPT:-hash:net hashsize 8192 maxelem $NFQWS2_MY1_IPSET_SIZE}"
alloc_dnum DNUM_NFQWS2_MY1
alloc_qnum QNUM_NFQWS2_MY1
NFQWS2_MY1_NAME4=my1nfqws4
NFQWS2_MY1_NAME6=my1nfqws6
zapret_custom_daemons()
{
# $1 - 1 - run, 0 - stop
local opt="--qnum=$QNUM_NFQWS2_MY1 $NFQWS2_MY1_OPT"
do_nfqws $1 $DNUM_NFQWS2_MY1 "$opt"
}
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
local f4 f6 subnet
local NFQWS2_MY1_PORTS_TCP=$(replace_char - : $NFQWS2_MY1_PORTS_TCP)
local NFQWS2_MY1_PORTS_UDP=$(replace_char - : $NFQWS2_MY1_PORTS_UDP)
[ "$1" = 1 -a "$DISABLE_IPV4" != 1 ] && {
ipset create $NFQWS2_MY1_NAME4 $NFQWS2_MY1_IPSET_OPT family inet 2>/dev/null
ipset flush $NFQWS2_MY1_NAME4
for subnet in $NFQWS2_MY1_SUBNETS4; do
echo add $NFQWS2_MY1_NAME4 $subnet
done | ipset -! restore
}
[ "$1" = 1 -a "$DISABLE_IPV6" != 1 ] && {
ipset create $NFQWS2_MY1_NAME6 $NFQWS2_MY1_IPSET_OPT family inet6 2>/dev/null
ipset flush $NFQWS2_MY1_NAME6
for subnet in $NFQWS2_MY1_SUBNETS6; do
echo add $NFQWS2_MY1_NAME6 $subnet
done | ipset -! restore
}
[ -n "$NFQWS2_MY1_PORTS_TCP" ] && {
[ -n "$NFQWS2_MY1_TCP_PKT_OUT" -a "$NFQWS2_MY1_TCP_PKT_OUT" != 0 ] && {
f4="-p tcp -m multiport --dports $NFQWS2_MY1_PORTS_TCP $ipt_connbytes 1:$NFQWS2_MY1_TCP_PKT_OUT -m set --match-set"
f6="$f4 $NFQWS2_MY1_NAME6 dst"
f4="$f4 $NFQWS2_MY1_NAME4 dst"
fw_nfqws_post $1 "$f4" "$f6" $QNUM_NFQWS2_MY1
}
[ -n "$NFQWS2_MY1_TCP_PKT_IN" -a "$NFQWS2_MY1_TCP_PKT_IN" != 0 ] && {
f4="-p tcp -m multiport --sports $NFQWS2_MY1_PORTS_TCP $ipt_connbytes 1:$NFQWS2_MY1_TCP_PKT_IN -m set --match-set"
f6="$f4 $NFQWS2_MY1_NAME6 src"
f4="$f4 $NFQWS2_MY1_NAME4 src"
fw_nfqws_pre $1 "$f4" "$f6" $QNUM_NFQWS2_MY1
}
}
[ -n "$NFQWS2_MY1_PORTS_UDP" ] && {
[ -n "$NFQWS2_MY1_UDP_PKT_OUT" -a "$NFQWS2_MY1_UDP_PKT_OUT" != 0 ] && {
f4="-p udp -m multiport --dports $NFQWS2_MY1_PORTS_UDP $ipt_connbytes 1:$NFQWS2_MY1_UDP_PKT_OUT -m set --match-set"
f6="$f4 $NFQWS2_MY1_NAME6 dst"
f4="$f4 $NFQWS2_MY1_NAME4 dst"
fw_nfqws_post $1 "$f4" "$f6" $QNUM_NFQWS2_MY1
}
[ -n "$NFQWS2_MY1_UDP_PKT_IN" -a "$NFQWS2_MY1_UDP_PKT_IN" != 0 ] && {
f4="-p udp -m multiport --sports $NFQWS2_MY1_PORTS_UDP $ipt_connbytes 1:$NFQWS2_MY1_UDP_PKT_IN -m set --match-set"
f6="$f4 $NFQWS2_MY1_NAME6 src"
f4="$f4 $NFQWS2_MY1_NAME4 src"
fw_nfqws_pre $1 "$f4" "$f6" $QNUM_NFQWS2_MY1
}
}
[ "$1" = 1 ] || {
ipset destroy $NFQWS2_MY1_NAME4 2>/dev/null
ipset destroy $NFQWS2_MY1_NAME6 2>/dev/null
}
}
zapret_custom_firewall_nft()
{
local f4 f6 subnets
local first_packets_only="$nft_connbytes 1-$NFQWS2_MY1_PKT_OUT"
[ "$DISABLE_IPV4" != 1 ] && {
make_comma_list subnets $NFQWS2_MY1_SUBNETS4
nft_create_set $NFQWS2_MY1_NAME4 "type ipv4_addr; size $NFQWS2_MY1_IPSET_SIZE; auto-merge; flags interval;"
nft_flush_set $NFQWS2_MY1_NAME4
nft_add_set_element $NFQWS2_MY1_NAME4 "$subnets"
}
[ "$DISABLE_IPV6" != 1 ] && {
make_comma_list subnets $NFQWS2_MY1_SUBNETS6
nft_create_set $NFQWS2_MY1_NAME6 "type ipv6_addr; size $NFQWS2_MY1_IPSET_SIZE; auto-merge; flags interval;"
nft_flush_set $NFQWS2_MY1_NAME6
nft_add_set_element $NFQWS2_MY1_NAME6 "$subnets"
}
[ -n "$NFQWS2_MY1_PORTS_TCP" ] && {
[ -n "$NFQWS2_MY1_TCP_PKT_OUT" -a "$NFQWS2_MY1_TCP_PKT_OUT" != 0 ] && {
f4="tcp dport {$NFQWS2_MY1_PORTS_TCP} $(nft_first_packets $NFQWS2_MY1_TCP_PKT_OUT)"
f6="$f4 ip6 daddr @$NFQWS2_MY1_NAME6"
f4="$f4 ip daddr @$NFQWS2_MY1_NAME4"
nft_fw_nfqws_post $1 "$f4" "$f6" $QNUM_NFQWS2_MY1
}
[ -n "$NFQWS2_MY1_TCP_PKT_IN" -a "$NFQWS2_MY1_TCP_PKT_IN" != 0 ] && {
f4="tcp sport {$NFQWS2_MY1_PORTS_TCP} $(nft_first_packets $NFQWS2_MY1_TCP_PKT_IN)"
f6="$f4 ip6 saddr @$NFQWS2_MY1_NAME6"
f4="$f4 ip saddr @$NFQWS2_MY1_NAME4"
nft_fw_nfqws_pre $1 "$f4" "$f6" $QNUM_NFQWS2_MY1
}
}
[ -n "$NFQWS2_MY1_PORTS_UDP" ] && {
[ -n "$NFQWS2_MY1_UDP_PKT_OUT" -a "$NFQWS2_MY1_UDP_PKT_OUT" != 0 ] && {
f4="udp dport {$NFQWS2_MY1_PORTS_UDP} $(nft_first_packets $NFQWS2_MY1_UDP_PKT_OUT)"
f6="$f4 ip6 daddr @$NFQWS2_MY1_NAME6"
f4="$f4 ip daddr @$NFQWS2_MY1_NAME4"
nft_fw_nfqws_post $1 "$f4" "$f6" $QNUM_NFQWS2_MY1
}
[ -n "$NFQWS2_MY1_UDP_PKT_IN" -a "$NFQWS2_MY1_UDP_PKT_IN" != 0 ] && {
f4="udp sport {$NFQWS2_MY1_PORTS_UDP} $(nft_first_packets $NFQWS2_MY1_UDP_PKT_IN)"
f6="$f4 ip6 saddr @$NFQWS2_MY1_NAME6"
f4="$f4 ip saddr @$NFQWS2_MY1_NAME4"
nft_fw_nfqws_pre $1 "$f4" "$f6" $QNUM_NFQWS2_MY1
}
}
}
zapret_custom_firewall_nft_flush()
{
# this function is called after all nft fw rules are deleted
# however sets are not deleted. it's desired to clear sets here.
nft_del_set $NFQWS2_MY1_NAME4 2>/dev/null
nft_del_set $NFQWS2_MY1_NAME6 2>/dev/null
}
@@ -0,0 +1,30 @@
# this custom script runs desync to all IETF QUIC initials
# NOTE: @ih requires nft 1.0.1+ and updated kernel version. it's confirmed to work on 5.15 (openwrt 23) and not work on 5.10 (openwrt 22)
# can override in config :
NFQWS_OPT_DESYNC_QUIC="${NFQWS_OPT_DESYNC_QUIC:---payload=quic_initial --lua-desync=fake:blob=fake_default_quic:repeats=2}"
alloc_dnum DNUM_QUIC4ALL
alloc_qnum QNUM_QUIC4ALL
zapret_custom_daemons()
{
# $1 - 1 - add, 0 - stop
local opt="--qnum=$QNUM_QUIC4ALL $NFQWS_OPT_DESYNC_QUIC"
do_nfqws $1 $DNUM_QUIC4ALL "$opt"
}
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
local f='-p udp -m u32 --u32'
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=264:65535&&0>>22&0x3C@8>>28=0xC&&0>>22&0x3C@9=0x00000001" "$f 44>>16=264:65535&&48>>28=0xC&&49=0x00000001" $QNUM_QUIC4ALL
}
zapret_custom_firewall_nft()
{
# stop logic is not required
local f="udp length >= 264 @ih,0,4 0xC @ih,8,32 0x00000001"
nft_fw_nfqws_post "$f" "$f" $QNUM_QUIC4ALL
}
@@ -0,0 +1,30 @@
# this custom script runs desync to all stun packets
# NOTE: @ih requires nft 1.0.1+ and updated kernel version. it's confirmed to work on 5.15 (openwrt 23) and not work on 5.10 (openwrt 22)
# can override in config :
NFQWS_OPT_DESYNC_STUN="${NFQWS_OPT_DESYNC_STUN:---payload=stun --lua-desync=fake:blob=0x00000000000000000000000000000000:repeats=2}"
alloc_dnum DNUM_STUN4ALL
alloc_qnum QNUM_STUN4ALL
zapret_custom_daemons()
{
# $1 - 1 - add, 0 - stop
local opt="--qnum=$QNUM_STUN4ALL $NFQWS_OPT_DESYNC_STUN"
do_nfqws $1 $DNUM_STUN4ALL "$opt"
}
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
local f='-p udp -m u32 --u32'
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=28:65535&&0>>22&0x3C@12=0x2112A442&&0>>22&0x3C@8&0xC0000003=0" "$f 44>>16=28:65535&&52=0x2112A442&&48&0xC0000003=0" $QNUM_STUN4ALL
}
zapret_custom_firewall_nft()
{
# stop logic is not required
local f="udp length >= 28 @ih,32,32 0x2112A442 @ih,0,2 0 @ih,30,2 0"
nft_fw_nfqws_post "$f" "$f" $QNUM_STUN4ALL
}
+38
View File
@@ -0,0 +1,38 @@
# this custom script runs desync to all wireguard handshake initiation, response and cookie packets
# NOTE: this works for original wireguard and may not work for 3rd party implementations such as xray
# NOTE: @ih requires nft 1.0.1+ and updated kernel version. it's confirmed to work on 5.15 (openwrt 23) and not work on 5.10 (openwrt 22)
# can override in config :
NFQWS_OPT_DESYNC_WG="${NFQWS_OPT_DESYNC_WG:---payload=wireguard_initiation,wireguard_response,wireguard_cookie --lua-desync=fake:blob=0x00000000000000000000000000000000:repeats=2}"
alloc_dnum DNUM_WG4ALL
alloc_qnum QNUM_WG4ALL
zapret_custom_daemons()
{
# $1 - 1 - add, 0 - stop
local opt="--qnum=$QNUM_WG4ALL $NFQWS_OPT_DESYNC_WG"
do_nfqws $1 $DNUM_WG4ALL "$opt"
}
# size = 156 (8 udp header + 148 payload) && payload starts with 0x01000000
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
local f='-p udp -m u32 --u32'
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=156&&0>>22&0x3C@8=0x01000000" "$f 44>>16=156&&48=0x01000000" $QNUM_WG4ALL
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=100&&0>>22&0x3C@8=0x02000000" "$f 44>>16=100&&48=0x02000000" $QNUM_WG4ALL
fw_nfqws_post $1 "$f 0>>22&0x3C@4>>16=72&&0>>22&0x3C@8=0x03000000" "$f 44>>16=72&&48=0x03000000" $QNUM_WG4ALL
}
zapret_custom_firewall_nft()
{
# stop logic is not required
local f="udp length 156 @ih,0,32 0x01000000"
nft_fw_nfqws_post "$f" "$f" $QNUM_WG4ALL
local f="udp length 100 @ih,0,32 0x02000000"
nft_fw_nfqws_post "$f" "$f" $QNUM_WG4ALL
local f="udp length 72 @ih,0,32 0x03000000"
nft_fw_nfqws_post "$f" "$f" $QNUM_WG4ALL
}
@@ -0,0 +1,62 @@
# this custom script feeds dns response data to main nfqws2 instance
# DISABLE_IPV{4,6} filters are not used intentionally. despite of not having wan ipv6 it's possible to query LAN DNS server over local ipv6
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
local filt="-p udp --sport 53"
local jump="-j NFQUEUE --queue-num $QNUM --queue-bypass"
local rule chain lan lanifs
get_lanif lanifs
# router
for lan in $lanifs; do
rule="-o $lan $filt $jump"
ipt_print_op $1 "$rule" "nfqws FORWARD (qnum $QNUM)"
ipt_add_del $1 FORWARD -t mangle $rule
ipt_print_op $1 "$rule" "nfqws FORWARD (qnum $QNUM)" 6
ipt6_add_del $1 FORWARD -t mangle $rule
done
# dns client server
for chain in INPUT OUTPUT ; do
rule="$filt $jump"
ipt_print_op $1 "$rule" "nfqws $chain (qnum $QNUM)"
ipt_add_del $1 $chain -t mangle $rule
ipt_print_op $1 "$rule" "nfqws $chain (qnum $QNUM)" 6
ipt6_add_del $1 $chain -t mangle $rule
done
}
zapret_custom_firewall_nft()
{
# stop logic is not required
local rule="udp sport 53 queue num $QNUM bypass"
# router
nft_print_op "oifname @lanif $rule" "nfqws forward (qnum $QNUM)" "4+6"
nft_add_chain forward_dns_feed "type filter hook forward priority mangle;"
nft_flush_chain forward_dns_feed
nft_add_rule forward_dns_feed oifname @lanif $rule
# dns client
nft_print_op "$rule" "nfqws input (qnum $QNUM)" "4+6"
nft_add_chain input_dns_feed "type filter hook input priority mangle;"
nft_flush_chain input_dns_feed
nft_add_rule input_dns_feed $rule
# dns server
nft_print_op "$rule" "nfqws output (qnum $QNUM)" "4+6"
nft_add_chain output_dns_feed "type filter hook output priority mangle;"
nft_flush_chain output_dns_feed
nft_add_rule output_dns_feed $rule
}
zapret_custom_firewall_nft_flush()
{
local chain
for chain in forward_dns_feed input_dns_feed output_dns_feed; do
nft_del_chain $chain 2>/dev/null
done
}
@@ -0,0 +1,145 @@
# this custom script sets FILTER_MARK to specified source ips
# NOTE !!! SCRIPT REQUIRES FILTER_MARK VAR IN CONFIG FILE !!!
# NOTE !!! WITHOUT FILTER_MARK IT DOES NOTHING !!!
# NOTE !!! ON NON-OPENWRT SYSTEMS SCRIPT REQUIRES IFACE_LAN VAR IN CONFIG FILE !!!
# can override in config :
# LAN ip/cidr list to be fooled. elements are space separated
FILTER_LAN_IP="${FILTER_LAN_IP:-192.168.0.0/16}"
FILTER_LAN_IP6="${FILTER_LAN_IP6:-fc00::/7}"
# allow fooling from local system (0|1) ?
FILTER_LAN_ALLOW_OUTPUT="${FILTER_LAN_ALLOW_OUTPUT:-1}"
FILTER_LAN_SET="lanfilter"
FILTER_LAN_SET6="${FILTER_LAN_SET}6"
FILTER_LAN_IPSET_SIZE=${FILTER_LAN_IPSET_SIZE:-256}
FILTER_LAN_IPSET_OPT="${FILTER_LAN_IPSET_OPT:-hash:net hashsize 8192 maxelem $FILTER_LAN_IPSET_SIZE}"
filter_mark_check()
{
[ -n "$FILTER_MARK" ] || {
echo "WARNING ! lan filter cannot work without FILTER_MARK set in config"
return 1
}
[ "$DISABLE_IPV4" = 1 -a "$DISABLE_IPV6" = 1 ] && return 1
return 0
}
zapret_custom_firewall()
{
# $1 - 1 - run, 0 - stop
filter_mark_check || return
local subnet lanifs rule
local setmark="-j MARK --set-mark $FILTER_MARK/$FILTER_MARK"
local filt4="-m set --match-set $FILTER_LAN_SET src"
local filt6="-m set --match-set $FILTER_LAN_SET6 src"
get_lanif lanifs
[ "$DISABLE_IPV4" != 1 ] && {
[ "$FILTER_LAN_ALLOW_OUTPUT" = 1 ] && {
ipt_print_op $1 "$setmark" "filter output"
ipt_add_del $1 OUTPUT -t mangle $setmark
}
[ -n "$lanifs" ] && {
[ "$1" = 1 ] && {
ipset create $FILTER_LAN_SET $FILTER_LAN_IPSET_OPT family inet 2>/dev/null
ipset flush $FILTER_LAN_SET
for subnet in $FILTER_LAN_IP; do
echo add $FILTER_LAN_SET $subnet
done | ipset -! restore
}
for lan in $lanifs; do
rule="-i $lan $filt4 $setmark"
ipt_print_op $1 "$rule" "filter forward"
ipt_add_del $1 FORWARD -t mangle $rule
done
}
}
[ "$DISABLE_IPV6" != 1 ] && {
[ "$FILTER_LAN_ALLOW_OUTPUT" = 1 ] && {
ipt_print_op $1 "$setmark" "filter output" 6
ipt6_add_del $1 OUTPUT -t mangle $setmark
}
[ -n "$lanifs" ] && {
[ "$1" = 1 ] && {
ipset create $FILTER_LAN_SET6 $FILTER_LAN_IPSET_OPT family inet6 2>/dev/null
ipset flush $FILTER_LAN_SET6
for subnet in $FILTER_LAN_IP6; do
echo add $FILTER_LAN_SET6 $subnet
done | ipset -! restore
}
for lan in $lanifs; do
rule="-i $lan $filt6 $setmark"
ipt_print_op $1 "$rule" "filter forward" 6
ipt6_add_del $1 FORWARD -t mangle $rule
done
}
}
[ "$1" = 1 ] || {
ipset destroy $FILTER_LAN_SET 2>/dev/null
ipset destroy $FILTER_LAN_SET6 2>/dev/null
}
}
zapret_custom_firewall_nft()
{
filter_mark_check || return
local subnets rule
local setmark="meta mark set meta mark or $FILTER_MARK"
local filt4="ip saddr == @$FILTER_LAN_SET"
local filt6="ip6 saddr == @$FILTER_LAN_SET6"
local lanif="iifname @lanif"
nft_add_chain forward_lan_filter "type filter hook forward priority mangle;"
nft_flush_chain forward_lan_filter
if [ "$FILTER_LAN_ALLOW_OUTPUT" = 1 ]; then
nft_add_chain output_lan_filter "type filter hook output priority mangle;"
nft_flush_chain output_lan_filter
nft_print_op "$setmark" "filter output" "4+6"
nft_add_rule output_lan_filter $setmark
else
nft_del_chain output_lan_filter 2>/dev/null
fi
[ "$DISABLE_IPV4" != 1 ] && {
make_comma_list subnets $FILTER_LAN_IP
nft_create_set $FILTER_LAN_SET "type ipv4_addr; size $FILTER_LAN_IPSET_SIZE; auto-merge; flags interval;"
nft_flush_set $FILTER_LAN_SET
nft_add_set_element $FILTER_LAN_SET "$subnets"
rule="$lanif $filt4 $setmark"
nft_print_op "$rule" "filter forward" "4"
nft_add_rule forward_lan_filter $rule
}
[ "$DISABLE_IPV6" != 1 ] && {
make_comma_list subnets $FILTER_LAN_IP6
nft_create_set $FILTER_LAN_SET6 "type ipv6_addr; size $FILTER_LAN_IPSET_SIZE; auto-merge; flags interval;"
nft_flush_set $FILTER_LAN_SET6
nft_add_set_element $FILTER_LAN_SET6 "$subnets"
rule="$lanif $filt6 $setmark"
nft_print_op "$rule" "filter forward" "6"
nft_add_rule forward_lan_filter $rule
}
}
zapret_custom_firewall_nft_flush()
{
# this function is called after all nft fw rules are deleted
# however sets are not deleted. it's desired to clear sets here.
nft_del_chain forward_lan_filter 2>/dev/null
nft_del_chain output_lan_filter 2>/dev/null
nft_del_set $FILTER_LAN_SET 2>/dev/null
nft_del_set $FILTER_LAN_SET6 2>/dev/null
}
+69
View File
@@ -0,0 +1,69 @@
#!/sbin/openrc-run
# zapret openrc to sysv adapter
# on some systems (alpine) for unknown reason non-openrc-run scripts are not started from /etc/init.d
EXEDIR=$(dirname "$RC_SERVICE")
EXEDIR="$(cd "$EXEDIR"; pwd)"
ZAPRET_BASE="$EXEDIR/../.."
ZAPRET_INIT="$ZAPRET_BASE/init.d/sysv/zapret2"
extra_commands="start_fw stop_fw restart_fw start_daemons stop_daemons restart_daemons reload_ifsets list_ifsets list_table"
description="extra commands :"
description_stop_fw="Stop zapret firewall"
description_start_fw="Start zapret firewall"
description_restart_fw="Restart zapret firewall"
description_reload_ifsets="Reload interface lists (nftables only)"
description_list_ifsets="Display interface lists (nftables only)"
description_list_table="Display zapret nftable (nftables only)"
description_stop_daemons="Stop zapret daemons only"
description_start_daemons="Start zapret daemons only"
description_restart_daemons="Restart zapret firewall only"
depend() {
rc-service -e networking && need networking
}
start()
{
"$ZAPRET_INIT" start
}
stop()
{
"$ZAPRET_INIT" stop
}
start_fw()
{
"$ZAPRET_INIT" start_fw
}
stop_fw()
{
"$ZAPRET_INIT" stop_fw
}
restart_fw()
{
"$ZAPRET_INIT" restart_fw
}
start_daemons()
{
"$ZAPRET_INIT" start_daemons
}
stop_daemons()
{
"$ZAPRET_INIT" stop_daemons
}
restart_daemons()
{
"$ZAPRET_INIT" restart_daemons
}
reload_ifsets()
{
"$ZAPRET_INIT" reload_ifsets
}
list_ifsets()
{
"$ZAPRET_INIT" list_ifsets
}
list_table()
{
"$ZAPRET_INIT" list_table
}
+33
View File
@@ -0,0 +1,33 @@
#!/bin/sh
ZAPRET=/etc/init.d/zapret2
[ -n "$INTERFACE" ] && [ "$ACTION" = ifup -o "$ACTION" = ifdown ] && [ -x "$ZAPRET" ] && "$ZAPRET" enabled && {
SCRIPT=$(readlink "$ZAPRET")
if [ -n "$SCRIPT" ]; then
EXEDIR=$(dirname "$SCRIPT")
ZAPRET_BASE=$(readlink -f "$EXEDIR/../..")
else
ZAPRET_BASE=/opt/zapret2
fi
ZAPRET_RW=${ZAPRET_RW:-"$ZAPRET_BASE"}
ZAPRET_CONFIG=${ZAPRET_CONFIG:-"$ZAPRET_RW/config"}
CUSTOM_DIR="$ZAPRET_RW/init.d/openwrt"
. "$ZAPRET_CONFIG"
. "$ZAPRET_BASE/common/base.sh"
. "$ZAPRET_BASE/common/fwtype.sh"
linux_fwtype
case "$FWTYPE" in
nftables)
logger -t zapret reloading nftables ifsets due to $ACTION of $INTERFACE
"$ZAPRET" reload_ifsets
;;
iptables)
openwrt_fw3 || {
logger -t zapret reloading iptables due to $ACTION of $INTERFACE
"$ZAPRET" restart_fw
}
;;
esac
}
View File
Whitespace-only changes.
+11
View File
@@ -0,0 +1,11 @@
SCRIPT=$(readlink /etc/init.d/zapret2)
if [ -n "$SCRIPT" ]; then
EXEDIR=$(dirname "$SCRIPT")
ZAPRET_BASE=$(readlink -f "$EXEDIR/../..")
else
ZAPRET_BASE=/opt/zapret2
fi
. "$ZAPRET_BASE/init.d/openwrt/functions"
zapret_apply_firewall
+230
View File
@@ -0,0 +1,230 @@
. /lib/functions/network.sh
ZAPRET_BASE=${ZAPRET_BASE:-/opt/zapret2}
ZAPRET_RW=${ZAPRET_RW:-"$ZAPRET_BASE"}
ZAPRET_CONFIG=${ZAPRET_CONFIG:-"$ZAPRET_RW/config"}
. "$ZAPRET_CONFIG"
. "$ZAPRET_BASE/common/base.sh"
. "$ZAPRET_BASE/common/fwtype.sh"
. "$ZAPRET_BASE/common/linux_iphelper.sh"
. "$ZAPRET_BASE/common/ipt.sh"
. "$ZAPRET_BASE/common/nft.sh"
. "$ZAPRET_BASE/common/linux_fw.sh"
. "$ZAPRET_BASE/common/linux_daemons.sh"
. "$ZAPRET_BASE/common/list.sh"
. "$ZAPRET_BASE/common/custom.sh"
CUSTOM_DIR="$ZAPRET_RW/init.d/openwrt"
QNUM=${QNUM:-300}
WS_USER=${WS_USER:-daemon}
DESYNC_MARK=${DESYNC_MARK:-0x40000000}
DESYNC_MARK_POSTNAT=${DESYNC_MARK_POSTNAT:-0x20000000}
OPENWRT_LAN=${OPENWRT_LAN:-lan}
IPSET_CR="$ZAPRET_BASE/ipset/create_ipset.sh"
# can be multiple ipv6 outgoing interfaces
# uplink from isp, tunnelbroker, vpn, ...
# want them all. who knows what's the real one that blocks sites
# dont want any manual configuration - want to do it automatically
# standard network_find_wan[6] return only the first
# we use low level function from network.sh to avoid this limitation
# it can change theoretically and stop working
network_find_wan4_all()
{
if [ -n "$OPENWRT_WAN4" ]; then
eval $1="\$OPENWRT_WAN4"
else
__network_ifstatus "$1" "" "[@.route[@.target='0.0.0.0' && !@.table]].interface" "" 10 2>/dev/null && return
network_find_wan $1
fi
}
network_find_wan_all()
{
network_find_wan4_all "$@"
}
network_find_wan6_all()
{
if [ -n "$OPENWRT_WAN6" ]; then
eval $1="\$OPENWRT_WAN6"
else
__network_ifstatus "$1" "" "[@.route[@.target='::' && !@.table]].interface" "" 10 2>/dev/null && return
network_find_wan6 $1
fi
}
network_find_wanX_devices()
{
# $1 - ip version: 4 or 6
# $2 - variable to put result to
local ifaces
network_find_wan${1}_all ifaces
call_for_multiple_items network_get_device $2 "$ifaces"
}
get_wanif46()
{
# $1 - 4/6
# $2 - var to receive interface list
local ifaces
network_find_wan${1}_all ifaces
call_for_multiple_items network_get_device $2 "$ifaces"
}
get_lanif()
{
# $1 - var to receive interface list
call_for_multiple_items network_get_device $1 "$OPENWRT_LAN"
}
fw_nfqws_prepost_x()
{
# $1 - 1 - add, 0 - del
# $2 - filter
# $3 - queue number
# $4 - 4/6
# $5 - post/pre
local DWAN
get_wanif46 $4 DWAN
[ -n "$DWAN" ] && _fw_nfqws_${5}${4} $1 "$2" $3 "$(unique $DWAN)"
}
fw_nfqws_post4()
{
fw_nfqws_prepost_x $1 "$2" $3 4 post
}
fw_nfqws_post6()
{
fw_nfqws_prepost_x $1 "$2" $3 6 post
}
fw_nfqws_pre4()
{
fw_nfqws_prepost_x $1 "$2" $3 4 pre
}
fw_nfqws_pre6()
{
fw_nfqws_prepost_x $1 "$2" $3 6 pre
}
create_ipset()
{
echo "Creating ip list table (firewall type $FWTYPE)"
"$IPSET_CR" "$@"
}
list_nfqws_rules()
{
# $1 = '' for ipv4, '6' for ipv6
ip$1tables -S POSTROUTING -t mangle | \
grep -E "NFQUEUE --queue-num $QNUM --queue-bypass|NFQUEUE --queue-num $(($QNUM+1)) --queue-bypass|NFQUEUE --queue-num $(($QNUM+2)) --queue-bypass|NFQUEUE --queue-num $(($QNUM+3)) --queue-bypass|NFQUEUE --queue-num $(($QNUM+10)) --queue-bypass|NFQUEUE --queue-num $(($QNUM+11)) --queue-bypass" | \
sed -re 's/^-A POSTROUTING (.*) -j NFQUEUE.*$/\1/' -e "s/-m mark ! --mark $DESYNC_MARK\/$DESYNC_MARK//"
}
apply_flow_offloading_enable_rule()
{
# $1 = '' for ipv4, '6' for ipv6
local i off='-j FLOWOFFLOAD'
[ "$FLOWOFFLOAD" = "hardware" ] && off="$off --hw"
i="forwarding_rule_zapret -m comment --comment zapret_traffic_offloading_enable -m conntrack --ctstate RELATED,ESTABLISHED $off"
echo enabling ipv${1:-4} flow offloading : $i
ip$1tables -A $i
}
apply_flow_offloading_exempt_rule()
{
# $1 = '' for ipv4, '6' for ipv6
local i v
v=$1
shift
i="forwarding_rule_zapret $@ -m comment --comment zapret_traffic_offloading_exemption -j RETURN"
echo applying ipv${v:-4} flow offloading exemption : $i
ip${v}tables -A $i
}
flow_offloading_unexempt_v()
{
# $1 = '' for ipv4, '6' for ipv6
local DWAN
network_find_wanX_devices ${1:-4} DWAN
for i in $DWAN; do ipt$1_del FORWARD -o $i -j forwarding_rule_zapret ; done
ip$1tables -F forwarding_rule_zapret 2>/dev/null
ip$1tables -X forwarding_rule_zapret 2>/dev/null
}
flow_offloading_exempt_v()
{
# $1 = '' for ipv4, '6' for ipv6
is_ipt_flow_offload_avail $1 || return 0
flow_offloading_unexempt_v $1
[ "$FLOWOFFLOAD" = 'software' -o "$FLOWOFFLOAD" = 'hardware' ] && {
ip$1tables -N forwarding_rule_zapret
# remove outgoing interface
list_nfqws_rules $1 | sed -re 's/-o +[^ ]+//g' |
while read rule; do
apply_flow_offloading_exempt_rule "$1" $rule
done
apply_flow_offloading_enable_rule $1
# only outgoing to WAN packets trigger flow offloading
local DWAN
network_find_wanX_devices ${1:-4} DWAN
for i in $DWAN; do ipt$1 FORWARD -o $i -j forwarding_rule_zapret; done
}
return 0
}
flow_offloading_exempt()
{
[ "$DISABLE_IPV4" = "1" ] || flow_offloading_exempt_v
[ "$DISABLE_IPV6" = "1" ] || flow_offloading_exempt_v 6
}
flow_offloading_unexempt()
{
[ "$DISABLE_IPV4" = "1" ] || flow_offloading_unexempt_v
[ "$DISABLE_IPV6" = "1" ] || flow_offloading_unexempt_v 6
}
nft_fill_ifsets_overload()
{
local ifaces DLAN DWAN DWAN6 PDLAN PDWAN PDWAN6
call_for_multiple_items network_get_device DLAN "$OPENWRT_LAN"
call_for_multiple_items network_get_physdev PDLAN "$OPENWRT_LAN"
network_find_wan4_all ifaces
call_for_multiple_items network_get_device DWAN "$ifaces"
call_for_multiple_items network_get_physdev PDWAN "$ifaces"
network_find_wan6_all ifaces
call_for_multiple_items network_get_device DWAN6 "$ifaces"
call_for_multiple_items network_get_physdev PDWAN6 "$ifaces"
nft_fill_ifsets "$DLAN" "$DWAN" "$DWAN6" "$PDLAN" "$PDWAN" "$PDWAN6"
}
nft_wanif_filter_present()
{
# in openwrt we always use wanif filter
return 0
}
nft_wanif6_filter_present()
{
# in openwrt we always use wanif6 filter
return 0
}
nft_fw_nfqws_post4()
{
_nft_fw_nfqws_post4 "$1" $2 always_apply_wan_filter
}
nft_fw_nfqws_post6()
{
_nft_fw_nfqws_post6 "$1" $2 always_apply_wan_filter
}
nft_fw_nfqws_pre4()
{
_nft_fw_nfqws_pre4 "$1" $2 always_apply_wan_filter
}
nft_fw_nfqws_pre6()
{
_nft_fw_nfqws_pre6 "$1" $2 always_apply_wan_filter
}
+135
View File
@@ -0,0 +1,135 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
# after network
START=21
my_extra_command() {
local cmd="$1"
local help="$2"
local extra="$(printf "%-16s%s" "${cmd}" "${help}")"
EXTRA_HELP="${EXTRA_HELP} ${extra}
"
EXTRA_COMMANDS="${EXTRA_COMMANDS} ${cmd}"
}
my_extra_command stop_fw "Stop zapret firewall (noop in iptables+fw3 case)"
my_extra_command start_fw "Start zapret firewall (noop in iptables+fw3 case)"
my_extra_command restart_fw "Restart zapret firewall (noop in iptables+fw3 case)"
my_extra_command reload_ifsets "Reload interface lists (nftables only)"
my_extra_command list_ifsets "Display interface lists (nftables only)"
my_extra_command list_table "Display zapret nftable (nftables only)"
my_extra_command stop_daemons "Stop zapret daemons only (=stop in iptables+fw3 case)"
my_extra_command start_daemons "Start zapret daemons only (=start in iptables+fw3 case)"
my_extra_command restart_daemons "Restart zapret firewall only (=restart in iptables+fw3 case)"
SCRIPT=$(readlink /etc/init.d/zapret2)
if [ -n "$SCRIPT" ]; then
EXEDIR=$(dirname "$SCRIPT")
ZAPRET_BASE=$(readlink -f "$EXEDIR/../..")
else
ZAPRET_BASE=/opt/zapret2
fi
. "$ZAPRET_BASE/init.d/openwrt/functions"
# !!!!! in old openwrt 21.x- with iptables firewall rules are configured separately
# !!!!! in new openwrt >21.x with nftables firewall is configured here
PIDDIR=/var/run
USEROPT="--user=$WS_USER"
NFQWS2="${NFQWS2:-$ZAPRET_BASE/nfq2/nfqws2}"
LUAOPT="--lua-init=@$ZAPRET_BASE/lua/zapret-lib.lua --lua-init=@$ZAPRET_BASE/lua/zapret-antidpi.lua --lua-init=@$ZAPRET_BASE/lua/zapret-auto.lua"
NFQWS2_OPT_BASE="$USEROPT --fwmark=$DESYNC_MARK $LUAOPT"
run_daemon()
{
# $1 - daemon string id or number. can use 1,2,3,...
# $2 - daemon
# $3 - daemon args
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
local DAEMONBASE="$(basename "$2")"
echo "Starting daemon $1: $2 $3"
procd_open_instance
procd_set_param command $2 $3
procd_set_param pidfile $PIDDIR/${DAEMONBASE}_$1.pid
procd_close_instance
}
run_nfqws()
{
run_daemon $1 "$NFQWS2" "$NFQWS2_OPT_BASE $2"
}
do_nfqws()
{
[ "$1" = 0 ] || { shift; run_nfqws "$@"; }
}
start_daemons_procd()
{
standard_mode_daemons 1
custom_runner zapret_custom_daemons 1
return 0
}
start_daemons()
{
rc_procd start_daemons_procd "$@"
}
stop_daemons()
{
local svc="$(basename ${basescript:-$initscript})"
procd_running "$svc" "$1" && procd_kill "$svc" "$1"
}
restart_daemons()
{
stop_daemons
start_daemons
}
start_fw()
{
zapret_apply_firewall
}
stop_fw()
{
zapret_unapply_firewall
}
restart_fw()
{
stop_fw
start_fw
}
reload_ifsets()
{
zapret_reload_ifsets
}
list_ifsets()
{
zapret_list_ifsets
}
list_table()
{
zapret_list_table
}
start_service()
{
start_daemons_procd
[ "$INIT_APPLY_FW" != "1" ] || {
linux_fwtype
openwrt_fw3_integration || start_fw
}
}
stop_service()
{
# this procedure is called from stop()
# stop() already stop daemons
[ "$INIT_APPLY_FW" != "1" ] || {
linux_fwtype
openwrt_fw3_integration || stop_fw
}
}
+27
View File
@@ -0,0 +1,27 @@
#!/bin/sh
# this file should be placed to /usr/local/etc/rc.d and chmod 755
# copy 'lua' dir there
ZDIR=/usr/local/etc/zapret2
# prepare system
kldload ipfw
kldload ipdivert
# for older pfsense versions. newer do not have these sysctls
sysctl net.inet.ip.pfil.outbound=ipfw,pf
sysctl net.inet.ip.pfil.inbound=ipfw,pf
sysctl net.inet6.ip6.pfil.outbound=ipfw,pf
sysctl net.inet6.ip6.pfil.inbound=ipfw,pf
# required for newer pfsense versions (2.6.0 tested) to return ipfw to functional state
pfctl -d ; pfctl -e
# add ipfw rules and start daemon
ipfw delete 100
ipfw add 100 divert 990 tcp from any to any 80,443 out not diverted not sockarg
pkill ^dvtws2$
dvtws2 --daemon --port 990 --lua-init=@$ZDIR/zapret-lib.lua --lua-init=@$ZDIR/zapret-antidpi.lua --lua-desync=multisplit
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
/opt/zapret2/init.d/sysv/zapret2 stop
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
/opt/zapret2/init.d/sysv/zapret2 start
exec chpst -b zapret2 sleep infinity
+2
View File
@@ -0,0 +1,2 @@
#!/bin/execlineb -P
exec /opt/zapret2/init.d/sysv/zapret2 stop
+1
View File
@@ -0,0 +1 @@
oneshot
+2
View File
@@ -0,0 +1,2 @@
#!/bin/execlineb -P
exec /opt/zapret2/init.d/sysv/zapret2 start
+61
View File
@@ -0,0 +1,61 @@
# Example systemd service unit for nfqws. Adjust for your installation.
# WARNING ! This unit requires to compile nfqws using `make systemd`
# WARNING ! This makefile target enables special systemd notify support.
# PREPARE
# install build depends
# make -C /opt/zapret2 systemd
# cp nfqws2\@.service /lib/systemd/system
# systemctl daemon-reload
# MANAGE INSTANCE
# prepare /etc/zapret2/nfqws1.conf with nfqws parameters
# systemctl start nfqws2@nfqws1
# systemctl status nfqws2@nfqws1
# systemctl restart nfqws2@nfqws1
# systemctl enable nfqws2@nfqws1
# systemctl disable nfqws2@nfqws1
# systemctl stop nfqws2@nfqws1
# DELETE
# rm /lib/systemd/system/nfqws@.service
# systemctl daemon-reload
[Unit]
After=network.target
[Service]
Type=notify
Restart=on-failure
ExecSearchPath=/opt/zapret2/nfq2
ExecStart=nfqws2 @${CONFIG_DIR}/${INSTANCE}.conf
Environment=CONFIG_DIR=/etc/zapret2
Environment=INSTANCE=%i
RestrictAddressFamilies=AF_NETLINK AF_UNIX AF_INET6 AF_INET
LockPersonality=true
PrivateDevices=true
PrivateMounts=true
PrivateTmp=true
ProcSubset=pid
ProtectClock=true
ProtectControlGroups=true
ProtectHome=true
ProtectHostname=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectProc=invisible
ProtectSystem=full
RemoveIPC=true
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
UMask=0077
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,13 @@
[Unit]
Description=zapret2 ip/host list update
[Service]
Restart=no
IgnoreSIGPIPE=no
KillMode=control-group
GuessMainPID=no
RemainAfterExit=no
ExecStart=/opt/zapret2/ipset/get_config.sh
[Install]
WantedBy=multi-user.target
+11
View File
@@ -0,0 +1,11 @@
[Unit]
Description=zapret2 ip/host list update timer
[Timer]
OnCalendar=*-*-2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 00:00:00
RandomizedDelaySec=86400
Persistent=true
Unit=zapret2-list-update.service
[Install]
WantedBy=timers.target
+16
View File
@@ -0,0 +1,16 @@
[Unit]
After=network-online.target
Wants=network-online.target
[Service]
Type=forking
Restart=no
TimeoutSec=30sec
IgnoreSIGPIPE=no
GuessMainPID=no
RemainAfterExit=no
ExecStart=/opt/zapret2/init.d/sysv/zapret2 start
ExecStop=/opt/zapret2/init.d/sysv/zapret2 stop
[Install]
WantedBy=multi-user.target
View File
Whitespace-only changes.
+211
View File
@@ -0,0 +1,211 @@
# init script functions library for desktop linux systems
ZAPRET_BASE=${ZAPRET_BASE:-/opt/zapret2}
ZAPRET_RW=${ZAPRET_RW:-"$ZAPRET_BASE"}
ZAPRET_CONFIG=${ZAPRET_CONFIG:-"$ZAPRET_RW/config"}
. "$ZAPRET_CONFIG"
. "$ZAPRET_BASE/common/base.sh"
. "$ZAPRET_BASE/common/fwtype.sh"
. "$ZAPRET_BASE/common/linux_iphelper.sh"
. "$ZAPRET_BASE/common/ipt.sh"
. "$ZAPRET_BASE/common/nft.sh"
. "$ZAPRET_BASE/common/linux_fw.sh"
. "$ZAPRET_BASE/common/linux_daemons.sh"
. "$ZAPRET_BASE/common/list.sh"
. "$ZAPRET_BASE/common/custom.sh"
CUSTOM_DIR="$ZAPRET_RW/init.d/sysv"
user_exists()
{
id -u $1 >/dev/null 2>/dev/null
}
useradd_compat()
{
# $1 - username
# skip for readonly systems
[ -w "/etc" ] && {
if exists useradd ; then
useradd --no-create-home --system --shell /bin/false $1
elif is_linked_to_busybox adduser ; then
# some systems may miss nogroup group in /etc/group
# adduser fails if it's absent and no group is specified
addgroup nogroup 2>/dev/null
# busybox has special adduser syntax
adduser -S -H -D $1
elif exists adduser; then
adduser --no-create-home --system --disabled-login $1
fi
}
user_exists $1
}
prepare_user()
{
user_exists $WS_USER || {
# fallback to daemon if we cant add WS_USER
useradd_compat $WS_USER || {
for user in daemon nobody; do
user_exists $user && {
WS_USER=$user
return 0
}
done
return 1
}
}
}
# this complex user selection allows to survive in any locked/readonly/minimalistic environment
[ -n "$WS_USER" ] || WS_USER=tpws
if prepare_user; then
USEROPT="--user=$WS_USER"
else
WS_USER=1
USEROPT="--uid $WS_USER:$WS_USER"
fi
PIDDIR=/var/run
IPSET_CR="$ZAPRET_BASE/ipset/create_ipset.sh"
DESYNC_MARK=${DESYNC_MARK:-0x40000000}
DESYNC_MARK_POSTNAT=${DESYNC_MARK_POSTNAT:-0x20000000}
QNUM=${QNUM:-300}
NFQWS2="${NFQWS2:-$ZAPRET_BASE/nfq2/nfqws2}"
LUAOPT="--lua-init=@$ZAPRET_BASE/lua/zapret-lib.lua --lua-init=@$ZAPRET_BASE/lua/zapret-antidpi.lua --lua-init=@$ZAPRET_BASE/lua/zapret-auto.lua"
NFQWS2_OPT_BASE="$USEROPT --fwmark=$DESYNC_MARK $LUAOPT"
get_wanif46()
{
# $1 - 4/6
# $2 - var to receive interface list
case $1 in
6)
eval $2="\${IFACE_WAN6:-$IFACE_WAN}"
;;
4)
eval $2="\$IFACE_WAN"
;;
*)
eval $2=
esac
}
get_lanif()
{
# $1 - var to receive interface list
eval $1="\$IFACE_LAN"
}
fw_nfqws_post4()
{
_fw_nfqws_post4 $1 "$2" $3 "$IFACE_WAN"
}
fw_nfqws_post6()
{
_fw_nfqws_post6 $1 "$2" $3 "${IFACE_WAN6:-$IFACE_WAN}"
}
fw_nfqws_pre4()
{
_fw_nfqws_pre4 $1 "$2" $3 "$IFACE_WAN"
}
fw_nfqws_pre6()
{
_fw_nfqws_pre6 $1 "$2" $3 "${IFACE_WAN6:-$IFACE_WAN}"
}
nft_fw_nfqws_post4()
{
_nft_fw_nfqws_post4 "$1" $2 "$IFACE_WAN"
}
nft_fw_nfqws_post6()
{
_nft_fw_nfqws_post6 "$1" $2 "${IFACE_WAN6:-$IFACE_WAN}"
}
nft_fw_nfqws_pre4()
{
_nft_fw_nfqws_pre4 "$1" $2 "$IFACE_WAN"
}
nft_fw_nfqws_pre6()
{
_nft_fw_nfqws_pre6 "$1" $2 "${IFACE_WAN6:-$IFACE_WAN}"
}
nft_wanif_filter_present()
{
[ -n "$IFACE_WAN" ]
}
nft_wanif6_filter_present()
{
[ -n "${IFACE_WAN6:-$IFACE_WAN}" ]
}
nft_fill_ifsets_overload()
{
nft_fill_ifsets "$IFACE_LAN" "$IFACE_WAN" "${IFACE_WAN6:-$IFACE_WAN}"
}
run_daemon()
{
# $1 - daemon number : 1,2,3,...
# $2 - daemon
# $3 - daemon args
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
local DAEMONBASE="$(basename "$2")"
local PID= PIDFILE=$PIDDIR/${DAEMONBASE}_$1.pid
echo "Starting daemon $1: $2 $3"
[ -f "$PIDFILE" ] && {
read PID <"$PIDFILE"
[ -d "/proc/$PID" ] || PID=
}
if [ -n "$PID" ]; then
echo already running
else
"$2" $3 >/dev/null &
PID=$!
if [ -n "$PID" ]; then
echo $PID >$PIDFILE
else
echo could not start daemon $1 : $2 $3
false
fi
fi
}
stop_daemon()
{
# $1 - daemon number : 1,2,3,...
# $2 - daemon
# use $PIDDIR/$DAEMONBASE$1.pid as pidfile
local DAEMONBASE="$(basename "$2")"
local PID PIDFILE=$PIDDIR/${DAEMONBASE}_$1.pid
echo "Stopping daemon $1: $2"
if [ -f "$PIDFILE" ]; then
read PID <"$PIDFILE"
kill $PID
rm -f "$PIDFILE"
else
echo no pidfile : $PIDFILE
fi
}
do_daemon()
{
# $1 - 1 - run, 0 - stop
on_off_function run_daemon stop_daemon "$@"
}
do_nfqws()
{
# $1 : 1 - run, 0 - stop
# $2 : daemon number
# $3 : daemon args
do_daemon $1 $2 "$NFQWS2" "$NFQWS2_OPT_BASE $3"
}
create_ipset()
{
echo "Creating ip list table (firewall type $FWTYPE)"
"$IPSET_CR" "$@"
}
+82
View File
@@ -0,0 +1,82 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: zapret
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
SCRIPT=$(readlink -f "$0")
EXEDIR=$(dirname "$SCRIPT")
ZAPRET_BASE=$(readlink -f "$EXEDIR/../..")
. "$EXEDIR/functions"
NAME=zapret
DESC=anti-zapret
do_start()
{
zapret_run_daemons
[ "$INIT_APPLY_FW" != "1" ] || { zapret_apply_firewall; }
}
do_stop()
{
zapret_stop_daemons
[ "$INIT_APPLY_FW" != "1" ] || zapret_unapply_firewall
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_stop
do_start
;;
start-fw|start_fw)
zapret_apply_firewall
;;
stop-fw|stop_fw)
zapret_unapply_firewall
;;
restart-fw|restart_fw)
zapret_unapply_firewall
zapret_apply_firewall
;;
start-daemons|start_daemons)
zapret_run_daemons
;;
stop-daemons|stop_daemons)
zapret_stop_daemons
;;
restart-daemons|restart_daemons)
zapret_stop_daemons
zapret_run_daemons
;;
reload-ifsets|reload_ifsets)
zapret_reload_ifsets
;;
list-ifsets|list_ifsets)
zapret_list_ifsets
;;
list-table|list_table)
zapret_list_table
;;
*)
echo "Usage: $SCRIPT {start|stop|restart|start-fw|stop-fw|restart-fw|start-daemons|stop-daemons|restart-daemons|reload-ifsets|list-ifsets|list-table}" >&2
exit 1
;;
esac
exit 0
@@ -0,0 +1,14 @@
Цель этих фильтров - отсекать полезную нагрузку в режиме ядра, не насилуя процессор перенаправлением целого потока на winws.
Задействуются через `winws --wf-raw-part=@filename`. Может быть несколько частичных фильтров. Они могут сочетаться с --wf-tcp и --wf-udp.
Однако, язык фильтров windivert не содержит операций с битовыми полями, сдвигов и побитовой логики.
Поэтому фильтры получились более слабыми, способными передавать неправильную нагрузку.
Дофильтрация производится силами winws.
Описание языка фильтров : https://reqrypt.org/windivert-doc.html#filter_language
Пример инстанса для пробития медиапотоков в discord : `winws --wf-raw-part=@windivert_part.discord_media.txt --wf-raw-part=@windivert_part.stun.txt --filter-l7=stun,discord --dpi-desync=fake`
These filters are invoked using `winws --wf-raw-part=@filename`. Multiple filter parts are supported. They can be combined with --wf-tcp and --wf-udp.
Filters are kernel mode and save great amount of CPU.
However windivert cannot filter by bit fields, lacks shift and bitwise logic operations.
Filters are relaxed and can pass wrong payloads. Finer filtering is done by winws.
Loaded 100 of 205 files, more files were not shown because too many files have changed in this diff. Show more