1o1swapnil/tzar-bot

GitHub: 1o1swapnil/tzar-bot

一款基于 Claude Code 多 Agent 架构的渗透测试自动化平台,将 Kali Linux 工具链编排为覆盖侦察、利用、验证到报告的完整安全测试工作流。

Stars: 0 | Forks: 0

# Tzar-Bot — 渗透测试自动化平台 基于 Claude Code + Kali Linux 运行的 AI 驱动渗透测试机器人。包含协调器、执行器和验证器 agent 的自主多 agent 系统。 ## 环境要求 - [Kali Linux](https://www.kali.org/)(或配备了标准攻击性安全工具链的 Linux 机器) - [Claude Code](https://claude.com/claude-code) CLI - Python 3.11+ - 一个 Anthropic API 密钥(以及可选的集成 token — 参见 `.env.example`) ## 安装说明 ``` git clone https://github.com/1o1swapnil/tzar-bot.git cd tzar-bot cp .env.example .env # 将你的 ANTHROPIC_API_KEY 和任何可选的 token(HTB、HackerOne、Shodan 等)添加到 .env claude ``` `.env`、`memory.db` 测试任务存储、Python 虚拟环境以及所有测试任务输出文件夹均被 git 忽略,永远不会离开您的本地机器。 然后用纯英语描述您的测试任务: | 您输入的内容 | 执行的操作 | |---|---| | `"run web chain on https://target.com"` | 完整的 6 阶段 WAPT → 输出到 `WAPT/target-com/TIMESTAMP/` | | `"test the API at https://api.target.com"` | API Security Top 10 → 输出到 `API/target-com/TIMESTAMP/` | | `"pentest internal network 192.168.1.0/24"` | 网络基础设施测试 → 输出到 `Network/project/TIMESTAMP/` | | `"review source code at https://github.com/org/repo"` | SAST + SCA → 输出到 `CodeReview/repo/TIMESTAMP/` | | `"scan AWS account for misconfigs"` | 云安全评估 → 输出到 `Cloud/aws-account/TIMESTAMP/` | | `"start H1 bug bounty on program-handle"` | 漏洞赏金狩猎 → 输出到 `BugBounty/program-handle/TIMESTAMP/` | ## 测试任务类型文件夹 | 文件夹 | 测试类型 | |--------|-------------| | `WAPT/` | Web 应用程序渗透测试 | | `MAPT/` | 移动应用程序渗透测试 | | `API/` | API 安全测试 | | `Network/` | 网络与基础设施测试 | | `CodeReview/` | 源代码安全审查 | | `Cloud/` | 云安全评估 | | `RedTeam/` | 红队测试任务 | | `DFIR/` | 数字取证与事件响应 | | `BugBounty/` | 漏洞赏金计划 | 每个文件夹都有一个 `README.md`,说明了该文件夹的用途以及如何开始。 ## 项目输出结构 每次运行测试时,都会自动创建一个带有时间戳的项目文件夹: ``` WAPT/acme-corp/20260603_143022/ ├── attack-chain.md ← coordinator's live notes ├── recon/ ← tool output (nmap, gobuster, etc.) ├── findings/ ← one folder per vulnerability found │ └── finding-001/ │ ├── description.md ← title, severity, CVSS, steps to reproduce │ ├── poc.py ← proof-of-concept script │ └── evidence/ ← HTTP captures, screenshots ├── screenshots/ ← browser and tool screenshots ├── logs/ ← agent activity logs (NDJSON) ├── artifacts/ │ ├── validated/ ← findings approved by validator agents │ └── false-positives/ ← rejected findings with reason ├── tools/ ← tool-specific output archives └── reports/ └── Penetration-Test-Report.pdf ← final deliverable ``` ## 技能库 ``` skills/ ├── coordination/ ← executor and validator role definitions ├── web-chain/ ← autonomous 6-phase web pentest orchestrator ├── reconnaissance/ ← nmap, gobuster, ffuf, whatweb, amass ├── osint/ ← theHarvester, crt.sh, waybackurls, Shodan ├── techstack-identification/ ├── authentication/ ← hydra, JWT testing, OAuth, session analysis ├── injection/ ← sqlmap, dalfox, tplmap, commix, ssrfmap ├── server-side/ ← nuclei, testssl, CORS, file upload ├── client-side/ ← DOM XSS, clickjacking, CSRF, retire.js ├── api-security/ ← kiterunner, GraphQL, BOLA/IDOR ├── web-app-logic/ ← race conditions, price tampering, IDOR ├── infrastructure/ ← crackmapexec, impacket, kerbrute, BloodHound ├── system/ ← linpeas, winpeas, SUID, sudo, kernel exploits ├── cloud-containers/ ← trivy, pacu, ScoutSuite, kubectl ├── source-code-scanning/← semgrep, trufflehog, gitleaks, trivy + Python scripts ├── cve-risk-score/ ← NVD lookup, EPSS, CISA KEV check ├── cve-poc-generator/ ← searchsploit, GitHub PoC finder ├── hackthebox/ ← VPN, flag capture, HTB API submission ├── hackerone/ ← scope check, H1 API report submission ├── ai-threat-testing/ ← prompt injection, jailbreaks, RAG poisoning ├── social-engineering/ ← GoPhish, pretexting, vishing (authorized only) ├── dfir/ ← Volatility3, disk imaging, YARA, log analysis ├── blockchain-security/ ← Slither, Mythril, Echidna, Foundry ├── essential-tools/ ← curl, nmap, ffuf, nuclei reference ├── script-generator/ ← custom PoC scripts ├── patt-fetcher/ ← payload and wordlist lookup ├── github-workflow/ ← git conventions, branching └── skill-update/ ← capture engagement learnings ``` ## 平台工具 (`tools/`) 由 agent 驱动的 Python 实用工具(优先使用标准库;其中 15 个还通过 `.mcp.json` 以与模型无关的方式作为 **MCP 工具**公开): | 工具 | 用途 | |------|---------| | `init-engagement.py` | 创建类型化的测试任务树并导出 `$OUTPUT_DIR` | | `engagement-state.py` | 可恢复、受范围保护的账本;**执行器工作声明去重**(`claim`/`release`/`worklist --agent`) | | `scope.py` · `scope-check.py` | 代码强制执行的范围(拒绝优先);PreToolUse 拦截 hook(允许列表可通过 `config/safe-prefixes.txt` 扩展) | | `validate-finding.py` | 5 项检查的机械式发现验证关卡 | | `generate-report.py` | 规范的 tzar-bot 风格 **PDF** 报告 | | `report-export.py` | **新增** — 离线 **JSON + HTML** 报告导出(无需 reportlab,无需网络) | | `token-meter.py` | **新增** — token/成本遥测、预算、`ingest`(半自动捕获)、定价卡 | | `rate-limiter.py` | **新增** — 按主机划分的 token-bucket 请求调速(避免触发 WAF) | | `nvd-lookup.py` · `gen-nuclei-template.py` | CVE 详情(NVD 2.0);Nuclei v3 模板生成 | | `session-memory.py` · `memory-search.py` · `continuous-scan.py` | 跨会话 SQLite 记忆(FTS5);增量重新扫描 | | `env-reader.py` · `scrub-web-content.py` | 仅限批准的机密访问;prompt 注入清除器(CWE-1336) | | `notify.py` · `se-dashboard.py` | P0/P1 webhook 告警;GoPhish 活动指标 | | `lint-skills.py` · `sync-bughunter.py` | 技能质量关卡;上游偏差检测 | | `mcp-server.py` · `playwright-mcp-server.py` | MCP 服务器(15 个工具;经过身份验证的浏览器自动化) | 冒烟测试(65 个,封闭式):`tools/.venv-test/bin/python -m pytest tools/tests/ -q`。完整命令参考:`docs/operations.md`。 ## 必备工具 (Kali) 大部分已预装。检查可用性: ``` for t in nmap gobuster ffuf sqlmap nuclei whatweb wafw00f httpx dalfox subfinder amass dnsx; do command -v $t &>/dev/null && echo "OK: $t" || echo "MISSING: $t" done ``` 安装任何缺失的工具: ``` sudo apt update && sudo apt install -y nuclei dalfox subfinder amass pip3 install semgrep trufflehog go install github.com/projectdiscovery/dnsx/cmd/dnsx@latest ```
标签:CISA项目, Claude, CTI, CVE检测, 反取证, 多智能体, 安全评估, 实时处理, 密码管理, 特征检测, 网络调试, 自动化, 逆向工具