NotChaosuu/wafprobe

GitHub: NotChaosuu/wafprobe

一款通过逐维度突变客户端指纹来精确诊断 WAF 拦截原因的探测工具,帮助你告别爬虫被 403 时的盲目猜测。

Stars: 1 | Forks: 0

# wafprobe [![Go 版本](https://img.shields.io/badge/go-1.25+-00ADD8?style=flat-square&logo=go)](https://go.dev/) [![许可证](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE) [![发布版本](https://img.shields.io/github/v/release/NotChaosuu/wafprobe?style=flat-square&color=orange)](https://github.com/NotChaosuu/wafprobe/releases) [![Go 报告卡](https://goreportcard.com/badge/github.com/NotChaosuu/wafprobe?style=flat-square)](https://goreportcard.com/report/github.com/NotChaosuu/wafprobe) **别再瞎猜你的爬虫为什么总是收到 403 了。** wafprobe 会发射精准的探测请求,每次只修改一个指纹维度——TLS 版本、ALPN、SNI、User-Agent、请求头——并准确告诉你 WAF 在检查哪些特征信号。当某个请求成功通过时,它会提供一条可直接复制粘贴的 curl 命令来复现该结果。 ## 安装 **预编译二进制文件(最快)** ``` # macOS / Linux curl -sL https://github.com/NotChaosuu/wafprobe/releases/latest/download/wafprobe_$(uname -s)_$(uname -m).tar.gz | tar xz sudo mv wafprobe /usr/local/bin/ # Windows — 从 Releases 标签页下载 ``` **Go 安装** ``` go install github.com/NotChaosuu/wafprobe/cmd/wafprobe@latest ``` 需要 Go 1.25 —— utls 1.8 要求了该版本。如果你使用的是 Go 1.24,请使用旧版 utls 进行构建(需要修改 `go.mod`) —— chrome-133 人设依赖于 1.8 中才有的预设。 ## 快速开始 ``` $ wafprobe hunt https://www.cloudflare.com baseline (chrome-latest): pass — cloudflare force TLS 1.2 tls-version pass ALPN: http/1.1 only alpn pass SNI: omit sni err UA: curl/8.0 user-agent pass UA: Googlebot user-agent pass drop all cookies cookies pass ... Target checks: (none) Target ignores: alpn, cookies, headers, method, tls-version, user-agent Verdict: target passes baseline; nothing tested mattered. ``` ## wafprobe 与 wafw00f 对比 wafw00f 用于检测存在哪种 WAF。而 wafprobe 能告诉你**为什么**会被拦截,以及如何突破它。 | 功能 | wafprobe | wafw00f | |---|---|---| | 单一指纹维度突变探测 | ✅ | ❌ | | TLS / JA4 探测 | ✅ | ❌ | | Kasada、Shape、PerimeterX 检测 | ✅ | ❌ | | 用于有状态重放的 HAR 导入 | ✅ | ❌ | | 可直接复制粘贴的绕过 curl 输出 | ✅ | ❌ | | 层级标签标记(传感器 / 验证 / 拦截) | ✅ | ❌ | | 带有 body 和 cookies 的 POST 模式 | ✅ | ❌ | | 代理支持(住宅代理格式) | ✅ | ❌ | | 仅厂商识别 | ❌ | ✅ | | 被动指纹识别 | ❌ | ✅ | 如果你只想知道厂商名称,请使用 wafw00f。如果你需要了解*它到底在检查什么*,请使用 wafprobe。 ## 为什么开发这个工具 在某几个网站上,我花了太多时间去搞清楚为什么我的爬虫被 403 拦截,而在另一些网站上却没有。curl-impersonate 在这里管用,在那里又失效了。修改 User-Agent 对某个目标毫无作用,却修好了另一个目标。根本无法判断某个具体的 WAF 到底在意哪个指纹维度,所以只能靠猜。wafprobe 终结了这种盲目猜测。 ## 使用指南 两个主要命令: **`probe`** —— 快速的“摸底排查”。并行运行每个内置人设(Chrome / Firefox / Safari / iOS / 原生 Go / 原生 Python)。 ``` wafprobe probe https://target.com wafprobe probe --personas chrome-latest,go-stdlib https://target.com ``` **`hunt`** —— 运行 21 个突变探测(使用 `--deep` 参数则为 66 个),每次只调整一个指纹维度。当 `probe` 显示某个请求被拦截时使用此命令。 ``` wafprobe hunt https://target.com wafprobe hunt --deep https://target.com ``` **HAR 导入** —— 针对带有由 JS 动态注入请求头(Shape 的 `X--` 系列特征、Akamai 的 `_abck` cookie、Kasada 的 `x-kpsdk-*` token)的网站,你无法从零开始探测——因为这些值是由浏览器的 JS 传感器生成的。但是你可以抓取真实浏览器的请求并重放它: ``` # 在 Chrome DevTools → Network → “Save all as HAR with content” wafprobe import-har -o cap.json --filter "auth/login" devtools.har wafprobe hunt --persona-file cap.json https://api.target.com/auth/login ``` `import-har` 会标记它在抓取到的请求头中发现的任何 Shape 或 Kasada 签名,这是确认你抓取了正确请求的快捷方法。 **POST 模式** —— 用于真正触发机器人防护的身份验证端点: ``` wafprobe hunt --method POST \ --body @login.json \ --header "Content-Type: application/json" \ --header "Origin: https://target.com" \ --cookie "session=abc; csrf=xyz" \ https://api.target.com/v1/auth/login ``` **代理支持** —— 支持三种格式: ``` --proxy user:pass@host:port # URL format --proxy host:port:user:pass # residential panel format --proxy socks5://host:port # SOCKS5 ``` 同时支持 utls 路径和原生 Go 路径的代理路由。 ## 检测目标 针对八种厂商,每种都带有层级标签——`pass`(通过)、`sensor`(分析但不拦截)、`http`(拦截页面)、`challenge`(JS 验证页面)、`rate-limit`(频率限制): | 厂商 | 备注 | |---|---| | **Cloudflare** | 区分 Managed Challenge(`cf_clearance` 验证页面)和 Turnstile 组件(表单上的验证码)。不同的问题,不同的解决方案。 | | **Akamai** | 将 Bot Manager(`_abck`/`_bman`/`bm_sz`/`ak_bmsc`)与普通的 Akamai CDN 区分开来。许多网站通过 Akamai 的 CDN 进行路由,但实际的机器人防护工作是由 Kasada 或 Shape 完成的——不要以为看到 `Server: AkamaiGHost` 就意味着开启了 BM。 | | **DataDome** | 全面检测 | | **PerimeterX / HUMAN** | 全面检测 | | **Imperva / Incapsula** | 全面检测 | | **AWS WAF** | 全面检测 | | **Kasada** | `X-KPSDK-*` 请求头、`/ips.js` 脚本,默认拦截状态码为 429 | | **Shape / F5 XC Bot Defense** | 使用正则表达式 `X-[A-Za-z0-9]{6,12}-[A-Z][0-9]?` 模式匹配 `X-<8字符id>-<字母>` 系列请求头。已通过真实的 Uniqlo 登录流量验证。 | 了解防护层级至关重要。“Sensor”意味着你仍然可以通过——“Challenge”意味着你需要采取完全不同的方法。 ## 局限性 有几个诚实的限制,否则 README 写得就像推销手册了。 **浏览器人设下的 TLS 版本突变无效。** utls 的预设 `ClientHelloID` 在其扩展列表中硬编码了 `supported_versions`。该突变在 `go-stdlib` 和 `python-requests` 上可以正常工作。如果你特别想测试 TLS 1.2 拒绝情况:请使用 `wafprobe hunt --persona go-stdlib`。 **许多机器人管理厂商不会在首页触发拦截。** Shape、Kasada、PerimeterX 通常只在 `/login`、`/cart`、`/api/auth/*` 等页面上才触发。如果在你知道有机器人防护的网站上运行 `probe` 报告为干净通过,请将其指向身份验证端点。 **HTTP/2 SETTINGS 帧指纹识别尚不是探测维度。** Akamai BM 和 DataDome 都会检查这一点。已在开发计划中。 **省略 SNI 只是尽力而为。** 无论我们如何设置,utls 可能仍然会发送该扩展。如果 `SNI: omit` 显示为 `err`,就是这个原因。 **不解决 JS 验证。** wafprobe 用于诊断你是否需要 JS 解决方案——它本身并不提供该功能。 ## 在 Windows 上使用 如果你的 URL 中包含 `&`,请用双引号将其包裹起来: ``` wafprobe.exe hunt "https://target.com/path?a=1&b=2" ``` cmd.exe 会将 `&` 视为命令分隔符,并会静默地截断 URL。PowerShell 和 POSIX shells 则可以正常处理。 ## 测试 ``` go test ./... ``` 内部包的覆盖率约为 80%。CI 在 Linux、macOS 和 Windows 上运行。 ## 开发路线图 - [ ] HTTP/2 SETTINGS 帧指纹识别 (Akamai BM / DataDome) - [ ] JA4 指纹导出 - [ ] Antibot 评分(复合指纹风险评分) - [ ] JSON 输出模式,以便通过管道传递给其他工具 ## 相关工具 为侦察流水线与 wafprobe 并行开发的工具: - [**apkxray**](https://github.com/NotChaosuu/apkxray) — 静态 APK 快速分析:密钥、端点、SDK、深度链接 - [**authmap**](https://github.com/NotChaosuu/authmap) — 绘制身份验证流程,发现错误配置,检测 SQLi/XSS/CSRF/CORS - [**tlsprint**](https://github.com/NotChaosuu/tlsprint) — 以 Antibot 系统的视角查看你的 TLS 指纹 MIT 许可证 · [Chaosuu](https://t.me/chaosuudev) · [github.com/NotChaosuu](https://github.com/NotChaosuu)
标签:403错误排查, Akamai, AppImage, AWS WAF, CISA项目, Cloudflare, DataDome, DNS枚举, EVTX分析, Go语言, HTTP指纹, Imperva, JA3, Kasada, MITRE ATT&CK, PerimeterX, Radare2, Shape Security, TLS指纹, User-Agent, WAF指纹识别, WAF探测, WAF绕过, Web应用防火墙, 二进制发布, 多架构支持, 安全测试, 密码管理, 开源工具, 指纹变异, 攻击性安全, 日志审计, 爬虫技术, 程序破解, 网站防护绕过, 网络安全, 网络安全工具, 请求头构造, 请求探测, 逆向分析, 防爬绕过, 隐私保护