kage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKage — pentest sandbox
Kage — 渗透测试沙箱
When to use this skill
何时使用该技能
- — black-box engagement
kage <target> - /
pentest <target>— same as abovesecurity audit on <target> - — white-box source audit only
kage audit <local path> - — black-box + source context
kage greybox <target> <source-path>
<target>*.example.comgreyboxaudit-context-building- — 黑盒测试任务
kage <target> - /
pentest <target>— 与上述功能相同security audit on <target> - — 仅进行白盒源码审计
kage audit <local path> - — 黑盒测试 + 源码上下文分析
kage greybox <target> <source-path>
<target>*.example.comgreyboxaudit-context-buildingContainer model
容器模型
Every tool runs inside a per-engagement Kali container via the
shim. Each working directory gets its own container (name derived from
), so two engagements run simultaneously without cross-contamination.
$K$PWDbash
SKILL_DIR="$HOME/.claude/skills/kage"
K="$SKILL_DIR/scripts/k"
"$K" <cmd> # runs <cmd> inside this engagement's container
"$K" ls | reset | prune | nuke # management subcommandsProbes live at inside the container (read-only
bind mount). Results go to (bind-mounted
from your CWD).
/skill/scripts/*.py/workspace/results/<target>/Never run pentest tools directly on the host.
所有工具都通过垫片在每个测试任务专属的Kali容器内运行。每个工作目录对应一个独立容器(名称由生成),因此两个测试任务可以同时运行而不会互相干扰。
$K$PWDbash
SKILL_DIR="$HOME/.claude/skills/kage"
K="$SKILL_DIR/scripts/k"
"$K" <cmd> # 在当前测试任务的容器内运行<cmd>
"$K" ls | reset | prune | nuke # 管理子命令探针位于容器内的(只读绑定挂载)。结果会输出到(从当前工作目录绑定挂载)。
/skill/scripts/*.py/workspace/results/<target>/切勿直接在主机上运行渗透测试工具。
Turn 0 — Setup
第0阶段 — 初始化
bash
SKILL_DIR="$HOME/.claude/skills/kage"
K="$SKILL_DIR/scripts/k"
"$K" whoami # warms the sandbox; surfaces docker errors
TARGET="example.com" # derive from user prompt; slugify for pathsbash
SKILL_DIR="$HOME/.claude/skills/kage"
K="$SKILL_DIR/scripts/k"
"$K" whoami # 预热沙箱;显示Docker错误信息
TARGET="example.com" # 从用户指令中获取;转换为路径友好格式Host-side mkdir so dirs are owned by your UID (host Write tool needs this).
在主机端创建目录,确保目录归当前UID所有(主机写入工具需要此设置)。
mkdir -p "results/$TARGET"/{recon,vulns,testing,exploits,chains,verification,judging,reports}
Read `./creds.md` from the user's CWD if present. If absent: ask whether
to proceed black-box, or point at the template in
[`assets/creds.sample.md`](assets/creds.sample.md).mkdir -p "results/$TARGET"/{recon,vulns,testing,exploits,chains,verification,judging,reports}
如果用户当前工作目录存在`./creds.md`则读取该文件。如果不存在:询问用户是否继续进行黑盒测试,或指向[`assets/creds.sample.md`](assets/creds.sample.md)中的模板。Greybox pre-flight (only if mode is greybox
)
greybox灰盒预检查(仅在greybox
模式下执行)
greyboxApply the
methodology to . For dense modules, dispatch the
sub-agent — multiple in parallel if warranted.
audit-context-building<source-path>function-analyzerOutput covering: trust boundaries, auth
flow, data flow, high-value entry points, known-sensitive parameters.
All Turn-2 testers and Turn-3a exploiter read alongside
their usual inputs.
results/$TARGET/context.mdcontext.mdWrite with .
results/$TARGET/engagement.json{target, scope_type, started_at, rules_of_engagement}对应用方法论。对于复杂模块,调度子代理——如有必要可并行调度多个。
<source-path>audit-context-buildingfunction-analyzer输出,内容包括:信任边界、认证流、数据流、高价值入口点、已知敏感参数。所有第2阶段的测试器和第3a阶段的漏洞利用工具都会在常规输入之外读取。
results/$TARGET/context.mdcontext.md写入,包含信息。
results/$TARGET/engagement.json{target, scope_type, started_at, rules_of_engagement}Turn 1 — Recon (two phases)
第1阶段 — 侦察(两个阶段)
Discovery runs fast (1–3 min) as a streaming pipe. Vuln scanning is
long (5–15 min) and isolated in a sub-agent so nuclei's verbose output
doesn't pollute the main context.
发现阶段运行速度快(1-3分钟),采用流式管道。漏洞扫描耗时较长(5-15分钟),并在子代理中独立执行,避免nuclei的冗长输出污染主上下文。
Phase 1 — Discovery
阶段1 — 发现
bash
R="results/$TARGET"
"$K" bash -c '
set -e
cd /workspace
R="results/'"$TARGET"'"
(subfinder -d "'"$TARGET"'" -silent \
| tee "$R/recon/subs.txt" \
| httpx -silent -title -tech-detect -status-code \
| tee "$R/recon/live.txt") &
(gau --subs "'"$TARGET"'" > "$R/recon/wayback.txt") &
(until [ -s "$R/recon/live.txt" ]; do sleep 1; done
katana -u "$R/recon/live.txt" -d 3 -jc -silent -o "$R/recon/crawl.txt") &
(python3 /skill/scripts/dorks.py -d "'"$TARGET"'" --output "$R/recon/dorks.json") &
wait'In parallel, dispatch :
, .
port-scannerHOSTS_FILE=$R/recon/live.txtOUTDIR=$R/recon/ports/If is set, also run :
GITHUB_TOKENscripts/gitmail.pybash
"$K" bash -c "GITHUB_TOKEN=\"$GH_TOKEN\" python3 /skill/scripts/gitmail.py \
-O <guessed-org> -r -s --verified-only \
-o /workspace/$R/recon/github.json"Wait for pipe + port-scanner (+ gitmail if run) before Phase 2.
bash
R="results/$TARGET"
"$K" bash -c '
set -e
cd /workspace
R="results/'"$TARGET"'"
(subfinder -d "'"$TARGET"'" -silent \
| tee "$R/recon/subs.txt" \
| httpx -silent -title -tech-detect -status-code \
| tee "$R/recon/live.txt") &
(gau --subs "'"$TARGET"'" > "$R/recon/wayback.txt") &
(until [ -s "$R/recon/live.txt" ]; do sleep 1; done
katana -u "$R/recon/live.txt" -d 3 -jc -silent -o "$R/recon/crawl.txt") &
(python3 /skill/scripts/dorks.py -d "'"$TARGET"'" --output "$R/recon/dorks.json") &
wait'并行调度:,。
port-scannerHOSTS_FILE=$R/recon/live.txtOUTDIR=$R/recon/ports/如果已设置,同时运行:
GITHUB_TOKENscripts/gitmail.pybash
"$K" bash -c "GITHUB_TOKEN=\"$GH_TOKEN\" python3 /skill/scripts/gitmail.py \
-O <guessed-org> -r -s --verified-only \
-o /workspace/$R/recon/github.json"等待管道任务+端口扫描器(若运行则包括gitmail)完成后进入阶段2。
Phase 2 — Vuln scan
阶段2 — 漏洞扫描
Dispatch with
, .
vuln-scannerLIVE_HOSTS_FILE=$R/recon/live.txtOUTPUT=$R/vulns/nuclei.txtWait for vuln-scanner before Turn 2.
调度,参数为,。
vuln-scannerLIVE_HOSTS_FILE=$R/recon/live.txtOUTPUT=$R/vulns/nuclei.txt等待漏洞扫描完成后进入第2阶段。
Summary
总结
Write : subdomain count, live-host count, high-value
ports, nuclei severity counts + top hits, auth endpoints, ID-bearing
API paths, URL-accepting parameters.
recon/summary.mdStop here if the user said .
recon-only写入:子域名数量、存活主机数量、高价值端口、nuclei漏洞严重程度统计+顶级发现、认证端点、带ID的API路径、接受URL的参数。
recon/summary.md如果用户要求则在此处停止。
recon-onlyTurn 2 — Deep testing (parallel fan-out)
第2阶段 — 深度测试(并行分发)
Read . For every trigger that fires, spawn the
matching tester sub-agents simultaneously — emit all dispatches in
one message. Each tester issues its own calls into the shared
container (docker exec is concurrent) and writes to its own
path.
recon/summary.md$Ktesting/<class>/| Trigger in recon | Dispatch |
|---|---|
| login / SSO / OAuth / JWT endpoints | |
| API endpoints with object IDs + 2 accounts | |
| 403s, admin panels, role-gated routes + ≥2 roles | |
| |
| parameterised URLs, search fields, forms, GraphQL vars | |
| user-facing HTML (comments, profile, search) | |
OpenAPI/Swagger URL, | |
| payment / coupon / redeem / invite / signup endpoints | |
| crawler surface thin; hidden paths likely | |
| JS bundles discovered in Turn 1 | |
| any live web host | |
| needs 2+ provisioned accounts (self-service signup) | use |
In mode, every tester also reads
and targets source-known weak points over generic scans.
greyboxresults/$TARGET/context.mdWait for all testers to return. Aggregate their JSON into a
candidate-finding inventory. Every probe emits a shared
/ shape; all HTTP goes through
(or for Cloudflare targets).
findings[]summary{}scripts/tls.pyscripts/browser.py5-minute rule. If a lead doesn't prove itself within 5 minutes,
move on. No theoretical bugs.
读取。对于每个触发项,同时生成对应的测试子代理——在一条消息中发送所有调度指令。每个测试器会在共享容器中发起自己的调用(docker exec支持并发),并将结果写入各自的路径。
recon/summary.md$Ktesting/<class>/| 侦察中的触发项 | 调度的代理 |
|---|---|
| 登录/SSO/OAuth/JWT端点 | |
| 带对象ID的API端点 + 2个账户 | |
| 403页面、管理面板、角色限制路由 + ≥2个角色 | |
| |
| 参数化URL、搜索字段、表单、GraphQL变量 | |
| 用户可见HTML(注释、个人资料、搜索) | |
OpenAPI/Swagger URL、 | |
| 支付/优惠券/兑换/邀请/注册端点 | |
| 爬虫覆盖范围小;可能存在隐藏路径 | |
| 第1阶段发现JS包 | |
| 任何存活的Web主机 | |
| 需要2+预配置账户(自助注册) | 使用 |
在模式下,所有测试器还会读取,优先针对源码已知的弱点而非通用扫描。
greyboxresults/$TARGET/context.md等待所有测试器返回结果。将它们的JSON结果聚合到候选发现清单中。每个探针都会输出统一的/格式;所有HTTP请求都通过(针对Cloudflare目标则使用)处理。
findings[]summary{}scripts/tls.pyscripts/browser.py5分钟规则。如果某个线索在5分钟内无法验证,则放弃。不保留理论性漏洞。
Turn 3 — Exploit, verify, chain, judge
第3阶段 — 漏洞利用、验证、链化、评估
Sequential. Each step feeds the next.
按顺序执行。每个步骤的结果作为下一个步骤的输入。
3a. Exploit — filter BEFORE writing a PoC
3a. 漏洞利用 — 编写PoC前先过滤
Read . For each
candidate finding:
references/judging.md- Drop outright if it matches an auto-drop pattern (missing headers without PoC, version banners, self-XSS, logout CSRF, TRACE/TRACK, TLS cipher issues, SPF/DKIM/DMARC, info-leak 500s, rate-limit absent without an abuse scenario). Do NOT build a PoC for these.
- Drop if the impact statement contains "could potentially" or
requires a condition unverifiable black-box. In mode, check
greyboxfirst — source may confirm/refute.context.md - Build a PoC only when attacker action produces an observable, reproducible server-side outcome with real impact (data access, code execution, auth bypass, cost amplification, state change, financial).
For each survivor, write a PoC at
. Drop anything that doesn't
reproduce first run.
curl_cffiresults/$TARGET/exploits/<slug>.py阅读。对于每个候选发现:
references/judging.md- 直接排除如果符合自动排除模式(无PoC的缺失头部、版本标识、自XSS、注销CSRF、TRACE/TRACK、TLS密码套件问题、SPF/DKIM/DMARC、信息泄露500错误、无滥用场景的缺失速率限制)。请勿为这些漏洞编写PoC。
- 排除如果影响描述包含“可能”或需要无法通过黑盒验证的条件。在模式下,先检查
greybox——源码可能会确认或否定该漏洞。context.md - 仅当攻击者操作能产生可观察、可复现的服务器端结果且具有实际影响(数据访问、代码执行、认证绕过、成本放大、状态变更、财务损失)时,才编写PoC。
对于每个留存的漏洞,在编写 PoC。如果首次运行无法复现则放弃该漏洞。
results/$TARGET/exploits/<slug>.pycurl_cffi3b. Verify — parallel
3b. 验证 — 并行执行
For each PoC, dispatch — emit all
verifier Tasks in one message. Each gets its own
, fresh auth, clean
session, 3× reproducibility.
verifierOUTDIR=results/$TARGET/verification/F<NNN>/Aggregate into .
verification/verified_findings.json对于每个PoC,调度——在一条消息中发送所有验证任务。每个任务对应独立的,使用全新的认证信息、干净的会话,进行3次可复现性验证。
verifierOUTDIR=results/$TARGET/verification/F<NNN>/将结果聚合到。
verification/verified_findings.json3c. Chain
3c. 链化
Dispatch on verified
findings. It maps the 7 canonical patterns in
and looks for creative
combinations.
chain-builderreferences/chains.md针对已验证的发现调度。它会映射中的7种典型升级模式,并寻找创造性的组合方式。
chain-builderreferences/chains.md3d. Judge
3d. 评估
Dispatch . It applies the 4-gate filter from
, scores confidence +
CVSS, deduplicates, enforces the exclusion list.
judgereferences/judging.mdOutputs: (the only findings that
reach the report), (audit trail), .
judging/approved_findings.jsonjudgment.mddropped_findings.md调度。它会应用中的4门过滤机制,对置信度和CVSS评分,去重,执行排除列表。
judgereferences/judging.md输出:(唯一会进入报告的发现)、(审计追踪)、。
judging/approved_findings.jsonjudgment.mddropped_findings.mdTurn 4 — Audit report
第4阶段 — 审计报告
Dispatch with:
, , ,
,
.
report-writerTARGETENGAGEMENT_JSONAPPROVED_FINDINGS_JSONTEMPLATE=$SKILL_DIR/references/audit-report-template.mdOUTPUT=results/$TARGET/audit-report.mdThe agent fills from engagement + approved findings.
It does NOT re-filter — the judge already did that. Print a summary
table to the user when done.
{{placeholders}}调度,参数为:、、、、。
report-writerTARGETENGAGEMENT_JSONAPPROVED_FINDINGS_JSONTEMPLATE=$SKILL_DIR/references/audit-report-template.mdOUTPUT=results/$TARGET/audit-report.md该代理会根据测试任务信息和已批准的发现填充。它不会重新过滤——评估环节已完成此工作。完成后向用户打印汇总表格。
{{placeholders}}Failure modes to surface (don't swallow)
需要暴露的失败模式(请勿隐藏)
- Docker not installed / not running → print the shim's error, stop.
- Target unreachable / DNS fails.
- Rate-limited or WAF-blocked → slow down, rotate fingerprint
(), or swap to
tls.py --impersonate <name>.scripts/browser.py - missing when the user asked for authenticated testing.
creds.md
- Docker未安装/未运行 → 打印垫片的错误信息,停止执行。
- 目标无法访问/DNS解析失败。
- 被速率限制或WAF拦截 → 降低速度,轮换指纹(),或切换到
tls.py --impersonate <name>。scripts/browser.py - 用户要求进行认证测试但缺少。
creds.md
Reference docs (load on demand)
参考文档(按需加载)
- — per-attack-class triggers + invocation details
references/methodology.md - — 4-gate filter + severity rubric + exclusion list
references/judging.md - — 7 named escalation patterns
references/chains.md - — platform conventions (HackerOne, Bugcrowd, Intigriti)
references/report-formatting.md - — Turn 4 template
references/audit-report-template.md - — full inventory of tools installed in the sandbox
references/tools.md - — greybox methodology
references/audit-context-building/SKILL.md - — disposable-inbox provisioning
references/agentmail/SKILL.md - — scope + credentials template
assets/creds.sample.md - — target-specific subdomain wordlists
assets/wordlist-strategy.md
- — 各攻击类别的触发条件 + 调用细节
references/methodology.md - — 4门过滤机制 + 严重程度标准 + 排除列表
references/judging.md - — 7种命名的升级模式
references/chains.md - — 平台规范(HackerOne、Bugcrowd、Intigriti)
references/report-formatting.md - — 第4阶段模板
references/audit-report-template.md - — 沙箱中安装的完整工具清单
references/tools.md - — 灰盒方法论
references/audit-context-building/SKILL.md - — 临时邮箱配置
references/agentmail/SKILL.md - — 测试范围 + 凭证模板
assets/creds.sample.md - — 针对目标的子域名字典策略
assets/wordlist-strategy.md