mukul975/Threatswarm
GitHub: mukul975/Threatswarm
基于 Claude Code 的 27 智能体协同渗透测试插件,覆盖从侦察到报告的完整攻击链并强制执行范围限制。
Stars: 19 | Forks: 1
## 为什么选择 ThreatSwarm
大多数 AI 渗透测试工具在漏洞利用阶段就停止了。ThreatSwarm 在单次会话中运行完整的杀伤链 —— 侦察、漏洞利用、后渗透、DFIR 以及包含 CVSS 评分的报告。它作为单命令的 Claude Code 插件交付(无需 Docker、Postgres 或云账号),在所有 27 个智能体的每次工具调用中强制执行范围限制,并从映射到 ATT&CK、CSF 2.0、ATLAS、D3FEND 和 AI RMF 的 [754 项技能 Anthropic-Cybersecurity-Skills 库](https://github.com/mukul975/Anthropic-Cybersecurity-Skills)中加载其方法论。
## 演示
```
$ claude --plugin-dir ./threatswarm-plugin
> /threatswarm:engage 10.10.10.5
✓ scope check — 10.10.10.5 found in scope.txt
→ recon agent starting...
[*] nmap -sS -T3 -p- 10.10.10.5
22/tcp open ssh OpenSSH 8.9p1
80/tcp open http Apache httpd 2.4.51
8080/tcp open http Apache Tomcat 9.0.45
3306/tcp open mysql MySQL 8.0.28
[*] nuclei -u http://10.10.10.5:8080 -severity critical,high
[critical] CVE-2021-44228 Log4Shell RCE http://10.10.10.5:8080
[high] CVE-2020-1938 Tomcat AJP Ghostcat http://10.10.10.5:8080
[*] feroxbuster -u http://10.10.10.5 -x php,txt
200 /admin Apache Tomcat Manager [auth required]
200 /api/v1/users [JSON, 247 entries]
200 /backup.zip [3.2 MB]
Attack vectors — prioritised:
1 [CRITICAL] Log4Shell RCE → /threatswarm:attack 10.10.10.5 exploit CVE-2021-44228
2 [HIGH] API user enum → /threatswarm:attack 10.10.10.5 api
3 [HIGH] Backup file → /threatswarm:attack 10.10.10.5 web
> /threatswarm:attack 10.10.10.5 exploit CVE-2021-44228
→ exploit agent [model: claude-opus-4-7]
→ vuln-researcher confirming PoC reliability... weaponized ✓
→ listener started on 10.10.14.1:4444
→ payload delivered via X-Api-Version header
[+] shell obtained — www-data@10.10.10.5
> /threatswarm:pwned 10.10.10.5
→ post-ex agent
[*] sudo -l → (ALL : ALL) NOPASSWD: /usr/bin/python3
[+] privesc → root@10.10.10.5
[*] /etc/shadow extracted → evidence/20260429/10.10.10.5/creds/shadow.hashes
[*] crackmapexec smb 10.10.10.0/24 → 3 hosts reachable with root hash
> /threatswarm:report 10.10.10.5
→ report-writer agent → reports/10.10.10.5_pentest.md ✓
```
*全程强制执行范围。证据写入 `evidence/20260429/10.10.10.5/`。*
## 安装
**应用市场**(推荐 —— 安装到任何项目):
```
/plugin marketplace add mukul975/ThreatSwarm
/plugin install threatswarm@threatswarm
```
**独立运行** —— 克隆并直接使用:
```
git clone https://github.com/mukul975/ThreatSwarm && cd ThreatSwarm
claude
```
**单次会话** —— 直接加载而不安装:
```
git clone https://github.com/mukul975/ThreatSwarm
claude --plugin-dir ./ThreatSwarm/threatswarm-plugin
```
## 快速开始
1. 将授权目标添加到 `scope.txt`:
10.10.10.5
10.10.10.0/24
example.com
2. 在 `.claude/settings.json` 中设置你的攻击者 IP → `"LHOST": "10.10.14.1"`
3. 运行 `claude` 并启动杀伤链:
/threatswarm:engage 10.10.10.5 # 侦察 → 排序后的攻击向量
/threatswarm:attack 10.10.10.5 web # 路由到专家智能体
/threatswarm:pwned 10.10.10.5 # 获取 shell 后:权限提升 → 凭据 → 横向移动
/threatswarm:hunt "C2 beaconing" # ATT&CK 映射的威胁狩猎
/threatswarm:ir ransomware # DFIR 分类
/threatswarm:report engagement # 包含 CVSS 评分的 PDF 报告
## 27 个智能体
| 智能体 | 领域 | 核心工具 |
|---|---|---|
| **— 进攻 —** | | |
| `recon` | 端口扫描 · 服务枚举 · 子域名发现 | nmap, nuclei, httpx, subfinder, amass |
| `exploit` | CVE 漏洞利用 · 初始 shell 访问 | Metasploit, searchsploit, PoC 分析 |
| `post-ex` | 权限提升 · 横向移动 · 权限维持 | linpeas, mimikatz, secretsdump |
| `web-attacker` | SQLi · XSS · SSRF · LFI · OWASP Top 10 | sqlmap, Burp Suite, ffuf, dalfox |
| `api-attacker` | REST · GraphQL · gRPC · BOLA · JWT 攻击 | RESTler, jwt_tool, arjun |
| `active-directory` | Kerberoast · DCSync · BloodHound · ADCS ESC1-8 | Impacket, BloodHound, certipy |
| `network-ops` | ARP 欺骗 · MitM · SMB 中继 · 数据包捕获 | Responder, Bettercap, tshark |
| `osint` | 域名情报 · 邮箱收集 · 泄露数据 | Shodan, theHarvester, SpiderFoot |
| `wireless-attacker` | WPA2/WPA3 · 邪恶双子 · PMKID · EAP 捕获 | aircrack-ng, hostapd-wpe, hcxdumptool |
| `cloud-attacker` | AWS · Azure · GCP · IAM 提权 · S3 滥用 | Pacu, ScoutSuite, aws-cli |
| `container-attacker` | Docker 逃逸 · K8s RBAC · etcd · namespace 突破 | Trivy, kube-hunter, kubectl |
| `mobile-attacker` | Android · iOS · APK 反编译 · Frida · SSL 绕过 | MobSF, Frida, jadx, apktool |
| `social-engineer` | 钓鱼模拟 · 借口 · 语音钓鱼 · GoPhish | GoPhish, evilginx2, SET |
| `evasion` | AMSI 绕过 · AV/EDR 规避 · LOTL · 沙箱检测 | Donut, LOLBins, 混淆 |
| `c2-operator` | C2 基础设施 · 植入配置 · HTTPS 隐蔽 | Sliver, Havoc, MSF handler |
| **— 专家 —** | | |
| `crypto-attacker` | TLS 审计 · JWT 攻击 · Padding Oracle · RSA 弱密钥 | testssl.sh, sslscan, padbuster |
| `iot-attacker` | 固件提取 · UART/JTAG · MQTT · Modbus | binwalk, RouterSploit, EMBA |
| `password-attacks` | 哈希破解 · 字典生成 · 凭据填充 | hashcat, John, CeWL |
| `vuln-researcher` | CVE 分析 · CVSS 评分 · PoC 可靠性 | Nessus, searchsploit, NVD API |
| `reverse-engineer` | 二进制逆向 · ROP 链 · shellcode · CTF 二进制 | Ghidra, Radare2, GDB, pwntools |
| `malware-analyst` | 静态/动态分析 · IOC 提取 · YARA 规则 | YARA, Cuckoo, PE-studio |
| **— 防御 —** | | |
| `dfir` | 内存取证 · 磁盘取证 · 事件分类 | Volatility3, AVML, Timesketch |
| `threat-hunter` | ATT&CK 狩猎 · C2 信标 · 权限维持检测 | Elastic SIEM, Splunk, Velociraptor |
| `blue-team` | 加固 · Sigma 规则 · Sysmon · CIS 基准 | Sigma, Wazuh, auditd, fail2ban |
| `log-analyst` | 日志解析 · 异常检测 · 关联 | Splunk, ELK, wevtutil |
| `compliance-scanner` | CIS · PCI-DSS · NIST CSF · SOC 2 · GDPR | OpenSCAP, Lynis, kube-bench |
| `report-writer` | 渗透测试报告 · 执行摘要 · CVSS 3.1 | Markdown, 证据聚合 |
## 范围强制执行
`scope_check.py` 作为 `PreToolUse` 钩子在**每一次** Bash 命令前运行。它从命令中提取 IP 和主机名,在具有完整 CIDR 感知能力的情况下根据 `scope.txt` 解析它们,并返回退出代码 2 以阻止超出范围的命令。Claude 无法覆盖此行为 —— 该钩子在智能体循环之外执行。
**scope.txt 示例:**
```
# 授权目标 — 在开始任何 engagement 之前添加
10.10.10.5
10.10.10.0/24
*.example.com
api.acme-staging.io
```
**scope.yaml 示例(兼容 HackerOne RoE):**
```
# ThreatSwarm scope file — 直接映射自 HackerOne program rules
targets:
in_scope:
- type: cidr
value: "10.10.10.0/24"
note: "Internal lab network"
- type: domain
value: "*.example.com"
note: "All subdomains in scope"
- type: ip
value: "192.168.1.100"
out_of_scope:
- "prod.example.com"
- "10.10.10.254" # firewall — do not touch
engagement:
type: "blackbox"
authorized_by: "Jane Smith, CISO"
authorization_date: "2026-04-29"
rules_of_engagement: "No DoS, no data exfiltration, stop-and-report on critical finds"
```
三层强制执行并行运行。
## 架构
**三层安全模型:**
**第 1 层 — `scope_check.py`(确定性钩子)**
在每次 Bash 命令前运行。提取 IP 和主机名,在具有 CIDR 感知能力的情况下对照 `scope.txt` 进行检查。退出代码 2 = 命令被阻止。在智能体循环之外执行 —— Claude 无法覆盖它。
**第 2 层 — CLAUDE.md 规则**
切勿在主线程中运行活动工具。始终委派给智能体。切勿存储明文凭据。切勿泄露 PII。在每次会话中强制执行。
**第 3 层 — 路径范围输出规则**
`evidence/**` — 强制要求 ATT&CK TTP 字段,无原始凭据
`reports/**` — 每个发现必须包含 CVSS 3.1 向量,凭据被密文替换为 `[REDACTED]`
`loot/**` — 仅限哈希 + 位置参考
## 技能库
每个智能体从 [Anthropic-Cybersecurity-Skills](https://github.com/mukul975/Anthropic-Cybersecurity-Skills)(5,700+ ⭐)加载其方法论 —— 包含 754 项结构化技能,映射到 MITRE ATT&CK、NIST CSF 2.0、MITRE ATLAS、D3FEND 和 AI RMF。该技能库是 ThreatSwarm 智能体遵循专业方法论而非临时提示的原因。
## 证据结构
```
evidence/
└── 20260429/
└── 10.10.10.5/
├── nmap/ raw scanner output
├── nuclei/ vulnerability findings
├── web/ HTTP responses, screenshots
├── creds/ hashes only — no plaintext ever
└── screenshots/
findings.md CVSS-scored findings, auto-aggregated
```
`findings_sync.py` 在会话结束时运行,并将 CRITICAL/HIGH 级别的发现聚合到 `evidence/FINDINGS_SUMMARY.md`。
## 并行测试任务
```
./scripts/worktree_setup.sh acme-external acme-internal
# 每个 worktree 获取各自的 scope.txt、evidence/ 和 git branch
cd ../ThreatSwarm-acme-external && claude
```
## 负责任的使用
- 每个目标都需要书面授权
- 社会工程活动需要签署的 RoE
- OT/ICS:除非明确划定范围,否则仅限被动监控
- 未经明确书面授权不得发起 DoS 级别的攻击
- 请参阅 `CONTRIBUTING.md` 了解负责任的披露政策
## 引用
```
@software{jangra2026threatswarm,
author = {Jangra, Mahipal},
title = {{ThreatSwarm}: Scope-Enforced Multi-Agent Penetration Testing
with the {Claude Code} Plugin Substrate},
year = {2026},
url = {https://github.com/mukul975/ThreatSwarm},
note = {27-agent full kill-chain pentesting plugin for Claude Code}
}
```
arXiv 预印本即将发布。
## 路线图
- [ ] `scope.yaml` HackerOne RoE 自动转换器
- [ ] CI/CD 集成(GitHub Actions、GitLab CI、SARIF 输出)
- [ ] Burp Suite / Caido 扩展
- [ ] GenAI 攻击面智能体
- [ ] 供应链 / 依赖混淆智能体
- [ ] `scope_check.py` 中的 IPv6 支持
- [ ] 社区智能体赏金计划(Nuclei-template 模式)
## 贡献
请参阅 [CONTRIBUTING.md](CONTRIBUTING.md)。优先领域:针对新兴攻击面的新智能体(GenAI 攻击、供应链、LLM 注入)、IPv6 范围支持、CI 流水线示例。在开始主要工作之前请先开启 Issue。
## 环境要求
- Claude Code 1.0.33+
- Python 3.8+(钩子脚本)
- Kali Linux 或同等环境(用于渗透测试工具)
- 推荐 [Anthropic-Cybersecurity-Skills](https://github.com/mukul975/Anthropic-Cybersecurity-Skills)
MIT 许可证 · 由 [Mahipal Jangra (@mukul975)](https://github.com/mukul975) 构建
由 [Anthropic-Cybersecurity-Skills](https://github.com/mukul975/Anthropic-Cybersecurity-Skills) · [Privacy-Data-Protection-Skills](https://github.com/mukul975/Privacy-Data-Protection-Skills) 提供支持
标签:AI代理, AI渗透测试, Anthropic AI, CISA项目, Claude Code插件, CTI, CVSS评分报告, GitHub仓库, HTTP工具, IP 地址批量处理, MITRE ATT&CK映射, PyRIT, 代码生成, 元数据驱动, 反取证, 后渗透, 多智能体系统, 大语言模型安全工具, 子域名变形, 安全评估, 完整攻击链, 密码管理, 插件系统, 数字取证与应急响应, 无线安全, 流量嗅探, 渗透测试工具, 紫队, 网络安全, 网络安全审计, 自动化渗透测试, 范围强制执行, 逆向工具, 隐私保护