bol-van / zapret

DPI bypass multi platform
5.95k stars 513 forks source link

--hostlist-exclude #415

Open voronczoff opened 17 hours ago

voronczoff commented 17 hours ago

Какова логика работы эксклюдов?

Если ничего не указано, то применяется ко всем хостам. ОК Если указан только --hostlist-exclude, то не применяется ни к чему. Почему? Ожидаемый результат: применяется ко всему, кроме хостов в эксклюд файле. Работает только, если одновременно указать --hostlist и --hostlist-exclude, что в целом приводит к логическому конфликту при наличии хоста и там и там.

bol-van commented 14 hours ago

Какая командная строка целая и каково содержимое файлов листов ? Проверяю у себя - не подтверждается

bol-van commented 14 hours ago
echo sobaka.ru >h
winws --wf-tcp=80 --dpi-desync=split2 --hostlist-exclude=h --debug
windivert filter size: 1292
windivert filter:
!impostor and !loopback and
 ((outbound and ((tcp.DstPort == 80)) and (((ip.DstAddr < 127.0.0.1 or ip.DstAddr > 127.255.255.255) and (ip.DstAddr < 10.0.0.0 or ip.DstAddr > 10.255.255.255) and (ip.DstAddr < 192.168.0.0 or ip.DstAddr > 192.168.255.255) and (ip.DstAddr < 172.16.0.0 or ip.DstAddr > 172.31.255.255) and (ip.DstAddr < 169.254.0.0 or ip.DstAddr > 169.254.255.255)) or ((ipv6.DstAddr > ::1) and (ipv6.DstAddr < 2001::0 or ipv6.DstAddr >= 2001:1::0) and (ipv6.DstAddr < fc00::0 or ipv6.DstAddr >= fe00::0) and (ipv6.DstAddr < fe80::0 or ipv6.DstAddr >= fec0::0) and (ipv6.DstAddr < ff00::0 or ipv6.DstAddr >= ffff::0))))
  or
  (inbound and tcp and (tcp.Ack and tcp.Syn or tcp.Rst or tcp.Fin) and ((tcp.SrcPort == 80)) and (((ip.SrcAddr < 127.0.0.1 or ip.SrcAddr > 127.255.255.255) and (ip.SrcAddr < 10.0.0.0 or ip.SrcAddr > 10.255.255.255) and (ip.SrcAddr < 192.168.0.0 or ip.SrcAddr > 192.168.255.255) and (ip.SrcAddr < 172.16.0.0 or ip.SrcAddr > 172.31.255.255) and (ip.SrcAddr < 169.254.0.0 or ip.SrcAddr > 169.254.255.255)) or ((ipv6.SrcAddr > ::1) and (ipv6.SrcAddr < 2001::0 or ipv6.SrcAddr >= 2001:1::0) and (ipv6.SrcAddr < fc00::0 or ipv6.SrcAddr >= fe00::0) and (ipv6.SrcAddr < fe80::0 or ipv6.SrcAddr >= fec0::0) and (ipv6.SrcAddr < ff00::0 or ipv6.SrcAddr >= ffff::0)))))
adding low-priority default empty desync profile
we have 1 user defined desync profile(s) and default low priority profile 0
Loading hostlist h
loading plain text list
Loaded 1 hosts from h
initializing conntrack with timeouts tcp=60:300:60 udp=60
windivert initialized. capture is started.
packet: id=0 len=52 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 217.65.3.230 proto=tcp ttl=128 sport=60621 dport=80 flags=S seq=1650750010 ack_seq=0
desync profile search for hostname='' ipv6=0 tcp_port=80 udp_port=0
desync profile 0 matches
packet: id=0 reinject unmodified
packet: id=1 len=52 inbound IPv6=0 IPChecksum=0 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 217.65.3.230 => 192.168.4.2 proto=tcp ttl=54 sport=80 dport=60621 flags=SA seq=1449335536 ack_seq=1650750011
using cached desync profile 0
packet: id=1 reinject unmodified
packet: id=2 len=40 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 217.65.3.230 proto=tcp ttl=128 sport=60621 dport=80 flags=A seq=1650750011 ack_seq=1449335537
using cached desync profile 0
packet: id=2 reinject unmodified
packet: id=3 len=113 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 217.65.3.230 proto=tcp ttl=128 sport=60621 dport=80 flags=AP seq=1650750011 ack_seq=1449335537
TCP: 48 45 41 44 20 2F 20 48 54 54 50 2F 31 2E 31 0D 0A 48 6F 73 74 3A 20 73 6F 62 61 6B 61 2E 72 75 ... : HEAD / HTTP/1.1..Host: sobaka.ru ...
using cached desync profile 0
packet contains HTTP request
req retrans : tcp seq interval 1650750011-1650750083
hostname: sobaka.ru
we have hostname now. searching desync profile again.
desync profile search for hostname='sobaka.ru' ipv6=0 tcp_port=80 udp_port=0
* Hostlist check for profile 1
Checking exclude hostlist
Hostlist check for sobaka.ru : positive
desync profile 0 matches
packet: id=3 reinject unmodified
packet: id=4 len=40 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 217.65.3.230 proto=tcp ttl=128 sport=60621 dport=80 flags=AF seq=1650750084 ack_seq=1449335734
using cached desync profile 0
packet: id=4 reinject unmodified
packet: id=5 len=40 inbound IPv6=0 IPChecksum=0 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 217.65.3.230 => 192.168.4.2 proto=tcp ttl=54 sport=80 dport=60621 flags=AF seq=1449335734 ack_seq=1650750085
using cached desync profile 0
packet: id=5 reinject unmodified
packet: id=6 len=40 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 217.65.3.230 proto=tcp ttl=128 sport=60621 dport=80 flags=A seq=1650750085 ack_seq=1449335735
using cached desync profile 0
packet: id=6 reinject unmodified
packet: id=7 len=52 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 87.240.137.164 proto=tcp ttl=128 sport=60627 dport=80 flags=S seq=3986103630 ack_seq=0
desync profile search for hostname='' ipv6=0 tcp_port=80 udp_port=0
desync profile 0 matches
packet: id=7 reinject unmodified
packet: id=8 len=52 inbound IPv6=0 IPChecksum=0 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 87.240.137.164 => 192.168.4.2 proto=tcp ttl=55 sport=80 dport=60627 flags=SA seq=324642515 ack_seq=3986103631
using cached desync profile 0
packet: id=8 reinject unmodified
packet: id=9 len=40 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 87.240.137.164 proto=tcp ttl=128 sport=60627 dport=80 flags=A seq=3986103631 ack_seq=324642516
using cached desync profile 0
packet: id=9 reinject unmodified
packet: id=10 len=110 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 87.240.137.164 proto=tcp ttl=128 sport=60627 dport=80 flags=AP seq=3986103631 ack_seq=324642516
TCP: 48 45 41 44 20 2F 20 48 54 54 50 2F 31 2E 31 0D 0A 48 6F 73 74 3A 20 76 6B 2E 63 6F 6D 0D 0A 55 ... : HEAD / HTTP/1.1..Host: vk.com..U ...
using cached desync profile 0
packet contains HTTP request
req retrans : tcp seq interval 3986103631-3986103700
hostname: vk.com
we have hostname now. searching desync profile again.
desync profile search for hostname='vk.com' ipv6=0 tcp_port=80 udp_port=0
* Hostlist check for profile 1
Checking exclude hostlist
Hostlist check for vk.com : negative
Hostlist check for com : negative
desync profile 1 matches
desync profile changed by revealed hostname !
dpi desync src=192.168.4.2:60627 dst=87.240.137.164:80
split pos 2
sending 1st tcp segment 0-1 len=2 seqovl=0 : 48 45 : HE
sending 2nd tcp segment 2-69 len=68 : 41 44 20 2F 20 48 54 54 50 2F 31 2E 31 0D 0A 48 6F 73 74 3A 20 76 6B 2E 63 6F 6D 0D 0A 55 73 65 ... : AD / HTTP/1.1..Host: vk.com..Use ...
packet: id=10 drop
packet: id=11 len=40 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 87.240.137.164 proto=tcp ttl=128 sport=60627 dport=80 flags=AF seq=3986103701 ack_seq=324642816
using cached desync profile 1
packet: id=11 reinject unmodified
packet: id=12 len=40 inbound IPv6=0 IPChecksum=0 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 87.240.137.164 => 192.168.4.2 proto=tcp ttl=55 sport=80 dport=60627 flags=AF seq=324642816 ack_seq=3986103702
using cached desync profile 1
packet: id=12 reinject unmodified
packet: id=13 len=40 outbound IPv6=0 IPChecksum=1 TCPChecksum=0 UDPChecksum=1 IfIdx=5.0
IP4: 192.168.4.2 => 87.240.137.164 proto=tcp ttl=128 sport=60627 dport=80 flags=A seq=3986103702 ack_seq=324642817
using cached desync profile 1
packet: id=13 reinject unmodified
voronczoff commented 11 hours ago

1 файл, aarch64, кинетик ультра. Если дополнительно добавить --hostlist-auto, то он начнет туда добавлять строки.

Из скрипта запуска:

HOSTLISTFILE=/opt/root/git/zapret/hostlist.txt PASSLISTFILE=/opt/root/git/zapret/pass.txt HOSTLISTAUTOFILE=/opt/root/git/zapret/hostlistauto.txt

INTERFACE=br0

SCRIPT=/opt/root/git/zapret/tpws/tpws PIDFILE=/var/run/tpws.pid ARGS="--daemon --bind-addr 192.168.0.1 --port 999 --disorder --tlsrec=sni --split-pos=2 --pidfile $PIDFILE --hostlist-exclude $PASSLISTFILE"

bol-van commented 11 hours ago

Обновите tpws на текущую версию. Вчера вечером залил мажорный апдейт с профилями. Логика была сильно переписана, и, возможно, заодно и проблема пофиксилась

bol-van commented 11 hours ago
echo sobaka.ru >/tmp/h
/opt/zapret/tpws/tpws --socks  --port 1080 --disorder --tlsrec=sni --split-pos=2 --hostlist-exclude=/tmp/h --debug
adding low-priority default empty desync profile
we have 1 user defined desync profile(s) and default low priority profile 0
Loading hostlist /tmp/h
loading plain text list
Loaded 1 hosts from /tmp/h
Prepare bind 0 : addr= iface= v6=0 link_local=unwanted wait_ifup=0 wait_ip=0 wait_ip_ll=0
Binding 0 to [::]:1080
Running as UID=2147483647 GID=2147483647
socks mode
initialized multi threaded resolver with 15 threads
Legs : local:1 remote:0
Socket fd=7 (local) connected from [::ffff:192.168.4.2]:49189
socks target for fd=7 is : 87.240.132.78:443
desync profile search for hostname='' ipv6=0 tcp_port=443
desync profile 0 matches
Legs : local:1 remote:1
Socket fd=10 (remote) connected from : 95.161.4.34:57602
tampering tcp segment with size 306 to 87.240.132.78:443
using cached desync profile 0
Data block contains TLS ClientHello
request hostname: vk.com
desync profile search for hostname='vk.com' ipv6=0 tcp_port=443
* Hostlist check for profile 1
Checking exclude hostlist
Hostlist check for vk.com : negative
Hostlist check for com : negative
desync profile 1 matches
desync profile changed by revealed hostname !
making 2 TLS records at pos 241
Splitting at pos 2 with disorder
tampering tcp segment with size 222 to 87.240.132.78:443
using cached desync profile 1
connection hostname: vk.com
Data block contains unknown payload
tampering tcp segment with size 55 to 87.240.132.78:443
using cached desync profile 1
connection hostname: vk.com
Data block contains unknown payload
Socket fd=10 (partner_fd=7, remote=1) EPOLLHUP so_error=0 (No error information)
Socket fd=10 (partner_fd=7, remote=1) closed, connection removed. total_read=5177 total_write=588 event_count=9
Socket fd=7 (partner_fd=0, remote=0) closed, connection removed. total_read=583 total_write=5177 event_count=6
Legs : local:0 remote:0
Legs : local:1 remote:0
Socket fd=7 (local) connected from [::ffff:192.168.4.2]:49203
socks target for fd=7 is : 217.65.3.230:443
desync profile search for hostname='' ipv6=0 tcp_port=443
desync profile 0 matches
Legs : local:1 remote:1
Socket fd=10 (remote) connected from : 95.161.4.34:39600
tampering tcp segment with size 309 to 217.65.3.230:443
using cached desync profile 0
Data block contains TLS ClientHello
request hostname: sobaka.ru
desync profile search for hostname='sobaka.ru' ipv6=0 tcp_port=443
* Hostlist check for profile 1
Checking exclude hostlist
Hostlist check for sobaka.ru : positive
desync profile 0 matches
tampering tcp segment with size 93 to 217.65.3.230:443
using cached desync profile 0
connection hostname: sobaka.ru
Data block contains unknown payload
tampering tcp segment with size 101 to 217.65.3.230:443
using cached desync profile 0
connection hostname: sobaka.ru
Data block contains unknown payload
tampering tcp segment with size 31 to 217.65.3.230:443
using cached desync profile 0
connection hostname: sobaka.ru
Data block contains unknown payload
Socket fd=10 (partner_fd=7, remote=1) EPOLLHUP so_error=0 (No error information)
Socket fd=10 (partner_fd=7, remote=1) closed, connection removed. total_read=3465 total_write=534 event_count=6
Socket fd=7 (partner_fd=0, remote=0) closed, connection removed. total_read=534 total_write=3465 event_count=7
Legs : local:0 remote:0