mirror of https://github.com/bol-van/zapret/
1 changed files with 35 additions and 0 deletions
@ -0,0 +1,35 @@ |
|||
# this custom script runs desync to all discord media packets |
|||
|
|||
# can override in config : |
|||
NFQWS_OPT_DESYNC_DISCORD_MEDIA="${NFQWS_OPT_DESYNC_DISCORD_MEDIA:---dpi-desync=fake}" |
|||
DISCORD_MEDIA_PORT_RANGE="${DISCORD_MEDIA_PORT_RANGE:-50000-50099}" |
|||
|
|||
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" |
|||
} |
|||
# size = 156 (8 udp header + 148 payload) && payload starts with 0x01000000 |
|||
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 --dport $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 |
|||
} |
Loading…
Reference in new issue