GoodbyeDPI — 深度包检测规避工具
本软件旨在绕过许多互联网服务提供商中用于阻止访问特定网站的深度包检测系统。
它处理通过光分路器或端口镜像连接的 DPI(被动 DPI),这些 DPI 不会阻止任何数据,只是比请求的目标更快地回复,以及串联连接的 主动 DPI。
需要 Windows 7、8、8.1、10 或 11 且具有管理员权限。
快速开始
- 针对俄罗斯:从发布页面下载最新版本,解压文件并运行 1_russia_blacklist_dnsredir.cmd 脚本。
- 针对其他国家:从发布页面下载最新版本,解压文件并运行 2_any_country_dnsredir.cmd。
这些脚本以推荐模式启动 GoodbyeDPI,并将 DNS 解析器重定向到非标准端口上的 Yandex DNS(以防止 DNS 污染)。
如果有效——恭喜!您可以直接使用或进一步配置。
如何使用
从发布页面下载最新版本并运行。
支持的参数
要获取有关您程序版本的相关信息,请在启动时使用 -h (--help) 参数。
Usage: goodbyedpi.exe [OPTION...]
-p block passive DPI
-q block QUIC/HTTP3
-r replace Host with hoSt
-s remove space between host header and its value
-m mix Host header case (test.com -> tEsT.cOm)
-f <value> set HTTP fragmentation to value
-k <value> enable HTTP persistent (keep-alive) fragmentation and set it to value
-n do not wait for first segment ACK when -k is enabled
-e <value> set HTTPS fragmentation to value
-a additional space between Method and Request-URI (enables -s, may break sites)
-w try to find and parse HTTP traffic on all processed ports (not only on port 80)
--port <value> additional TCP port to perform fragmentation on (and HTTP tricks with -w)
--ip-id <value> handle additional IP ID (decimal, drop redirects and TCP RSTs with this ID).
This option can be supplied multiple times.
--dns-addr <value> redirect UDP DNS requests to the supplied IP address (experimental)
--dns-port <value> redirect UDP DNS requests to the supplied port (53 by default)
--dnsv6-addr <value> redirect UDPv6 DNS requests to the supplied IPv6 address (experimental)
--dnsv6-port <value> redirect UDPv6 DNS requests to the supplied port (53 by default)
--dns-verb print verbose DNS redirection messages
--blacklist <txtfile> perform circumvention tricks only to host names and subdomains from
supplied text file (HTTP Host/TLS SNI).
This option can be supplied multiple times.
--allow-no-sni perform circumvention if TLS SNI can't be detected with --blacklist enabled.
--frag-by-sni if SNI is detected in TLS packet, fragment the packet right before SNI value.
--set-ttl <value> activate Fake Request Mode and send it with supplied TTL value.
DANGEROUS! May break websites in unexpected ways. Use with care (or --blacklist).
--auto-ttl [a1-a2-m] activate Fake Request Mode, automatically detect TTL and decrease
it based on a distance. If the distance is shorter than a2, TTL is decreased
by a2. If it's longer, (a1; a2) scale is used with the distance as a weight.
If the resulting TTL is more than m(ax), set it to m.
Default (if set): --auto-ttl 1-4-10. Also sets --min-ttl 3.
DANGEROUS! May break websites in unexpected ways. Use with care (or --blacklist).
--min-ttl <value> minimum TTL distance (128/64 - TTL) for which to send Fake Request
in --set-ttl and --auto-ttl modes.
--wrong-chksum activate Fake Request Mode and send it with incorrect TCP checksum.
May not work in a VM or with some routers, but is safer than set-ttl.
--wrong-seq activate Fake Request Mode and send it with TCP SEQ/ACK in the past.
--native-frag fragment (split) the packets by sending them in smaller packets, without
shrinking the Window Size. Works faster (does not slow down the connection)
and better.
--reverse-frag fragment (split) the packets just as --native-frag, but send them in the
reversed order. Works with the websites which could not handle segmented
HTTPS TLS ClientHello (because they receive the TCP flow "combined").
--fake-from-hex <value> Load fake packets for Fake Request Mode from HEX values (like 1234abcDEF).
This option can be supplied multiple times, in this case each fake packet
would be sent on every request in the command line argument order.
--fake-with-sni <value> Generate fake packets for Fake Request Mode with given SNI domain name.
The packets mimic Mozilla Firefox 130 TLS ClientHello packet
(with random generated fake SessionID, key shares and ECH grease).
Can be supplied multiple times for multiple fake packets.
--fake-gen <value> Generate random-filled fake packets for Fake Request Mode, value of them
(up to 30).
--fake-resend <value> Send each fake packet value number of times.
Default: 1 (send each packet once).
--max-payload [value] packets with TCP payload data more than [value] won't be processed.
Use this option to reduce CPU usage by skipping huge amount of data
(like file transfers) in already established sessions.
May skip some huge HTTP requests from being processed.
Default (if set): --max-payload 1200.
LEGACY modesets:
-1 -p -r -s -f 2 -k 2 -n -e 2 (most compatible mode)
-2 -p -r -s -f 2 -k 2 -n -e 40 (better speed for HTTPS yet still compatible)
-3 -p -r -s -e 40 (better speed for HTTP and HTTPS)
-4 -p -r -s (best speed)
Modern modesets (more stable, more compatible, faster):
-5 -f 2 -e 2 --auto-ttl --reverse-frag --max-payload
-6 -f 2 -e 2 --wrong-seq --reverse-frag --max-payload
-7 -f 2 -e 2 --wrong-chksum --reverse-frag --max-payload
-8 -f 2 -e 2 --wrong-seq --wrong-chksum --reverse-frag --max-payload
-9 -f 2 -e 2 --wrong-seq --wrong-chksum --reverse-frag --max-payload -q (this is the default)
Note: combination of --wrong-seq and --wrong-chksum generates two different fake packets.
如何检查
要检查您的 ISP 的 DPI 是否可以被绕过,首先通过启用浏览器中的“安全 DNS(DNS over HTTPS)”选项,确保您的提供商不会污染 DNS 响应。
然后不带任何选项运行 goodbyedpi.exe 可执行文件。如果它正常工作——恭喜!您可以直接将其使用,或进行进一步配置,例如,如果已知您所在国家/地区的被屏蔽网站列表且可获取,则可以使用 --blacklist 选项。
如果您的提供商拦截 DNS 请求,您可能希望使用 --dns-addr 选项指向运行在非标准端口上的公共 DNS 解析器(例如 Yandex DNS 77.88.8.8:1253),或使用第三方应用程序配置 DNS over HTTPS/TLS。
检查 .cmd 脚本并根据您的偏好和网络条件进行修改。
工作原理
被动 DPI
大多数被动 DPI 在尝试通过 HTTP 访问被屏蔽网站时发送 HTTP 302 重定向,在 HTTPS 情况下发送 TCP 重置,且速度比目标网站更快。DPI 发送的数据包通常具有等于 0x0000 或 0x0001 的 IP 标识字段,这在俄罗斯提供商中可见。如果这些数据包将您重定向到另一个网站(审查页面),它们会被 GoodbyeDPI 阻止。
主动 DPI
主动 DPI 更难欺骗。目前该软件使用 7 种方法来规避主动 DPI:
- 首个数据包的 TCP 层分片
- 持久(keep-alive)HTTP 会话的 TCP 层分片
- 用
hoSt替换Host头部 - 移除
Host头部中名称与值之间的空格 - 在 HTTP 方法(GET、POST 等)与 URI 之间添加额外空格
- 混合 Host 头部值的大小写
- 发送具有低 Time-To-Live 值、错误校验和或错误 TCP 序列号/确认号的伪造 HTTP/HTTPS 数据包,以欺骗 DPI 并阻止其送达目的地
这些方法不应破坏任何网站,因为它们完全兼容 TCP 和 HTTP 标准,但足以阻止 DPI 数据分类并规避审查。额外空格可能会破坏某些网站,尽管 HTTP/1.1 规范(参见 19.3 Tolerant Applications)允许这样做。
该程序加载 WinDivert 驱动程序,该驱动程序使用 Windows Filtering Platform 设置过滤器并将数据包重定向到用户空间。只要控制台窗口可见,它就会持续运行,并在关闭窗口时终止。
如何从源代码构建
该项目可以使用 GNU Make 和 mingw 进行构建。唯一的依赖项是 WinDivert。
要构建 x86 exe,请运行:
make CPREFIX=i686-w64-mingw32- WINDIVERTHEADERS=/path/to/windivert/include WINDIVERTLIBS=/path/to/windivert/x86
而对于 x86_64:
make CPREFIX=x86_64-w64-mingw32- BIT64=1 WINDIVERTHEADERS=/path/to/windivert/include WINDIVERTLIBS=/path/to/windivert/amd64
如何安装为 Windows 服务
查看 service_install_russia_blacklist.cmd、service_install_russia_blacklist_dnsredir.cmd 和 service_remove.cmd 脚本中的示例。
根据您自己的需求进行修改。
已知问题
- 严重过时的 Windows 7 安装由于缺少对 SHA256 数字签名的支持,无法加载 WinDivert 驱动程序。请安装 KB3033929 x86/x64,或者更好的做法是使用 Windows Update 更新整个系统。
- Intel/Qualcomm Killer 网卡:Killer Control Center 中的
Advanced Stream Detect与 GoodbyeDPI 不兼容,请禁用它。 - QUIK 交易软件 可能会干扰 GoodbyeDPI。请先启动 QUIK,然后再启动 GoodbyeDPI。
某些 SSL/TLS 栈无法处理分片的 ClientHello 数据包,导致 HTTPS 网站无法打开。Bug:#4、#64。分片问题已在 v0.1.7 中修复。ESET 杀毒软件与 WinDivert 驱动程序不兼容 #91。这很可能是杀毒软件的 Bug,而不是 WinDivert 的问题。
类似项目
- zapret by @bol-van (for MacOS, Linux and Windows)
- Green Tunnel by @SadeghHayeri (for MacOS, Linux and Windows)
- DPI Tunnel CLI by @zhenyolka (for Linux and routers)
- DPI Tunnel for Android by @zhenyolka (for Android)
- PowerTunnel by @krlvm (for Windows, MacOS and Linux)
- PowerTunnel for Android by @krlvm (for Android)
- SpoofDPI by @xvzc (for macOS and Linux)
- SpoofDPI-Platform by @r3pr3ss10n (for Android, macOS, Windows)
- GhosTCP by @macronut (for Windows)
- ByeDPI for Linux/Windows + ByeDPIAndroid / ByeByeDPI for Android (no root)
- youtubeUnblock by @Waujito (for OpenWRT/Entware routers and Linux)
致谢
感谢 @basil00 的 WinDivert。这是该程序的主要部分。
感谢每一位 BlockCheck 的贡献者。如果没有这个工具,理解 DPI 的行为将是不可能的。