0xDrakon/subprobe

GitHub: 0xDrakon/subprobe

基于 Python asyncio 构建的快速子域名枚举工具,通过异步 DNS 解析与可选 HTTP 探测发现并验证目标域名的活跃子域名。

Stars: 0 | Forks: 0

# 子探针 ``` _ _ ___ _ _| |_ ___ ___ ___| |_ ___ |_ -| | | . | . | _| . | . | -_| |___|___|___| _|_| |___|___|___| |_| https://github.com/0xDrakon ``` **基于 Python 构建的快速、异步子域名枚举工具。** 专为需要可靠、高速子域名发现及清晰、易读输出的安全研究人员和渗透测试人员设计。 ![subprobe 运行截图](https://media.discordapp.net/attachments/1500215146717380831/1501432151621636146/image.png?ex=69fc0d28&is=69fabba8&hm=a4ad0888450d035e3db9e98aae524b0ae5077c06de90cc2e287d4e506bcf63cb&=&format=webp&quality=lossless) ## 功能特性 **DNS 解析** - 通过 `dnspython` 进行完全异步的 A 记录解析,支持数百个并发查询 - 使用 `--aaaa` 进行 AAAA (IPv6) 记录解析 - CNAME 链检测与显示 - 在详细模式下报告 TTL 值 - 每次查询的 DNS 耗时(使用 `-v` 可见) - 可配置的 DNS 超时和重试次数 - 通过 `--resolvers` 支持自定义 nameserver **Wildcard DNS 检测** - 在扫描开始前自动探测两个随机子域名 - 检测 Wildcard DNS 配置并记录其 IP - 在扫描期间静默过滤任何与 Wildcard IP 匹配的结果 - 在摘要中显示被 Wildcard 过滤的条目数量 - 可通过 `--no-wildcard` 禁用 **HTTP 和 HTTPS 探测** - 可选择对每个子域名同时探测 HTTP 和 HTTPS endpoint - 状态码按类别进行颜色编码显示(2xx 绿色,3xx 黄色,4xx 红色,5xx 洋红色) - 从响应体中提取页面标题 - 以字节为单位跟踪响应大小(在详细模式下显示) - HTTP 响应耗时(毫秒,在详细模式下显示) - 可配置的请求超时 - 使用 `--no-redirects` 切换是否跟随重定向 - 支持自定义 User-Agent 字符串 - 使用 `--filter-status` 或 `--match-status` 按 HTTP 状态码过滤结果 **输出格式** - 带有进度条和预计剩余时间 (ETA) 的彩色终端输出 - 带有制表符分隔字段的纯文本文件输出 (`-o`) - 包含耗时和大小等所有字段的 JSON 输出 (`--json`) - 可直接导入电子表格的 CSV 输出 (`--csv`) - 用于管道传输到其他工具的静默模式 (`--silent`) - 禁止显示 banner 和 header 的安静模式 (`-q`) - 包含每个结果完整详情的详细模式 (`-v`) - 适用于不支持 ANSI 颜色终端的无色模式 (`--no-color`) **性能** - 基于 Asyncio,支持可配置的并发数(默认:300 个并发解析) - 信号量控制的突发请求,避免解析器过载 - 渲染到 stderr 的进度条及实时 ETA 估算 - 即使在扫描期间,stdout 也保持干净,便于管道传输 - 扫描完成后结果按字母顺序排序 **平台支持** - Windows(已在 Windows 10 和 11 上测试) - Linux(Debian、Ubuntu、Arch、Kali、Parrot 等) - macOS(Intel 和 Apple Silicon) - 通过 `colorama` 实现跨平台的彩色输出 ## 环境要求 - Python 3.10 或更高版本 - pip 包:`dnspython`、`aiohttp`、`colorama` ## 安装说明 **克隆并安装依赖:** ``` git clone https://github.com/0xDrakon/subprobe cd subprobe pip install -r requirements.txt ``` **在 Kali / Parrot(外部管理环境)上:** ``` pip install -r requirements.txt --break-system-packages ``` **在 Windows 上,请使用 `python` 代替 `python3`:** ``` python main.py -d example.com ``` ## 使用方法 ``` python3 main.py -d DOMAIN [options] ``` ### 目标 | 标志 | 描述 | |------|-------------| | `-d`, `--domain` | 目标域名 **(必填)** | ### 字典 | 标志 | 描述 | 默认值 | |------|-------------|---------| | `-w`, `--wordlist` | 主字典文件 | 内置(510 条) | | `--append` | 在主字典之上追加额外的字典,不产生重复项 | | ### DNS | 标志 | 描述 | 默认值 | |------|-------------|---------| | `-c`, `--concurrency` | 并发 DNS 解析数 | 300 | | `--timeout` | DNS 解析超时时间(秒) | 3.0 | | `--retries` | 失败时的 DNS 重试次数 | 1 | | `--resolvers` | 包含自定义 nameserver IP 的文件(每行一个) | Cloudflare/Google/Quad9 | | `--aaaa` | 同时解析 AAAA (IPv6) 记录 | off | | `--no-wildcard` | 跳过 Wildcard DNS 检测和过滤 | off | ### HTTP 探测 | 标志 | 描述 | 默认值 | |------|-------------|---------| | `--http` | 启用 HTTP/HTTPS 探测 | off | | `--http-timeout` | HTTP 请求超时时间(秒) | 5 | | `--no-redirects` | 不跟随 HTTP 重定向 | 跟随重定向 | | `--user-agent` | 自定义 User-Agent 字符串 | Chrome/124 | | `--filter-status` | 排除具有这些 HTTP 状态码的结果(例如 `404,403`) | | | `--match-status` | 仅显示具有这些 HTTP 状态码的结果(例如 `200,301`) | | | `--match-ip` | 仅显示解析到此 IP 的子域名 | | ### 输出 | 标志 | 描述 | |------|-------------| | `-o`, `--output` | 将结果保存为纯文本 | | `--json` | 将结果保存为 JSON | | `--csv` | 将结果保存为 CSV | | `-v`, `--verbose` | 显示 TTL、DNS 耗时、HTTP 大小、响应时间、所有 IP | | `-q`, `--quiet` | 禁止显示 banner 和扫描头信息 | | `--silent` | 仅打印找到的子域名,无任何修饰 | | `--no-color` | 禁用彩色输出 | ## 示例 **基本子域名扫描:** ``` python3 main.py -d example.com ``` **启用 HTTP 探测并将结果保存为所有格式:** ``` python3 main.py -d example.com --http -o out.txt --json out.json --csv out.csv ``` **使用自定义字典进行高并发扫描:** ``` python3 main.py -d example.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -c 500 ``` **仅显示具有活跃 HTTP 200 响应的子域名:** ``` python3 main.py -d example.com --http --match-status 200 ``` **排除 not-found 和 forbidden 结果:** ``` python3 main.py -d example.com --http --filter-status 404,403,410 ``` **带 IPv6 解析的详细输出:** ``` python3 main.py -d example.com -v --aaaa ``` **使用自定义 DNS 解析器并设置较慢的超时以提高准确性:** ``` python3 main.py -d example.com --resolvers resolvers.txt --timeout 5 --retries 2 ``` **将找到的子域名通过管道传递给其他工具:** ``` python3 main.py -d example.com --silent | httpx -silent python3 main.py -d example.com --silent | nmap -iL - python3 main.py -d example.com --silent > subs.txt ``` **合并多个字典:** ``` python3 main.py -d example.com -w primary.txt --append extra.txt ``` **禁止显示 banner 以用于脚本编写:** ``` python3 main.py -d example.com -q --json results.json ``` ## 输出格式 **默认终端输出:** ``` [+] admin.example.com 93.184.216.34, 93.184.216.35 [+] mail.example.com 93.184.216.36 +1 more -> mail.cdn.example.com └- http:200 https:301 "Admin Panel" ``` **详细终端输出 (`-v`):** ``` [+] mail.example.com +- IPv4 93.184.216.34, 93.184.216.35 +- IPv6 2606:2800:220:1:248:1893:25c8:1946 +- CNAME mail.cdn.example.com +- TTL 300s DNS: 42ms +- HTTP 200 38ms 14 KB +- HTTPS 301 91ms 0 B +- Title "Example Mail Portal" ``` **JSON 输出 (`--json`):** ``` [ { "subdomain": "mail.example.com", "ips": ["93.184.216.34"], "ipv6": ["2606:2800:220:1:248:1893:25c8:1946"], "cname": "mail.cdn.example.com", "ttl": 300, "dns_ms": 42.1, "http_status": 200, "https_status": 301, "title": "Example Mail Portal", "http_ms": 38.4, "https_ms": 91.2, "http_size": 14336, "https_size": 0 } ] ``` ## 扫描摘要 每次扫描结束后,subprobe 会打印一份摘要: ``` ------------------------------------------------------------ Status scan complete Scanned 510 Found 23 WC Filtered 12 Elapsed 4.81s (106 req/s) Saved (json) out.json ------------------------------------------------------------ ``` ## 默认 Nameserver subprobe 默认使用(轮询方式)以下解析器: | 提供商 | IP | |----------|----| | Cloudflare | 1.1.1.1 | | Google | 8.8.8.8 | | Quad9 | 9.9.9.9 | | OpenDNS | 208.67.222.222 | 你可以通过 `--resolvers` 传递一个文件来覆盖这些默认设置: ``` # resolvers.txt 1.1.1.1 8.8.8.8 94.140.14.14 ``` ## 文件结构 ``` subprobe/ +-- main.py Entry point +-- requirements.txt +-- wordlists/ | +-- default.txt Built-in wordlist (510 entries) +-- subprobe/ +-- __init__.py +-- banner.py ASCII art, color tags, separator helpers +-- cli.py Argument parsing, orchestration, wildcard detection +-- core/ | +-- resolver.py Async DNS (A, AAAA, CNAME, wildcard probe) | +-- scanner.py Scan engine, HTTP probing, filtering logic +-- utils/ +-- output.py Progress bar, result printer, JSON/CSV/TXT writers ``` ## 注意事项 - 进度条被写入 stderr,因此 stdout 保持干净,便于管道传输 - Wildcard DNS 检测在扫描开始前会运行两次探测查询 - 扫描完成后,结果会按字母顺序排序 - `--silent` 模式仅打印子域名,不包含颜色代码,对于任何下游工具都是安全的 - HTTP 探测会使请求数量翻倍(每个子域名一个 HTTP + 一个 HTTPS) ## 作者 由 [Drakon](https://github.com/0xDrakon) 制作 ## 许可证 MIT
标签:AAAA记录, A记录, Bug Bounty, CNAME记录, DNSPython, DNS解析, DNS记录查询, ESC4, GitHub, HTTPS, HTTP探测, OSINT, Python, Python异步, Wildcard DNS检测, 代码生成, 可自定义解析器, 子域名扫描器, 子域名枚举, 子域名爆破, 安全研究员, 开源项目, 异步编程, 无后门, 泛解析检测, 渗透测试工具, 漏洞扫描前提, 系统安全, 网络安全, 计算机取证, 逆向工具, 隐私保护