mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-14 10:48:32 +05:00
custom script for RKN DHT BLOCK : custom-nfqws-dht4all
This commit is contained in:
parent
df3aff8ff3
commit
888f9cbf7d
46
init.d/openwrt/custom-nfqws-dht4all
Normal file
46
init.d/openwrt/custom-nfqws-dht4all
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# this custom script in addition to MODE=nfqws runs desync to DHT packets with udp payload length 101..399 , without ipset/hostlist filtering
|
||||||
|
# need to add to config : "NFQWS_OPT_DESYNC_DHT="--dpi-desync=fake --dpi-desync-any-protocol --dpi-desync-cutoff=d2 --dpi-desync-ttl=5"
|
||||||
|
|
||||||
|
QNUM2=$(($QNUM+20))
|
||||||
|
|
||||||
|
zapret_custom_daemons()
|
||||||
|
{
|
||||||
|
# stop logic is managed by procd
|
||||||
|
|
||||||
|
local MODE_OVERRIDE=nfqws
|
||||||
|
local opt
|
||||||
|
|
||||||
|
start_daemons_procd
|
||||||
|
|
||||||
|
opt="--qnum=$QNUM2 $NFQWS_OPT_BASE $NFQWS_OPT_DESYNC_DHT"
|
||||||
|
run_daemon 100 $NFQWS "$opt"
|
||||||
|
}
|
||||||
|
zapret_custom_firewall()
|
||||||
|
{
|
||||||
|
# $1 - 1 - run, 0 - stop
|
||||||
|
|
||||||
|
local MODE_OVERRIDE=nfqws
|
||||||
|
local f
|
||||||
|
local first_packet_only="-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1:1"
|
||||||
|
local desync="-m mark ! --mark $DESYNC_MARK/$DESYNC_MARK"
|
||||||
|
|
||||||
|
zapret_do_firewall_rules_ipt $1
|
||||||
|
|
||||||
|
f="-p udp -m length --length 109:407"
|
||||||
|
fw_nfqws_post $1 "$f $desync $first_packets_only" "$f $desync $first_packets_only" $QNUM2
|
||||||
|
|
||||||
|
}
|
||||||
|
zapret_custom_firewall_nft()
|
||||||
|
{
|
||||||
|
# stop logic is not required
|
||||||
|
|
||||||
|
local MODE_OVERRIDE=nfqws
|
||||||
|
local f
|
||||||
|
local first_packet_only="ct original packets 1"
|
||||||
|
local desync="mark and $DESYNC_MARK == 0"
|
||||||
|
|
||||||
|
zapret_apply_firewall_rules_nft
|
||||||
|
|
||||||
|
f="meta length 109-407 meta l4proto udp @th,64,16 0x6431"
|
||||||
|
nft_fw_nfqws_post "$f $desync $first_packet_only" "$f $desync $first_packet_only" $QNUM2
|
||||||
|
}
|
47
init.d/sysv/custom-nfqws-dht4all
Normal file
47
init.d/sysv/custom-nfqws-dht4all
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# this custom script in addition to MODE=nfqws runs desync to DHT packets with udp payload length 101..399 , without ipset/hostlist filtering
|
||||||
|
# need to add to config : "NFQWS_OPT_DESYNC_DHT="--dpi-desync=fake --dpi-desync-any-protocol --dpi-desync-cutoff=d2 --dpi-desync-ttl=5"
|
||||||
|
|
||||||
|
QNUM2=$(($QNUM+20))
|
||||||
|
|
||||||
|
zapret_custom_daemons()
|
||||||
|
{
|
||||||
|
# stop logic is managed by procd
|
||||||
|
|
||||||
|
local MODE_OVERRIDE=nfqws
|
||||||
|
local opt
|
||||||
|
|
||||||
|
zapret_do_daemons $1
|
||||||
|
|
||||||
|
opt="--qnum=$QNUM2 $NFQWS_OPT_BASE $NFQWS_OPT_DESYNC_DHT"
|
||||||
|
do_nfqws $1 100 "$opt"
|
||||||
|
}
|
||||||
|
zapret_custom_firewall()
|
||||||
|
{
|
||||||
|
# $1 - 1 - run, 0 - stop
|
||||||
|
|
||||||
|
local MODE_OVERRIDE=nfqws
|
||||||
|
local f
|
||||||
|
local first_packet_only="-m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 1"
|
||||||
|
local desync="-m mark ! --mark $DESYNC_MARK/$DESYNC_MARK"
|
||||||
|
|
||||||
|
zapret_do_firewall_rules_ipt $1
|
||||||
|
|
||||||
|
f="-p udp -m length --length 109:407"
|
||||||
|
fw_nfqws_post $1 "$f $desync $first_packets_only" "$f $desync $first_packets_only" $QNUM2
|
||||||
|
|
||||||
|
}
|
||||||
|
zapret_custom_firewall_nft()
|
||||||
|
{
|
||||||
|
# stop logic is not required
|
||||||
|
|
||||||
|
local MODE_OVERRIDE=nfqws
|
||||||
|
local f
|
||||||
|
local first_packet_only="ct original packets 1"
|
||||||
|
local desync="mark and $DESYNC_MARK == 0"
|
||||||
|
|
||||||
|
zapret_apply_firewall_rules_nft
|
||||||
|
|
||||||
|
f="meta length 109-407 meta l4proto udp @th,64,16 0x6431"
|
||||||
|
nft_fw_nfqws_post "$f $desync $first_packet_only" "$f $desync $first_packet_only" $QNUM2
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user