2024-10-12 12:33:06 +03:00
|
|
|
# this custom script runs desync to DHT packets with udp payload length 101..399 , without ipset/hostlist filtering
|
2023-09-07 20:34:42 +03:00
|
|
|
# need to add to config : NFQWS_OPT_DESYNC_DHT="--dpi-desync=fake --dpi-desync-ttl=5"
|
2023-09-06 12:24:29 +03:00
|
|
|
|
2024-10-12 21:28:51 +03:00
|
|
|
alloc_dnum DNUM_DHT4ALL
|
|
|
|
alloc_qnum QNUM_DHT4ALL
|
2023-09-06 12:24:29 +03:00
|
|
|
|
|
|
|
zapret_custom_daemons()
|
|
|
|
{
|
|
|
|
# stop logic is managed by procd
|
|
|
|
|
2024-10-12 12:33:06 +03:00
|
|
|
local opt="--qnum=$QNUM2 $NFQWS_OPT_BASE $NFQWS_OPT_DESYNC_DHT"
|
2024-10-12 21:28:51 +03:00
|
|
|
run_daemon $DNUM_DHT4ALL $NFQWS "$opt"
|
2023-09-06 12:24:29 +03:00
|
|
|
}
|
|
|
|
zapret_custom_firewall()
|
|
|
|
{
|
|
|
|
# $1 - 1 - run, 0 - stop
|
|
|
|
|
2023-09-06 13:50:41 +03:00
|
|
|
local f uf4 uf6
|
2024-03-02 17:53:37 +03:00
|
|
|
local first_packet_only="$ipt_connbytes 1:1"
|
2023-09-06 12:24:29 +03:00
|
|
|
local desync="-m mark ! --mark $DESYNC_MARK/$DESYNC_MARK"
|
|
|
|
|
2023-09-06 13:50:41 +03:00
|
|
|
f='-p udp -m length --length 109:407 -m u32 --u32'
|
|
|
|
uf4='0>>22&0x3C@8>>16=0x6431'
|
|
|
|
uf6='48>>16=0x6431'
|
2024-10-12 21:28:51 +03:00
|
|
|
fw_nfqws_post $1 "$f $uf4 $desync $first_packet_only" "$f $uf6 $desync $first_packet_only" $QNUM_DHT4ALL
|
2023-09-06 12:24:29 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
zapret_custom_firewall_nft()
|
|
|
|
{
|
|
|
|
# stop logic is not required
|
|
|
|
|
|
|
|
local f
|
2024-03-02 17:53:37 +03:00
|
|
|
local first_packet_only="$nft_connbytes 1"
|
2023-09-06 12:24:29 +03:00
|
|
|
local desync="mark and $DESYNC_MARK == 0"
|
|
|
|
|
|
|
|
f="meta length 109-407 meta l4proto udp @th,64,16 0x6431"
|
2024-10-12 21:28:51 +03:00
|
|
|
nft_fw_nfqws_post "$f $desync $first_packet_only" "$f $desync $first_packet_only" $QNUM_DHT4ALL
|
2023-09-06 12:24:29 +03:00
|
|
|
}
|