subrat243/Subrecon
GitHub: subrat243/Subrecon
一个单脚本自动化侦察流水线,将子域名枚举、存活探测与 URL 爬取串联为完整流程,解决漏洞赏金狩猎前期信息收集工具链拼装繁琐的问题。
Stars: 0 | Forks: 0
# subrecon
一个用于漏洞赏金狩猎的单脚本侦察流水线:子域名枚举、存活主机发现以及 URL 收集/爬取——串联在一起并保存到整洁的、按目标划分的输出目录树中。
## 功能说明
`subrecon.sh` 针对你提供的每个域名运行三个阶段:
1. **子域名枚举** — 合并并去重 `assetfinder`、`subfinder`、`amass`(被动模式)和 `crt.sh` 的结果,然后使用 `dnsx` 进行解析。匹配常见高价值模式(如 `api.`、`admin.`、`staging.`、`auth.` 等)的子域名会被单独标记。
2. **存活主机发现** — `httpx` 探测每个已解析的主机,进行技术检测、获取状态码和内容长度,并将结果拆分为响应 `200` 的主机和需要身份验证(`401`/`403`)的主机。
3. **URL 收集与爬取** — `katana` 主动爬取存活主机(包括解析 JS),同时 `gau` 和 `waybackurls` 拉取历史 URL。所有结果都会被合并,过滤掉静态资源,并通过 `uro` 标准化为最终的去重数据集。
最终结果是一个随时可用的 URL 列表,你可以直接将其输入到 `gf`、`nuclei`、`dalfox`、`qsreplace`、`sqlmap` 或你工作流中的其他后续工具中。
## 环境要求
必须安装以下工具并使其在你的 `$PATH` 中可用:
| 工具 | 用途 |
|---|---|
| [assetfinder](https://github.com/tomnomnom/assetfinder) | 子域名发现 |
| [subfinder](https://github.com/projectdiscovery/subfinder) | 被动子域名发现 |
| [amass](https://github.com/owasp-amass/amass) | 深度被动枚举 |
| [dnsx](https://github.com/projectdiscovery/dnsx) | DNS 解析 |
| [httpx](https://github.com/projectdiscovery/httpx) | 存活主机探测 + 技术检测 |
| [katana](https://github.com/projectdiscovery/katana) | 主动爬取(含 JS) |
| [waybackurls](https://github.com/tomnomnom/waybackurls) | 历史 URL(Wayback Machine) |
| [gau](https://github.com/lc/gau) | 历史 URL(多归档源) |
| [hakcheckurl](https://github.com/hakluke/hakcheckurl) | URL 存活过滤 |
| [anew](https://github.com/tomnomnom/anew) | 仅追加去重 |
| [uro](https://github.com/s0md3v/uro) | URL 列表标准化 |
| `curl` | crt.sh 证书透明度查询 |
大多数 [ProjectDiscovery](https://github.com/projectdiscovery) 工具可以通过 `go install` 安装,`tomnomnom`/`hakluke` 的工具也是如此。请查看各自代码库的 README 获取安装说明。
脚本会在启动时检查所有依赖项,并在执行任何操作前告知你缺少了什么。
## 安装说明
```
git clone https://github.com/subrat243/Subrecon.git
cd Subrecon
chmod +x subrecon.sh
```
## 使用说明
```
./subrecon.sh domain1.com [domain2.com ...]
```
### 选项
| 参数 | 描述 |
|---|---|
| `-v`, `--verbose` | 显示每个工具的完整输出/错误信息,而不仅仅是步骤名称和结果统计 |
| `-h`, `--help` | 显示帮助菜单 |
### 环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
| `BASE_DIR` | `$HOME/subrecon` | 保存结果的基础目录 |
### 示例
```
# 单个 target
./subrecon.sh target.com
# 一次运行多个 target
./subrecon.sh target.com second.com third.com
# Verbose 模式 — 查看每个 tool 的原始输出
./subrecon.sh -v target.com
# 将结果保存到其他位置
BASE_DIR=/data/recon ./subrecon.sh target.com
```
## 输出结构
每个目标都会在 `$BASE_DIR` 下拥有自己的目录:
```
$BASE_DIR//
├── subs/
│ ├── .txt # all discovered subdomains, deduped
│ └── resolved.txt # DNS-resolved (live) subdomains
├── live/
│ ├── httpx_output.txt # full httpx results (title, tech, status, etc.)
│ ├── alive_urls.txt # just the live URLs
│ ├── 200s.txt # hosts responding 200
│ └── auth_required.txt # hosts responding 401/403
├── js/
│ └── katana_urls.txt # URLs found via active + JS crawling
├── params/
│ └── _urls.txt # historical URLs from gau + waybackurls
├── findings/
│ └── priority_subs.txt # high-value subdomains (api., admin., staging., etc.)
├── all_urls.txt # everything merged, deduped, static assets filtered
└── clean_urls.txt # normalized final dataset — your main hunting file
```
`clean_urls.txt` 是你想要传递给链路中下一个工具的文件。
## 优先子域名模式
脚本会自动将匹配这些前缀的子域名标记到 `findings/priority_subs.txt` 中,因为它们通常会暴露更多攻击面:
```
api. admin. internal. dev. staging. auth. pay. money. chat.
```
## 注意事项
- 此工具会针对目标基础设施生成真实的网络流量(子域名暴力破解、主动爬取、HTTP 探测)。**请仅对你已获授权测试的域名运行此操作** —— 处于范围内的活跃漏洞赏金项目,或拥有明确的书面授权。
- 默认的速率限制较为保守(`httpx -rl 50`,`katana -rate-limit 20`)以避免猛烈攻击目标,但你仍应遵守每个项目特定的范围和速率限制规则。
- 对于较大的范围,在标准化之前,预计 `all_urls.txt` 中会有 10k–50k+ 个 URL。
## 许可证
MIT — 详见 [LICENSE](LICENSE)
标签:Bug Bounty, Cutter, GitHub, 可自定义解析器, 子域名枚举, 实时处理, 密码管理, 应用安全, 系统安全, 自动化流水线