ExHo7/HTBRecon
GitHub: ExHo7/HTBRecon
针对 Hack The Box 等 CTF 平台的一键式自动化侦察工具,整合十余款渗透工具实现从端口扫描到报告生成的全流程覆盖。
Stars: 0 | Forks: 0
# HTBRecon
```
__ ____________ ____
/ / / /_ __/ __ )/ __ \___ _________ ____
/ /_/ / / / / __ / /_/ / _ \/ ___/ __ \/ __ \
/ __ / / / / /_/ / _, _/ __/ /__/ /_/ / / / /
/_/ /_/ /_/ /_____/_/ |_|\___/\___/\____/_/ /_/
```
## 功能
- 使用 nmap 进行**全端口扫描**(SYN + 服务检测)
- 使用 WhatWeb 对所有 HTTP/HTTPS 端口进行**Web 指纹识别**
- 通过 ffuf vhost 模糊测试进行**子域名枚举**(自动添加到 `/etc/hosts`)
- 对发现的子域名执行 **WhatWeb 扫描**,以实现完整的技术栈覆盖
- 使用 ffuf 对所有主机名和端口进行**目录暴力破解**
- 使用 Nuclei 进行**漏洞扫描**(自动扫描模式,critical→low)
- 使用 EyeWitness 获取 **Web 截图**——所有 HTTP 端口 + 子域名的无头 Chrome 截图
- 使用 vulnx 获取 **CVE 情报**——搜索每种检测到的技术的 CVE
- 使用 enum4linux-ng + netexec 进行 **SMB 枚举**(共享、用户、NTLM 反射、NoPac、杀软检测)
- 使用 nxc spider_plus 进行 **SMB 共享爬取**——递归列出共享并标记敏感文件(`.ps1`、`.xml`、`.kdbx`、`.pfx` 等)
- 使用 nxc 进行 **RID 暴力破解**——在没有提供凭据时,通过 RID 循环枚举域用户
- 使用 ldapsearch 进行 **LDAP 枚举**(基础 DN、用户、管理员、AS-REP/Kerberoast 哈希、ADCS、委派、BadSuccessor)
- 使用 kerbrute 进行 **Kerberos 用户枚举**——在不触发锁定的情况下根据 KDC 验证用户名(无需凭据)
- 使用 BloodHound/nxc 进行 **Active Directory 信息收集**(需要凭据)——管理员用户、SPN、DCSync 主体
- **密码喷洒**——在感知锁定策略的情况下测试 username=password 组合
- 使用 nxc 进行 **WinRM 访问检查**——在凭据可用时验证端口 5985/5986 上的 shell 访问权限
- 由 Claude (Anthropic) 提供支持的 **AI 分析**——建议攻击向量和后续步骤
- 每次运行结束时生成 **Markdown 报告**
- **Debug 模式**——按需提供详细的命令日志
## 环境要求
- Python 3.10+
- [Exegol](https://github.com/ThePorgs/Exegol) 容器或 Kali Linux 环境
- Exegol 中可用的工具:`nmap`、`ffuf`、`nuclei`、`whatweb`、`enum4linux-ng`、`nxc`、`ldapsearch`、`kerbrute`、`bloodhound-python`
- EyeWitness 位于 `/opt/tools/EyeWitness/Python/EyeWitness.py`(Exegol 中预装)
- `vulnx` 二进制文件(通过 `htbrecon setup` 安装,见下文)
- Anthropic API 密钥(可选,用于 AI 分析)
## 安装
在你的 Exegol 容器内:
```
git clone https://github.com/ExHo7/HTBRecon.git /opt/tools/HTBRecon
cd /opt/tools/HTBRecon
pip install -e .
cd /workspace
```
然后安装 `vulnx` 依赖:
```
htbrecon setup
```
这将从 GitHub releases 下载最新的 `vulnx` 二进制文件并将其安装到 `/usr/local/bin/vulnx`。
使用 `--force` 重新安装现有版本:
```
htbrecon setup --force
```
## 使用方法
### 针对 HTB 机器的基础运行
```
htbrecon run -i 10.10.11.42 -n machinename
```
该命令将:
1. 创建 `results/machinename/` 目录,并包含每个工具的子目录
2. 将 `10.10.11.42 machinename.htb` 添加到 `/etc/hosts`
3. 运行完整流水线并生成 `results/machinename/report.md`
### 使用凭据
```
htbrecon run -i 10.10.11.42 -n machinename --credentials admin:Password123
```
凭据可解锁额外的扫描器:SMB 漏洞检查、LDAP 完整导出、BloodHound 收集、WinRM 访问检查。
提供凭据时,将跳过 Kerbrute 和 RID 暴力破解(因为不再需要用户枚举)。
### 针对其他平台的自定义域名
```
htbrecon run -i 10.10.11.42 -n dc01 --domain corp.local
```
将目标设为 `dc01.corp.local` 而不是 `dc01.htb`。
### 跳过 AI 分析
```
htbrecon run -i 10.10.11.42 -n machinename --skip-ai
```
### Debug 模式
```
htbrecon run -i 10.10.11.42 -n machinename --debug
```
将执行的每个命令、其退出代码以及持续时间打印到控制台。
无论是否使用此标志,Debug 输出始终会写入 `results/machinename/htbrecon.log`。
### 帮助
```
htbrecon --help
htbrecon run --help
```
## 流水线
```
Phase 1 — Setup
└─ Create output directories
└─ Add target to /etc/hosts
Phase 2 — Port Discovery
└─ nmap -sS -sV -F -Pn
Phase 3 — Service Enumeration (parallel)
├─ WhatWeb (if HTTP ports found)
├─ SMB (if port 139/445 open)
│ └─ RID brute-force (if no credentials)
└─ LDAP (if port 389/636/3268 open)
Phase 3a — SMB Share Spidering
└─ nxc spider_plus (if SMB open — anonymous or authenticated)
Phase 3b — Kerberos User Enumeration
└─ kerbrute userenum (if port 88 open AND no credentials)
Phase 3c — Active Directory (BloodHound)
└─ nxc + bloodhound-python (if LDAP open AND credentials provided)
Phase 3d — Password Spray
└─ nxc smb username=password (if SMB open)
Phase 3e — WinRM Access Check
└─ nxc winrm (if port 5985/5986 open AND credentials provided)
Phase 4 — Web Reconnaissance
├─ ffuf subdomain fuzzing → /etc/hosts
├─ WhatWeb on discovered subdomains
├─ ffuf directory brute-force (parallel, all hostnames)
├─ Nuclei vulnerability scan (parallel)
└─ EyeWitness screenshots (parallel, all URLs + subdomains)
Phase 5 — CVE Intelligence
└─ vulnx searches CVEs for every detected technology
Phase 6 — AI Analysis (skippable)
└─ Claude Sonnet analyzes findings, suggests attack vectors
Phase 7 — Report Generation
└─ Markdown report → results//report.md
```
## 输出
所有结果均保存在 `results//` 下:
```
results/machinename/
├── htbrecon.log # Full debug log
├── report.md # Final reconnaissance report
├── eyewitness_urls.txt # URL list fed to EyeWitness
├── nmap/
│ ├── full_scan.nmap
│ └── full_scan.xml
├── web/
│ └── whatweb_*.txt
├── ffuf/
│ ├── subdomains.json
│ └── dirs_*.json
├── nuclei/
│ ├── targets.txt
│ └── scan.jsonl
├── eyewitness/ # Web screenshots (HTML report + PNG files)
├── smb/
│ ├── enum4linux.txt
│ ├── nxc_shares.txt
│ └── nxc_rid_brute.txt
├── spider/ # SMB spider JSON output
├── kerbrute/
│ └── kerbrute.txt
├── ldap/
│ └── ldapsearch.txt
├── winrm/
│ └── winrm.txt
└── vulnx/
```
## 扫描器触发条件
| 扫描器 | 条件 |
|---------|-----------|
| WhatWeb | HTTP/HTTPS 端口开放 |
| SMB enum | 端口 139 或 445 开放 |
| RID brute-force | SMB 开放 **且** 无凭据 |
| SMB spider_plus | SMB 开放(匿名或已认证) |
| LDAP enum | 端口 389、636、3268 或 3269 开放 |
| Kerbrute | 端口 88 开放 **且** 无凭据 |
| BloodHound | LDAP 开放 **且** 提供了凭据 |
| Password spray | SMB 开放 |
| WinRM check | 端口 5985 或 5986 开放 **且** 提供了凭据 |
| EyeWitness | HTTP/HTTPS 端口开放 |
| Nuclei | HTTP/HTTPS 端口开放 |
| vulnx | 始终执行(如果已安装) |
| AI analysis | 始终执行(除非使用 `--skip-ai`) |
## 环境变量
| 变量 | 描述 |
|----------|-------------|
| `ANTHROPIC_API_KEY` | AI 分析所需。省略或使用 `--skip-ai` 可禁用。 |
## 注意事项
- 专为 **Hack The Box** 及类似 CTF/实验环境设计。请负责任地使用,并仅针对您拥有或获得明确测试权限的机器。
- `/etc/hosts` 会被直接修改——需要写入权限(在 Exegol 容器内为标准配置)。
- IP 地址格式会在启动时进行验证——无效的 IP 将在任何扫描开始前产生明确的错误提示。
标签:Active Directory, AI分析, BloodHound, CTF工具, CVE情报, enum4linux, ffuf, Google, Hack The Box, Kerberos攻击, LDAP枚举, Markdown报告, Nmap, Nuclei, Plaso, RID爆破, SMB枚举, WhatWeb, WinRM, 子域名爆破, 密码喷洒, 密码管理, 插件系统, 敏感文件扫描, 数据包嗅探, 漏洞搜索, 网络安全, 网络安全审计, 自动化侦察, 虚拟驱动器, 逆向工具, 隐私保护, 黑盒测试