Reverse Engineering / Authorized Penetration Testing / Security Research Skill Router Pack AI-powered routing + On-demand toolchain bootstrapping + Self-evolving knowledge base Supports Claude Code, Kiro, Cursor, Cline, and other AI coding clients 逆向/渗透/安全技能路由包 - AI 自动路由 + 按需自举工具链 + 自动进化经验库 | 支持 Claude Code / Kiro / Cursor / Cline 等代码 AI 客户端
Shell
test: use real pwntools version subcommand
zhaoxuya520621eabbc1abe
diff --git a/docs/plans/2026-09-21-pwntools-kali-discovery.md b/docs/plans/2026-09-21-pwntools-kali-discovery.mdindex a602037..026e4c6 100644--- a/docs/plans/2026-09-21-pwntools-kali-discovery.md+++ b/docs/plans/2026-09-21-pwntools-kali-discovery.md@@ -2,9 +2,9 @@> **For Hermes:** Use subagent-driven-development skill to implement this plan task-by-task.-**Goal:** Preserve PR #144 contributor provenance and complete pwntools discovery, version reporting, capability visibility, bootstrap listing, manifest verification, and CI coverage.+**Goal:** Preserve PR #144 contributor provenance and complete pwntools discovery, version reporting, capability visibility, bootstrap listing, manifest verification, and CI coverage while keeping Kali and client-neutral indexes on the real `pwn version` CLI contract.-**Architecture:** Treat the original PR head as the integration baseline, then add one hermetic Bash regression that drives the real Kali refresh/bootstrap scripts through a stub `pwn` executable. Make only targeted catalog, capability-list, help-list, manifest, and workflow changes; avoid broader manifest-generation refactors.+**Architecture:** Treat the original PR head as the integration baseline, then drive both real refresh paths through strict hermetic `pwn` stubs that accept only the `version` subcommand. Make only targeted catalog, client-neutral index, capability-list, help-list, manifest, and workflow changes; avoid broader manifest-generation refactors.**Tech Stack:** Bash, JSON, Python 3 assertions, GitHub Actions YAML, Git.@@ -55,6 +55,7 @@ Expected: exit 0; merge commit has two parents.**Files:**- Create: `kali/scripts/test-pwntools-discovery.sh`+- Modify: `skills/scripts/test-client-neutral-bootstrap.sh`- Modify: `.github/workflows/ci.yml`**Step 1: Write the hermetic test**@@ -63,15 +64,17 @@ The test must:- create a temporary `bin` directory;- link required host commands (`bash`, `date`, `dirname`, `head`, `mktemp`, `python3`, `uname`, and `jq` when present);-- create a stub executable `pwn` that prints `Pwntools 4.15.0` for `--version`;+- create a strict stub executable `pwn` that requires exactly one argument equal to `version`, rejects every other invocation with a clear stderr diagnostic and non-zero exit, and writes `[*] Pwntools v4.15.0` to stderr for the valid call;- run `kali/scripts/refresh-tool-index.sh` into temporary Markdown and JSON files;-- assert exactly one `pwntools` JSON record with `available=true`, the stub path, and version `Pwntools 4.15.0`;+- assert exactly one `pwntools` JSON record with `available=true`, the stub path, and version `[*] Pwntools v4.15.0`;- assert the Markdown capability row marks `pwntools` available and installable through `pip-package`;- assert `bootstrap-reverse.sh --list` contains the exact token `pwntools`;- parse both `skills/scripts/bootstrap-manifest.json` and `kali/scripts/bootstrap-manifest.json` and assert `verifyCommand == "pwn"`.The script must have `set -euo pipefail`, clean its temporary directory with a trap, and perform no package installation or network access.+Extend the existing client-neutral regression with the same strict stub. After its first refresh, assert one and only one pwntools JSON record with `available=true`, the canonical stub path, version `[*] Pwntools v4.15.0`, source `command`, skill `reverse-engineering`, and purpose `CTF pwn exploit development framework`. Use explicit conditions and `SystemExit` for these new checks rather than adding Python `assert` statements.+**Step 2: Wire the test into Ubuntu CI**Add after Bash syntax validation in `.github/workflows/ci.yml`:@@ -88,14 +91,17 @@ Run:```bashbash kali/scripts/test-pwntools-discovery.sh+bash skills/scripts/test-client-neutral-bootstrap.sh```-Expected: FAIL on missing version or another explicitly asserted incomplete #144 behaviour, not on test setup.+Expected: both FAIL because their production refresh catalog invokes the rejected `--version` option instead of `pwn version`, not because of test setup.**Step 4: Commit the red test**```bash-git add kali/scripts/test-pwntools-discovery.sh .github/workflows/ci.yml+git add kali/scripts/test-pwntools-discovery.sh \+ skills/scripts/test-client-neutral-bootstrap.sh \+ .github/workflows/ci.ymlgit commit -m "test(kali): cover pwntools discovery integration"```@@ -106,6 +112,7 @@ git commit -m "test(kali): cover pwntools discovery integration"**Files:**- Modify: `kali/scripts/lib/tool-discovery.sh`- Modify: `kali/scripts/refresh-tool-index.sh`+- Modify: `skills/scripts/refresh-tool-index.sh`- Modify: `kali/scripts/bootstrap-reverse.sh`- Modify: `kali/scripts/bootstrap-manifest.json`- Modify: `skills/scripts/bootstrap-manifest.json`@@ -115,9 +122,11 @@ git commit -m "test(kali): cover pwntools discovery integration"Change the #144 row to:```bash-"pwntools|reverse-engineering|CTF pwn 利用开发框架|--version|pwn"+"pwntools|reverse-engineering|CTF pwn 利用开发框架|version|pwn"```+Change the client-neutral catalog version command from `pwn --version` to `pwn version`, and make its version runner pass only populated arguments rather than an extra empty placeholder. Both indexes must invoke the stub with exactly one argument and record the first merged stdout/stderr line from the real CLI contract, `[*] Pwntools v4.15.0`.+**Step 2: Add capability visibility**- Add `pwntools` to `CAPABILITY_NAMES`.@@ -146,6 +155,7 @@ Run:```bashbash kali/scripts/test-pwntools-discovery.sh+bash skills/scripts/test-client-neutral-bootstrap.sh```Expected: exit 0 and a final success message.@@ -155,6 +165,7 @@ Expected: exit 0 and a final success message.```bashgit add kali/scripts/lib/tool-discovery.sh \kali/scripts/refresh-tool-index.sh \+ skills/scripts/refresh-tool-index.sh \kali/scripts/bootstrap-reverse.sh \kali/scripts/bootstrap-manifest.json \skills/scripts/bootstrap-manifest.jsondiff --git a/docs/superpowers/specs/2026-09-21-pwntools-kali-discovery-design.md b/docs/superpowers/specs/2026-09-21-pwntools-kali-discovery-design.mdindex f2c9544..639f8f7 100644--- a/docs/superpowers/specs/2026-09-21-pwntools-kali-discovery-design.md+++ b/docs/superpowers/specs/2026-09-21-pwntools-kali-discovery-design.md@@ -6,14 +6,14 @@ Pull request #144 adds `pwntools` to the Kali tool catalog, but only as a single## Goal-Integrate #144 while preserving its contributor commit, then complete the Kali-facing discovery path so that:+Integrate #144 while preserving its contributor commit, then complete the Kali-facing discovery path and keep the client-neutral index on the same real CLI contract so that:1. `pwn` is detected as the executable supplied by pwntools.2. The generated tool index records its resolved path and version.3. The generated capability table includes `pwntools`, reports runtime availability through `pwn`, and identifies its installer as `pip-package`.4. `bootstrap-reverse.sh --list` and its human-readable help include `pwntools`.5. Both bootstrap manifests use the executable command `pwn` for post-install verification.-6. CI exercises these behaviours without installing pwntools or touching the host environment.+6. Both Kali and client-neutral index regressions exercise the real `pwn version` CLI contract without installing pwntools or touching the host environment.## Non-goals@@ -26,12 +26,12 @@ Integrate #144 while preserving its contributor commit, then complete the Kali-f### Tool catalog-Keep the #144 catalog entry but use `--version` and the executable fallback `pwn`. The logical tool name remains `pwntools`; the resolved executable is `pwn`.+Keep the #144 catalog entry but use the `version` subcommand and the executable fallback `pwn`. The logical tool name remains `pwntools`; the resolved executable is `pwn`. Pwntools 4.15.0 exposes its version through `pwn version`; `pwn --version` is not a valid equivalent and exits non-zero.Expected generated record:```text-pwntools|reverse-engineering|CTF pwn 利用开发框架|yes|<stub>/pwn|Pwntools 4.15.0|command+pwntools|reverse-engineering|CTF pwn 利用开发框架|yes|<stub>/pwn|[*] Pwntools v4.15.0|command```### Capability status@@ -53,7 +53,9 @@ Add a hermetic Bash test under `kali/scripts/` that:5. Asserts `bootstrap-reverse.sh --list` advertises pwntools.6. Parses both manifests and asserts `verifyCommand == "pwn"`.-The test must not invoke package installation, network access, client configuration, or repository output paths.+The `pwn` fixture accepts exactly one argument, `version`, writes the exact real CLI line `[*] Pwntools v4.15.0` to stderr, and fails every other invocation. This prevents the invalid `pwn --version` spelling from passing through a permissive stub. The test must not invoke package installation, network access, client configuration, or repository output paths.++The same executable has one version-command contract on every supported host path. Therefore the minimum change also updates `skills/scripts/refresh-tool-index.sh` from `pwn --version` to `pwn version`, ensures its version runner does not append empty placeholder arguments, and extends the existing `skills/scripts/test-client-neutral-bootstrap.sh` regression with the same strict stub and generated-record assertions.### CI wiring@@ -61,10 +63,10 @@ Run the new regression in the existing Ubuntu Bash CI job after shell syntax val## TDD sequence-1. Add the regression test and CI invocation.-2. Run it against the current main plus the unmodified #144 commit and confirm failure for the missing version/capability/list/manifest behaviour.-3. Apply the smallest production changes required for the assertions.-4. Re-run the focused test until green.+1. Add strict real-CLI regressions for the Kali and client-neutral refresh paths and the CI invocation.+2. Run them against the current production scripts and confirm both fail because production invokes `pwn --version` rather than `pwn version`.+3. Apply the smallest production changes required for the assertions, including both refresh catalogs.+4. Re-run both focused tests until green.5. Run Bash syntax, bootstrap-manifest, routing, repository-security, document-link, JSON, YAML, UTF-8/BOM and mojibake checks.## Integration and provenance@@ -74,5 +76,5 @@ Create a merge commit whose second parent is the original #144 head, preserving## Failure handling- A missing `pwn` command must produce an unavailable pwntools record without aborting refresh.-- A failing `pwn --version` command may leave the version empty, consistent with existing discovery behaviour, but detection remains based on executable presence.+- A failing `pwn version` command may leave the version empty, consistent with existing discovery behaviour, but detection remains based on executable presence.- Any CI failure blocks integration into `main`.diff --git a/kali/scripts/test-pwntools-discovery.sh b/kali/scripts/test-pwntools-discovery.shindex ddd6add..a9e522d 100755--- a/kali/scripts/test-pwntools-discovery.sh+++ b/kali/scripts/test-pwntools-discovery.sh@@ -123,7 +123,7 @@ expected_pwntools_fields = ["pwntools","reverse-engineering","CTF pwn 利用开发框架",- "--version",+ "version","pwn",]if source_pwntools_fields != expected_pwntools_fields:@@ -217,10 +217,13 @@ ficat > "$BIN_DIR/pwn" <<'STUB'#!/bin/bash-if [[ "${1:-}" == "--version" ]]; then- printf '%s\n' 'Pwntools 4.15.0'+if [[ $# -ne 1 || "$1" != "version" ]]; then+ printf 'pwn test stub: expected exactly one argument: version; got:' >&2+ printf ' <%s>' "$@" >&2+ printf '\n' >&2+ exit 64fi-exit 0+printf '%s\n' '[*] Pwntools v4.15.0' >&2STUBchmod +x "$BIN_DIR/pwn"@@ -303,9 +306,9 @@ else:"pwntools Markdown path must resolve to the pwn stub: "f"got {tool_row[4]!r}")- if tool_row[5] != "Pwntools 4.15.0":+ if tool_row[5] != "[*] Pwntools v4.15.0":errors.append(- "pwntools Markdown version must be 'Pwntools 4.15.0', "+ "pwntools Markdown version must be '[*] Pwntools v4.15.0', "f"got {tool_row[5]!r}")if tool_row[6] != "command":@@ -400,9 +403,9 @@ elif have_jq:"pwntools JSON resolved_path must point to the pwn stub: "f"{pwntools.get('resolved_path')!r}")- if pwntools.get("version") != "Pwntools 4.15.0":+ if pwntools.get("version") != "[*] Pwntools v4.15.0":errors.append(- "pwntools JSON version must be 'Pwntools 4.15.0', "+ "pwntools JSON version must be '[*] Pwntools v4.15.0', "f"got {pwntools.get('version')!r}")if pwntools.get("source") != "command":diff --git a/skills/scripts/test-client-neutral-bootstrap.sh b/skills/scripts/test-client-neutral-bootstrap.shindex 11e76e1..a912ac8 100644--- a/skills/scripts/test-client-neutral-bootstrap.sh+++ b/skills/scripts/test-client-neutral-bootstrap.sh@@ -33,6 +33,18 @@ exit 0STUBchmod +x "$BIN_DIR/ghidra"+cat > "$BIN_DIR/pwn" <<'STUB'+#!/bin/bash+if [[ $# -ne 1 || "$1" != "version" ]]; then+ printf 'pwn test stub: expected exactly one argument: version; got:' >&2+ printf ' <%s>' "$@" >&2+ printf '\n' >&2+ exit 64+fi+printf '%s\n' '[*] Pwntools v4.15.0' >&2+STUB+chmod +x "$BIN_DIR/pwn"+export PATH="$BIN_DIR:$PATH"export HOME="$HOME_DIR"export REVERSE_SKILL_TOOLS_DIR="$TOOLS_DIR"@@ -43,7 +55,7 @@ MD="$SCRATCH/tool-index.md"JSON="$SCRATCH/tool-index.json"PATH="$BIN_DIR" "$BIN_DIR/bash" "$REFRESH" "$MD" "$JSON" >/dev/null-python3 - "$JSON" "$BIN_DIR/ghidra" <<'PY'+python3 - "$JSON" "$BIN_DIR/ghidra" "$BIN_DIR/pwn" <<'PY'import json, os, sysdata = json.load(open(sys.argv[1], encoding='utf-8'))tools = data['tools']@@ -54,6 +66,29 @@ assert by_tool['jshookmcp']['available'] is False, 'npx must not masquerade as jassert by_tool['reqable-mcp']['available'] is False, 'npx must not masquerade as reqable-mcp'assert by_tool['ghidra']['available'] is True, 'the distro-provided ghidra launcher must be discovered'assert os.path.realpath(by_tool['ghidra']['path']) == os.path.realpath(sys.argv[2])+pwntools_matches = [tool for tool in tools if tool.get('name') == 'pwntools']+if len(pwntools_matches) != 1:+ raise SystemExit(+ f"expected exactly one pwntools tool record, got {len(pwntools_matches)}"+ )+pwntools = pwntools_matches[0]+expected_pwntools = {+ 'available': True,+ 'version': '[*] Pwntools v4.15.0',+ 'source': 'command',+ 'skill': 'reverse-engineering',+ 'purpose': 'CTF pwn exploit development framework',+}+for field, expected in expected_pwntools.items():+ if pwntools.get(field) != expected:+ raise SystemExit(+ f"pwntools {field} must be {expected!r}, got {pwntools.get(field)!r}"+ )+if os.path.realpath(pwntools.get('path') or '') != os.path.realpath(sys.argv[3]):+ raise SystemExit(+ "pwntools path must resolve to the strict pwn stub: "+ f"got {pwntools.get('path')!r}"+ )by_cap = {c['name']: c for c in data['capabilities']}assert by_cap['jshookmcp']['ready'] is Falseassert by_cap['reqable-mcp']['ready'] is False