agentleFS
haoithaoit/agentic-autopentest/CLAUDE.md

agentic-autopentest

CLAUDE.md11 starsChanged 18 days agoMITView on GitHub

This project runs the pentest skill (.claude/skills/pentest/SKILL.md, v7.x). This file is the always-loaded anchor: orient from here without re-reading the whole skill. The single goal is finding bugs — everything below serves that. Install: copy skills/pentest/ → .claude/skills/pentest/ and scripts/pentest/ → .claude/scripts/pentest/ in your engagement workspace, copy scope.example.json → scope.json and fill it in, then drive the skill with /pentest <url>.

  • Reads credentials

The file

We split this CLAUDE.md into the rules it gives an agent

8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If a call is blocked, read the stderr reason and fix the target or scope.json — never route around it.

    line 24
  2. Very specific:

    Read output/pentest/<host>/SITE-MODEL.md → full understanding in one read.

    line 35
  3. Very specific:

    Never hand-edit a _store/*.md to fake state.

    line 42
  4. Very specific:

    Budget: never cut tests; cut meta.

    line 55
  5. Very specific:

    Every finding carries status ∈ whitebox_theoretical | lab_synthetic | lab_real_build | vendor_acknowledged (confirmed_dynamic is BANNED).

    line 58
  6. Very specific:

    Run with python3 (3.9+ OK) or python3.12.

    line 69
  7. Very specific:

    If an existing finding is escalated (severity/CVSS/scope widened), update that doc — do NOT open a parallel VULN-NNN.

    line 92
  8. Very specific:

    Reconciliation before REPORT (anti-miss): before closing/REPORT, re-check — every finding ever mentioned in chat, in SITE-MODEL §8, or in …

    line 95

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md — Pentest Routing Anchor

This project runs the pentest skill (.claude/skills/pentest/SKILL.md, v7.x). This file is the always-loaded anchor: orient from here without re-reading the whole skill. The single goal is finding bugs — everything below serves that.

Install: copy skills/pentest/ → .claude/skills/pentest/ and scripts/pentest/ → .claude/scripts/pentest/ in your engagement workspace, copy scope.example.json → scope.json and fill it in, then drive the skill with /pentest <url>.

Step 0 — ENGAGEMENT INTAKE (before ANY request to the target)

python3 .claude/scripts/pentest/intake.py status → exit 1 = ask the user, in one message: in-scope · out-of-scope · forbidden actions · test accounts per role (+ staging/prod, testing window + rate limit, stop conditions, emergency contact). Wait for the answer, then intake.py record --answers -. Never infer scope or guess credentials; secrets go to output/pentest/<host>/sessions/credentials.json (0600), never into scope.json. The RECON gate HARD-blocks without it. Details: references/phases/phase0-intake.md §Q0.

Scope rail (real PreToolUse hook — Claude Code)

The installer wires scripts/pentest/scope_guard.py into .claude/settings.json as a PreToolUse hook. It runs before every Bash/WebFetch call and HARD-blocks any host in scope.json denied_hosts, or (when allowed_hosts is set) any host not covered by it — infra and non-network commands pass. Enforcement is at the tool boundary and survives /compact; it does not depend on you checking scope. If a call is blocked, read the stderr reason and fix the target or scope.json — never route around it.

Session start — update notice (non-blocking)

python3 .claude/scripts/pentest/update_check.py → prints ONE line only if a newer skill is published (cached 24 h, 3 s timeout, silent on failure, never touches the target). Relay that line to the user; never update yourself — updating is the user's call, between engagements (install.sh --update). Off: PENTEST_UPDATE_CHECK=0 or scope.json "update_check": false / notes.offline: true.

Orient / resume (after /compact or a crash)

  1. python3 .claude/scripts/pentest/session_card.py show --run-id $PENTEST_SESSION → NEXT ACTION. python3 .claude/scripts/pentest/intake.py show → ROE card (scope + forbidden actions + roles).
  2. Read output/pentest/<host>/SITE-MODEL.md → full understanding in one read.
  3. python3 .claude/scripts/pentest/session_health.py → micro-step gaps.
  4. Continue the current phase. Phases auto-advance: RECON → MAP → HUNT → REPORT.

State = Markdown file-store (no DB, no daemon)

output/pentest/_store/<collection>/*.md (JSON frontmatter + readable body). Read any file directly (cat/grep); write only via the gate scripts so the lock + gates stay honest. Never hand-edit a _store/*.md to fake state. Details: references/ops/storage-layout.md.

Gates enforce TRUTH, not FORM (references/ops/gate-philosophy.md)

  • HARD (blocks): scope + engagement intake (user-confirmed in/out-of-scope, forbidden, credentials) · evidence exists · reproduces (repro_check in independent replay, absent in baseline) · adversarial verdict ≠ rejected (CRIT/HIGH) · real-vuln (boundary + principal + observed_result) · PoC has a runnable command + observed result · demonstrated-PoC floor (MEDIUM+): a severity-carrying finding needs captured proof — a validated evidence_artifact OR an M7 replay with a non-generic repro_check. MEDIUM with only prose + a command string is NOT confirmed → needs_validation (severity-less) or INFO note (TR4; finding_close.check_poc_demonstrated).
  • SOFT (advisory): prose length, step/paragraph counts, style, screenshot presence — your judgement, not a hardcoded threshold. Default PENTEST_GATE_MODE=reason (HARD only); =strict for eval/CI parity.
  • Budget: never cut tests; cut meta. Follow the signal over the checklist (PENTEST_BUDGET=tight).

TR1–TR4 — truthfulness scale (single source; finding_close.py enforces)

Every finding carries status ∈ whitebox_theoretical | lab_synthetic | lab_real_build | vendor_acknowledged (confirmed_dynamic is BANNED).

  • TR1 — set status honestly to the evidence you actually have.
  • TR2 — if the lab was modified/stubbed/bypassed (lab_modifications), status is capped at lab_synthetic; record what made it synthetic (lab_modifications{modified_files,removed_checks,build_flags,reason} / lab_limitations).
  • TR3 — text (title/description/impact/poc) must not claim real-product success above the status; only lab_real_build/vendor_acknowledged may read as confirmed-on-product.
  • TR4 — no reproduction artifact ⇒ the finding stays a suspect, not confirmed.

Key scripts (.claude/scripts/pentest/)

intake · step_done · ep_close · phase_close · poc_gate · finding_close · flush · render_report · report_validate · derive_required_classes · agent_plan (HUNT fan-out) · convergence (HUNT re-hunt loop: --applyre-opens late endpoints + sweeps found classes;--record-wave; gate 4.7 closes HUNT only at the no-new-signal fixpoint) · adversarial_verify. Run with python3 (3.9+ OK) or python3.12. Output + user-facing findings = English; reasoning / tool calls / sub-agent prompts = English.

Auto-persist on confirm (project rule — do not wait for the user)

WRITE-FIRST — every finding MUST be written to disk immediately; no finding may live only in chat/thought. The moment a probe yields a finding (CRIT/HIGH/MEDIUM/LOW, or just a needs_validation lead), write it to _store/findings/ IN THE SAME turn — before doing anything else. Do not "report it later", do not batch several findings and write them in one go: every forgotten write = one vulnerability missing from the report. If you lack the fields to confirm it, still write it as needs_validation (no severity) so the lead is not lost, then upgrade later. This applies to side findings discovered incidentally while testing something else.

The moment a probe confirms a finding (boundary + principal + observed_result all present with evidence), persist it in the SAME turn — never defer to a later prompt. Order:

  1. Save raw evidence (request/response, screenshots, scripts) to output/pentest/<host>/evidence/<hunt>-<YYYY-MM-DD>/.
  2. Upsert the finding doc in _store/findings/VULN-<engagement>-<NNN>.*.md with full fields (title/severity/CVSS/CWE/OWASP/boundary/principal/observed_result/description/impact/ remediation/references/poc.steps[]/evidence_artifact{run_id,request_file,response_file,repro_check,timestamp}). For CRIT/HIGH add refutation{verdict,attempted_refutations,reason,replayed}.
  3. Re-render the single consolidated report immediately: python3 .claude/scripts/pentest/render_report.py --run-id=$PENTEST_SESSION --target=$PENTEST_TARGET.
  4. Append a 1-line note to output/pentest/<host>/SITE-MODEL.md §8 Resume noting the new/escalated finding.

If an existing finding is escalated (severity/CVSS/scope widened), update that doc — do NOT open a parallel VULN-NNN. The report is one file; every re-render replaces it in place.

Reconciliation before REPORT (anti-miss): before closing/REPORT, re-check — every finding ever mentioned in chat, in SITE-MODEL §8, or in the evidence folder MUST have a corresponding VULN-NNN doc in _store/findings/ and appear in the report after render. If a finding carries a NEW impact (e.g. cost/DoS distinct from confidentiality), split it into its own finding instead of burying it in another finding's description. The finding count in the report must match the number of confirmed findings — a mismatch means a miss: find it and write it before delivery.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.