$npx -y skills add xwtro0tk1t-cloud/harness --skill web-vuln-analyzer> Version 2.0 - AI Native Architecture > > 你(Claude)直接决策,无需遵循复杂的规则路由。以下是参考指南。
| 1 | # Web Vulnerability Analysis Skill |
| 2 | |
| 3 | > **Version 2.0 - AI Native Architecture** |
| 4 | > |
| 5 | > 你(Claude)直接决策,无需遵循复杂的规则路由。以下是参考指南。 |
| 6 | |
| 7 | ## 🏗️ Architecture (AI Native) |
| 8 | |
| 9 | ``` |
| 10 | Claude Code (你就是 LLM) |
| 11 | │ |
| 12 | ├─ 简单任务 → 直接处理 |
| 13 | │ ├─ HTTP Client → XSS, IDOR 验证 |
| 14 | │ └─ Playwright → DOM XSS, CSRF, Open Redirect |
| 15 | │ |
| 16 | └─ 复杂任务 → CAI Agent |
| 17 | │ |
| 18 | ├─ 11 Agents (bug_bounty, redteam, blueteam...) |
| 19 | ├─ MCP Bridge (execute_command → 59 Kali tools) |
| 20 | └─ HexStrike Docker (localhost:8888) |
| 21 | ``` |
| 22 | |
| 23 | ## 🚨 核心原则 |
| 24 | |
| 25 | 1. **专业任务必须调用 CAI** - 指纹识别、渗透测试、漏洞扫描等,不要用 curl 凑合 |
| 26 | 2. **认证优先** - 如果漏洞需要认证,先问用户要 credentials |
| 27 | 3. **客户端漏洞用浏览器** - Open Redirect, DOM XSS, CSRF 必须用 Playwright |
| 28 | 4. **简单验证可以直接做** - 单个 payload 验证、状态码检查 |
| 29 | |
| 30 | ## 🤖 CAI Agent 调用规则(重要!) |
| 31 | |
| 32 | **当用户要求以下任务时,必须调用 CAI Agent,不要自己用 curl/HTTP 凑合:** |
| 33 | |
| 34 | ### Agent 选择 |
| 35 | |
| 36 | | 任务类型 | 选择 Agent | 调用方式 | |
| 37 | |---------|-----------|---------| |
| 38 | | 指纹识别、侦察、recon | `bug_bounty_agent` | 见下方代码 | |
| 39 | | 渗透测试、攻击、exploit | `redteam_agent` | 见下方代码 | |
| 40 | | 漏洞扫描、安全检测 | `bug_bounty_agent` | 见下方代码 | |
| 41 | | 告警分析、蓝队、威胁分析 | `blueteam_agent` | 见下方代码 | |
| 42 | | 报告验证(有报告文件) | `bug_bounty_agent` | 见下方代码 | |
| 43 | |
| 44 | ### 调用方式 |
| 45 | |
| 46 | ```bash |
| 47 | # 激活虚拟环境 |
| 48 | source .venv/bin/activate |
| 49 | |
| 50 | # 加载环境变量 |
| 51 | source ~/.claude/skills/web-vuln-analyzer/docker/.env |
| 52 | |
| 53 | # 调用 CAI Agent |
| 54 | cd ~/.claude/skills/web-vuln-analyzer |
| 55 | python -c " |
| 56 | import asyncio |
| 57 | import sys |
| 58 | sys.path.insert(0, 'tools') |
| 59 | sys.path.insert(0, 'vendor') |
| 60 | |
| 61 | import litellm |
| 62 | litellm.drop_params = True |
| 63 | |
| 64 | from cai_client import CAIClient |
| 65 | |
| 66 | async def run(): |
| 67 | client = CAIClient() |
| 68 | result = await client.run_async( |
| 69 | agent_name='bug_bounty_agent', # 或 redteam_agent, blueteam_agent |
| 70 | prompt='识别 http://target.com 的技术指纹', |
| 71 | target='http://target.com', |
| 72 | max_turns=30 # 简单任务: 15-30, 渗透测试: 200 |
| 73 | ) |
| 74 | print('Success:', result.success) |
| 75 | print('Output:', result.output) |
| 76 | if result.error: |
| 77 | print('Error:', result.error) |
| 78 | |
| 79 | asyncio.run(run()) |
| 80 | " |
| 81 | ``` |
| 82 | |
| 83 | ### ⚙️ 推荐配置(生产环境测试验证) |
| 84 | |
| 85 | 基于实际渗透测试经验,以下配置可避免超时和测试不完整问题: |
| 86 | |
| 87 | | 任务类型 | max_turns | CAI_TIMEOUT | 说明 | |
| 88 | |---------|-----------|-------------|------| |
| 89 | | 指纹识别 | 15-30 | 300s | 快速识别技术栈 | |
| 90 | | 单漏洞验证 | 30 | 600s | 验证单个漏洞 | |
| 91 | | 标准渗透 | 50-100 | 600s | 常规安全评估 | |
| 92 | | 全面渗透 | **200** | **1800s** | 完整漏洞验证 | |
| 93 | |
| 94 | **重要**: 在 `docker/.env` 中设置: |
| 95 | ```bash |
| 96 | CAI_MAX_TURNS=200 # 允许充分测试 |
| 97 | CAI_TIMEOUT=1800 # 30分钟超时 |
| 98 | ``` |
| 99 | |
| 100 | ### 示例场景 |
| 101 | |
| 102 | | 用户输入 | Claude 行为 | |
| 103 | |---------|------------| |
| 104 | | `/web-vuln-analyze http://target.com "识别指纹"` | 调用 `bug_bounty_agent`,让它用 whatweb/nmap | |
| 105 | | `/web-vuln-analyze http://target.com` (无报告) | 调用 `redteam_agent`,自动渗透 | |
| 106 | | `/web-vuln-analyze http://target.com report.xml` | 调用 `bug_bounty_agent`,验证报告 | |
| 107 | | `/web-vuln-analyze http://target.com "SQL注入测试"` | 调用 `bug_bounty_agent`,让它用 sqlmap | |
| 108 | |
| 109 | ### ❌ 不要这样做 |
| 110 | |
| 111 | ```bash |
| 112 | # 错误:自己用 curl 做指纹识别 |
| 113 | curl -s -I http://target.com | grep Server # ❌ 不专业 |
| 114 | |
| 115 | # 错误:自己规划 tasks 用 curl |
| 116 | Task 1: curl http://target.com # ❌ 应该调用 CAI |
| 117 | Task 2: curl http://target.com/robots.txt # ❌ |
| 118 | ``` |
| 119 | |
| 120 | ### ✅ 正确做法 |
| 121 | |
| 122 | ```bash |
| 123 | # 正确:调用 CAI Agent,让专业 agent 决定用什么工具 |
| 124 | python -c "... client.run_async(agent_name='bug_bounty_agent', prompt='识别指纹', ...) ..." |
| 125 | # Agent 会自己调用 whatweb, nmap, wafw00f 等专业工具 |
| 126 | ``` |
| 127 | |
| 128 | --- |
| 129 | |
| 130 | ## 📋 Tool Selection Reference |
| 131 | |
| 132 | | Vulnerability | Tool | Why | |
| 133 | |--------------|------|-----| |
| 134 | | Open Redirect, CSRF | Playwright | 客户端行为 | |
| 135 | | DOM XSS, Clickjacking | Playwright | JavaScript 执行 | |
| 136 | | SQL Injection, XXE | **CAI Agent** → HexStrike | 专业工具 | |
| 137 | | SSRF, Command Injection | **CAI Agent** → HexStrike | 专业工具 | |
| 138 | | 指纹识别、侦察 | **CAI Agent** → HexStrike | 专业工具 | |
| 139 | | 渗透测试 | **CAI Agent** → HexStrike | 专业工具 | |
| 140 | | Simple XSS, IDOR | HTTP Client | 简单请求 | |
| 141 | | Info Disclosure | HTTP Client | 简单请求 | |
| 142 | |
| 143 | --- |
| 144 | |
| 145 | ## 📜 Legacy Workflow (参考) |
| 146 | |
| 147 | 以下是原有的决策树,现在由你(Claude)直接理解和执行,无需机械遵循: |
| 148 | |
| 149 | ``` |
| 150 | ┌─────────────────────────────────────┐ |
| 151 | │ Parse Report → Extract vuln type │ |
| 152 | └─────────────┬───────────────────────┘ |
| 153 | │ |
| 154 | ▼ |
| 155 | ┌────────────────────┐ |
| 156 | │ 🔐 Check if needs │ |
| 157 | │ authentication? │ |
| 158 | └────────┬───────────┘ |
| 159 | │ |
| 160 | ┌─────┴─────┐ |
| 161 | │ │ |
| 162 | ▼ ▼ |
| 163 | ┌────────┐ ┌─────────┐ |
| 164 | │ YES │ │ NO │ |
| 165 | └───┬────┘ └────┬────┘ |
| 166 | │ │ |
| 167 | ▼ │ |
| 168 | ┌──────────────────┐│ |
| 169 | │ Prompt user for ││ |
| 170 | │ auth credentials ││ |
| 171 | │ (AskUserQuestion)││ |
| 172 | └────────┬─────────┘│ |
| 173 | │ │ |
| 174 | └────┬─────┘ |
| 175 | │ |
| 176 | ▼ |
| 177 | ┌─────────────┐ |
| 178 | │ Vuln Type? │ |
| 179 | └─────┬───────┘ |
| 180 | │ |
| 181 | ┌─────────┼─────────┬─────────────┐ |
| 182 | │ │ │ │ |
| 183 | ▼ ▼ ▼ ▼ |
| 184 | ┌────────┐ ┌────────┐ ┌──────────┐ ┌────────┐ |
| 185 | │ Open │ │ DOM │ │ SQL │ │ Simple │ |
| 186 | │Redirect│ │ XSS │ │Injection │ │ XSS │ |
| 187 | │ CSRF │ │ │ │ XXE │ │ IDOR │ |
| 188 | └───┬────┘ └───┬────┘ └─────┬────┘ └───┬────┘ |
| 189 | │ │ │ │ |
| 190 | ▼ ▼ ▼ ▼ |
| 191 | ┌────────────────┐ ┌──────────────┐ ┌───────────┐ |
| 192 | │ BROWSER │ │CAI → HexStrike│ │HTTP CLIENT│ |
| 193 | │ Playwright │ │ MCP Bridge │ │ requests │ |
| 194 | └────────────────┘ └──────────────┘ |