@abdulr7man/pensieve 0.0.0-stage → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/LICENSE +684 -0
  2. package/README.md +180 -2
  3. package/VERSION +1 -0
  4. package/agents/README.md +16 -0
  5. package/agents/pensieve-code-auditor.md +58 -0
  6. package/agents/pensieve-mapper.md +46 -0
  7. package/agents/pensieve-planner.md +67 -0
  8. package/agents/pensieve-reconner.md +76 -0
  9. package/agents/pensieve-reporter.md +61 -0
  10. package/agents/pensieve-roe-checker.md +46 -0
  11. package/agents/pensieve-scoper.md +77 -0
  12. package/agents/pensieve-tester.md +83 -0
  13. package/agents/pensieve-validator.md +62 -0
  14. package/bin/pensieve +452 -0
  15. package/bin/pensieve-installer.cjs +5 -0
  16. package/commands/pensieve-close.md +6 -0
  17. package/commands/pensieve-map.md +6 -0
  18. package/commands/pensieve-new-engagement.md +6 -0
  19. package/commands/pensieve-pause.md +15 -0
  20. package/commands/pensieve-plan.md +6 -0
  21. package/commands/pensieve-progress.md +34 -0
  22. package/commands/pensieve-quick.md +8 -0
  23. package/commands/pensieve-recon.md +6 -0
  24. package/commands/pensieve-report.md +6 -0
  25. package/commands/pensieve-resume.md +6 -0
  26. package/commands/pensieve-retest.md +10 -0
  27. package/commands/pensieve-scope.md +49 -0
  28. package/commands/pensieve-surface.md +8 -0
  29. package/commands/pensieve-test.md +6 -0
  30. package/commands/pensieve-validate.md +6 -0
  31. package/docker/Dockerfile.pensieve-toolbox +75 -0
  32. package/docker/compose.pensieve-net.yml +37 -0
  33. package/docker/squid.conf.template +21 -0
  34. package/package.json +39 -4
  35. package/packs/ad/ad-killchain/checklist.md +64 -0
  36. package/packs/ad/ad-killchain/pack.yaml +19 -0
  37. package/packs/cloud/cloud-cis/checklist.md +66 -0
  38. package/packs/cloud/cloud-cis/pack.yaml +20 -0
  39. package/packs/fintech/practice-core/checklist.md +33 -0
  40. package/packs/fintech/practice-core/learnings.md +5 -0
  41. package/packs/fintech/practice-core/pack.yaml +18 -0
  42. package/packs/infra/ptes-infra/checklist.md +22 -0
  43. package/packs/infra/ptes-infra/pack.yaml +19 -0
  44. package/packs/mobile/owasp-masvs/checklist.md +80 -0
  45. package/packs/mobile/owasp-masvs/pack.yaml +20 -0
  46. package/packs/owasp-api-v4/checklist.md +85 -0
  47. package/packs/owasp-api-v4/learnings.md +6 -0
  48. package/packs/owasp-api-v4/pack.yaml +23 -0
  49. package/packs/owasp-api-v4/runbooks/API1/SKILL.md +66 -0
  50. package/packs/owasp-api-v4/runbooks/API10/SKILL.md +67 -0
  51. package/packs/owasp-api-v4/runbooks/API2/SKILL.md +129 -0
  52. package/packs/owasp-api-v4/runbooks/API3/SKILL.md +55 -0
  53. package/packs/owasp-api-v4/runbooks/API4/SKILL.md +59 -0
  54. package/packs/owasp-api-v4/runbooks/API5/SKILL.md +60 -0
  55. package/packs/owasp-api-v4/runbooks/API6/SKILL.md +63 -0
  56. package/packs/owasp-api-v4/runbooks/API7/SKILL.md +70 -0
  57. package/packs/owasp-api-v4/runbooks/API8/SKILL.md +72 -0
  58. package/packs/owasp-api-v4/runbooks/API9/SKILL.md +66 -0
  59. package/packs/thickclient/thickclient-core/checklist.md +60 -0
  60. package/packs/thickclient/thickclient-core/pack.yaml +24 -0
  61. package/packs/web/asvs-l2/checklist.md +50 -0
  62. package/packs/web/asvs-l2/learnings.md +6 -0
  63. package/packs/web/asvs-l2/pack.yaml +19 -0
  64. package/packs/web/asvs-l2/runbooks/V2-AUTH-ENUM/SKILL.md +75 -0
  65. package/packs/web/asvs-l2/runbooks/V2-AUTH-LIVE/SKILL.md +78 -0
  66. package/packs/web/asvs-l2/runbooks/V2-AUTH-MFA/SKILL.md +76 -0
  67. package/packs/web/asvs-l2/runbooks/V2-AUTH-RATE/SKILL.md +72 -0
  68. package/packs/web/owasp-testing-checklist/checklist.md +52 -0
  69. package/packs/web/owasp-testing-checklist/learnings.md +47 -0
  70. package/packs/web/owasp-testing-checklist/pack.yaml +21 -0
  71. package/packs/web/unauth-perimeter/checklist.md +72 -0
  72. package/packs/web/unauth-perimeter/pack.yaml +18 -0
  73. package/packs/web/unauth-perimeter/runbooks/PERIM-01/SKILL.md +60 -0
  74. package/packs/web/unauth-perimeter/runbooks/PERIM-02/SKILL.md +63 -0
  75. package/packs/web/unauth-perimeter/runbooks/PERIM-03/SKILL.md +62 -0
  76. package/packs/web/unauth-perimeter/runbooks/PERIM-04/SKILL.md +75 -0
  77. package/packs/web/unauth-perimeter/runbooks/PERIM-05/SKILL.md +66 -0
  78. package/packs/web/unauth-perimeter/runbooks/PERIM-06/SKILL.md +59 -0
  79. package/packs/web/unauth-perimeter/runbooks/PERIM-07/SKILL.md +56 -0
  80. package/packs/web/unauth-perimeter/runbooks/PERIM-08/SKILL.md +57 -0
  81. package/packs/web/unauth-perimeter/runbooks/PERIM-09/SKILL.md +62 -0
  82. package/packs/web/unauth-perimeter/runbooks/PERIM-10/SKILL.md +60 -0
  83. package/packs/whitebox/code-audit-core/checklist.md +36 -0
  84. package/packs/whitebox/code-audit-core/learnings.md +6 -0
  85. package/packs/whitebox/code-audit-core/pack.yaml +14 -0
  86. package/prompts/orchestrator-core.md +52 -0
  87. package/reference/attack-playbooks.md +57 -0
  88. package/reference/otp-relay.md +98 -0
  89. package/reference/param-profiles.md +48 -0
  90. package/reference/templates/FINDING.md +97 -0
  91. package/reference/tool-selection.md +64 -0
  92. package/reference/vulnerability-finding-standard.md +80 -0
  93. package/runtimes/hermes/hooks/injection-scan.py +290 -0
  94. package/runtimes/hermes/hooks/scope-guard.py +136 -0
  95. package/skills/pensieve/SKILL.md +134 -0
  96. package/skills/pensieve-close/SKILL.md +31 -0
  97. package/skills/pensieve-map/SKILL.md +25 -0
  98. package/skills/pensieve-new-engagement/SKILL.md +28 -0
  99. package/skills/pensieve-pause/SKILL.md +22 -0
  100. package/skills/pensieve-plan/SKILL.md +39 -0
  101. package/skills/pensieve-progress/SKILL.md +35 -0
  102. package/skills/pensieve-quick/SKILL.md +47 -0
  103. package/skills/pensieve-recon/SKILL.md +30 -0
  104. package/skills/pensieve-report/SKILL.md +46 -0
  105. package/skills/pensieve-resume/SKILL.md +33 -0
  106. package/skills/pensieve-retest/SKILL.md +35 -0
  107. package/skills/pensieve-scope/SKILL.md +35 -0
  108. package/skills/pensieve-surface/SKILL.md +36 -0
  109. package/skills/pensieve-test/SKILL.md +35 -0
  110. package/skills/pensieve-validate/SKILL.md +28 -0
  111. package/skills/pensieve-wiki/SKILL.md +39 -0
  112. package/src/installer/cli.cjs +209 -0
  113. package/src/installer/home.cjs +155 -0
  114. package/src/installer/runtimes.cjs +276 -0
  115. package/src/installer/uninstall.cjs +342 -0
  116. package/src/pensieve-sdk/bin/pensieve-sdk.cjs +1045 -0
  117. package/src/pensieve-sdk/lib/agent-translate.cjs +50 -0
  118. package/src/pensieve-sdk/lib/approvals.cjs +408 -0
  119. package/src/pensieve-sdk/lib/audit.cjs +290 -0
  120. package/src/pensieve-sdk/lib/checklist.cjs +337 -0
  121. package/src/pensieve-sdk/lib/clientlist.cjs +814 -0
  122. package/src/pensieve-sdk/lib/close.cjs +133 -0
  123. package/src/pensieve-sdk/lib/config.cjs +156 -0
  124. package/src/pensieve-sdk/lib/cvss.cjs +91 -0
  125. package/src/pensieve-sdk/lib/env.cjs +272 -0
  126. package/src/pensieve-sdk/lib/evidence.cjs +217 -0
  127. package/src/pensieve-sdk/lib/findings.cjs +1096 -0
  128. package/src/pensieve-sdk/lib/frontmatter.cjs +178 -0
  129. package/src/pensieve-sdk/lib/graph.cjs +607 -0
  130. package/src/pensieve-sdk/lib/ids.cjs +63 -0
  131. package/src/pensieve-sdk/lib/init.cjs +79 -0
  132. package/src/pensieve-sdk/lib/liveness.cjs +176 -0
  133. package/src/pensieve-sdk/lib/loop.cjs +619 -0
  134. package/src/pensieve-sdk/lib/migrate.cjs +57 -0
  135. package/src/pensieve-sdk/lib/monitor.cjs +69 -0
  136. package/src/pensieve-sdk/lib/pack.cjs +607 -0
  137. package/src/pensieve-sdk/lib/paths.cjs +73 -0
  138. package/src/pensieve-sdk/lib/pdf.cjs +291 -0
  139. package/src/pensieve-sdk/lib/recon.cjs +296 -0
  140. package/src/pensieve-sdk/lib/renderers/__pycache__/formal_report.cpython-314.pyc +0 -0
  141. package/src/pensieve-sdk/lib/renderers/formal_report.py +608 -0
  142. package/src/pensieve-sdk/lib/report.cjs +1135 -0
  143. package/src/pensieve-sdk/lib/runbook.cjs +124 -0
  144. package/src/pensieve-sdk/lib/sarif.cjs +154 -0
  145. package/src/pensieve-sdk/lib/scope.cjs +621 -0
  146. package/src/pensieve-sdk/lib/security.cjs +61 -0
  147. package/src/pensieve-sdk/lib/skills.cjs +193 -0
  148. package/src/pensieve-sdk/lib/state.cjs +610 -0
  149. package/src/pensieve-sdk/lib/subagent.cjs +658 -0
  150. package/src/pensieve-sdk/lib/target.cjs +149 -0
  151. package/src/pensieve-sdk/lib/tools.cjs +66 -0
  152. package/src/pensieve-sdk/lib/vault.cjs +122 -0
  153. package/src/pensieve-sdk/lib/vendor/cvss40.LICENSE +22 -0
  154. package/src/pensieve-sdk/lib/vendor/cvss40.js +1208 -0
  155. package/src/pensieve-sdk/package.json +11 -0
  156. package/templates/ACCOUNTS.md +35 -0
  157. package/templates/ATTACK-SURFACE.md +30 -0
  158. package/templates/FINDING.md +43 -0
  159. package/templates/PLAN.md +33 -0
  160. package/templates/PROJECT.md +29 -0
  161. package/templates/ROE.md +50 -0
  162. package/templates/RUN-LOG.md +19 -0
  163. package/templates/SCOPE.md +32 -0
  164. package/templates/VALIDATION.md +62 -0
  165. package/templates/report/REPORT.md +49 -0
  166. package/workflows/close.md +34 -0
  167. package/workflows/map.md +39 -0
  168. package/workflows/new-engagement.md +37 -0
  169. package/workflows/plan.md +45 -0
  170. package/workflows/progress.md +28 -0
  171. package/workflows/quick.md +67 -0
  172. package/workflows/recon.md +87 -0
  173. package/workflows/report.md +51 -0
  174. package/workflows/resume.md +26 -0
  175. package/workflows/retest.md +53 -0
  176. package/workflows/scope.md +47 -0
  177. package/workflows/surface.md +29 -0
  178. package/workflows/test.md +95 -0
  179. package/workflows/validate.md +34 -0
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: PERIM-05 — Docs/debug probes, body-verified
3
+ item: PERIM-05
4
+ description: swagger/openapi/api-docs/WEB-INF/web.xml/.git HEAD probes where every 200 is body-verified — 200 with a friendly-error body is a NEGATIVE.
5
+ agents: [pensieve-tester]
6
+ pack: web/unauth-perimeter
7
+ ---
8
+
9
+ ## Tools
10
+
11
+ curl, jq
12
+
13
+ ## Steps
14
+
15
+ Body-over-status: status codes lie — fetch and inspect the body. THE ENDEMIC
16
+ FALSE-POSITIVE TRAP of this item: SPA/router catch-alls answer **200 with a
17
+ friendly-error body** (`{"error":"not found"}`, the app's index.html) for ANY
18
+ path. A 200 here is a NEGATIVE until the body proves the artifact's real
19
+ shape. Never file docs/debug exposure on status alone.
20
+
21
+ ```sh
22
+ export PROXY=http://127.0.0.1:8080 # engagement proxy from PROJECT.md
23
+ export TS=$(date -u +%Y%m%dT%H%M%SZ)
24
+
25
+ # 1. Fetch the probe set — body saved per path:
26
+ for p in swagger.json openapi.json api-docs WEB-INF/web.xml .git/HEAD; do
27
+ out="perim05-$(echo "$p" | tr '/.' '__')-$TS.txt"
28
+ curl -sk -x "$PROXY" -o "$out" -w "$p status=%{http_code} size=%{size_download}\n" \
29
+ "https://$TARGET/$p"
30
+ done
31
+
32
+ # 2. BODY VERIFICATION per artifact — the shape, not the status:
33
+ # openapi/swagger must be a real document: version key + a populated paths object
34
+ jq -e '(.openapi or .swagger) and (.paths | length > 0)' perim05_openapi*"$TS".txt 2>/dev/null \
35
+ || jq -e '(.openapi or .swagger) and (.paths | length > 0)' perim05_swagger*"$TS".txt 2>/dev/null \
36
+ || echo 'NO real openapi/swagger body'
37
+ # api-docs must render a docs UI or listing, not the SPA shell
38
+ grep -ciE 'swagger-ui|redoc|api-doc|<title>.*api' perim05_api_docs*"$TS".txt
39
+ # web.xml must be servlet XML
40
+ grep -cm1 '<web-app' perim05_WEB_INF_web_xml*"$TS".txt
41
+ # .git/HEAD must literally be a ref pointer
42
+ grep -m1 'ref: refs/' perim05__git_HEAD*"$TS".txt
43
+
44
+ # 3. The one-liner discriminator for the friendly-error trap (any probe):
45
+ # head -c 200 <capture> — JSON error / HTML shell => NEGATIVE
46
+ head -c 200 perim05_*"$TS".txt
47
+ ```
48
+
49
+ ## Expected Evidence
50
+
51
+ Timestamped raw captures `perim05_<path>-$TS.txt` (one per probe) + the
52
+ status/size table from step 1. WHICH LINES MATTER: for openapi/swagger, the
53
+ `"openapi"`/`"swagger"` key line and ≥1 entry under `"paths"` (jq pass = body
54
+ proof); for api-docs, the swagger-ui/redoc marker line; for web.xml, the
55
+ `<web-app` line; for .git/HEAD, the `ref: refs/heads/...` line.
56
+
57
+ ## Pass/Fail
58
+
59
+ FINDING only when the BODY proves the artifact: a real OpenAPI document with
60
+ paths, a docs UI that lists endpoints, servlet XML, or a git HEAD ref (then
61
+ `.git/config`, `/index` follow up in the same lane). PASS (negative) when each
62
+ probe returns 404/403, OR 200 whose body is a friendly-error/SPA shell — the
63
+ trap — with the head-of-body recorded as proof of the negative. Any finding
64
+ later validated as disclosure (CWE 200/209) must quote the actual body in a
65
+ fenced ```body-quote block per the 21-01 controls — the status alone proves
66
+ nothing there either.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: PERIM-06 — Verb tampering + TRACE echo
3
+ item: PERIM-06
4
+ description: PUT/DELETE/PATCH on a known route with state-change proven by body/state diff, plus a TRACE echo check.
5
+ agents: [pensieve-tester]
6
+ pack: web/unauth-perimeter
7
+ ---
8
+
9
+ ## Tools
10
+
11
+ curl
12
+
13
+ ## Steps
14
+
15
+ Body-over-status: status codes lie — a 200/204 on DELETE is NOT evidence of a
16
+ state change until the resource's body/state diff proves it; and a 405 TRACE
17
+ reply whose BODY echoes the request is still cross-site-tracing material. Judge
18
+ bodies and diffs, never statuses. Run against ONE known unauth-reachable route
19
+ (e.g. a public resource or the login endpoint's API route), placeholder only.
20
+
21
+ ```sh
22
+ export PROXY=http://127.0.0.1:8080 # engagement proxy from PROJECT.md
23
+ export TS=$(date -u +%Y%m%dT%H%M%SZ)
24
+ R="https://$TARGET/<known-route>" # one route that exists unauth
25
+
26
+ # 1. Baseline state BEFORE any verb probe:
27
+ curl -sk -x "$PROXY" -o "perim06-before-$TS.txt" -w 'before status=%{http_code}\n' "$R"
28
+
29
+ # 2. The verbs — status+size table, full body per verb:
30
+ for v in PUT DELETE PATCH TRACE; do
31
+ curl -sk -x "$PROXY" -X "$v" -o "perim06-$v-$TS.txt" \
32
+ -w "$v status=%{http_code} size=%{size_download}\n" "$R"
33
+ done
34
+
35
+ # 3. State-change PROOF — re-read and diff (this, not any 200, is the claim):
36
+ curl -sk -x "$PROXY" -o "perim06-after-$TS.txt" -w 'after status=%{http_code}\n' "$R"
37
+ diff "perim06-before-$TS.txt" "perim06-after-$TS.txt" | tee "perim06-diff-$TS.txt"
38
+
39
+ # 4. TRACE echo check — the body must ECHO the request line/headers to count:
40
+ grep -iE '^(TRACE |Host:|User-Agent:|Accept:)' "perim06-TRACE-$TS.txt"
41
+ ```
42
+
43
+ ## Expected Evidence
44
+
45
+ Timestamped raw captures: `perim06-<VERB>-$TS.txt` bodies, the verb
46
+ status/size table, and the `perim06-before/after/diff-$TS.txt` triple. WHICH
47
+ LINES MATTER: the diff (any hunk = real state change), and in
48
+ `perim06-TRACE-$TS.txt` the echoed `TRACE /... HTTP/1.1` + `Host:` lines.
49
+
50
+ ## Pass/Fail
51
+
52
+ FINDING if (a) PUT/PATCH/DELETE on the unauth route changes state — a non-empty
53
+ diff or a changed re-GET body is the proof (cite the diff hunks); or (b) the
54
+ TRACE body echoes request lines (XST material). PASS if 405/501 with no echo
55
+ and the before/after bodies are identical. FALSE-POSITIVE TRAPS: a 200/204
56
+ reply with an EMPTY diff is recorded but is a NEGATIVE for the state-change
57
+ claim — never report "DELETE worked" on status; the same SPA friendly-error
58
+ 200 (body is the app shell) that PERIM-05 names also haunts this item — check
59
+ the verb bodies are not all the same shell.
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: PERIM-07 — robots.txt origin/path disclosure
3
+ item: PERIM-07
4
+ description: Body-verified robots.txt parse for Disallow paths, Sitemap and absolute-URL origin/host disclosure — recorded for recon, never probed out of scope.
5
+ agents: [pensieve-tester, pensieve-reconner]
6
+ pack: web/unauth-perimeter
7
+ ---
8
+
9
+ ## Tools
10
+
11
+ curl
12
+
13
+ ## Steps
14
+
15
+ Body-over-status: status codes lie — most stacks 200 ANY unknown path, so a
16
+ 200 for /robots.txt proves nothing. Verify the BODY is actually a robots file
17
+ (User-agent/Disallow directives) before parsing anything.
18
+
19
+ ```sh
20
+ export PROXY=http://127.0.0.1:8080 # engagement proxy from PROJECT.md
21
+ export TS=$(date -u +%Y%m%dT%H%M%SZ)
22
+
23
+ # 1. Fetch + BODY-verify it is a robots file (the friendly-error trap):
24
+ curl -sk -x "$PROXY" -o "perim07-robots-$TS.txt" -w 'robots status=%{http_code} size=%{size_download}\n' \
25
+ "https://$TARGET/robots.txt"
26
+ grep -icE '^(user-agent|disallow|allow|sitemap|crawl-delay):' "perim07-robots-$TS.txt"
27
+
28
+ # 2. Parse the directives — Disallow paths are hidden-surface intel:
29
+ grep -iE '^(disallow|allow|crawl-delay):' "perim07-robots-$TS.txt"
30
+
31
+ # 3. Origin/host disclosure — every absolute URL (Sitemap lines especially):
32
+ grep -oiE 'https?://[a-z0-9.-]+' "perim07-robots-$TS.txt" | sort -u | tee "perim07-origins-$TS.txt"
33
+
34
+ # 4. Cross-check each disclosed host against engagement scope:
35
+ # in-scope -> add to the recon target list
36
+ # out-of-scope -> RECORD ONLY (see below) — do NOT probe
37
+ ```
38
+
39
+ ## Expected Evidence
40
+
41
+ Timestamped raw capture `perim07-robots-$TS.txt` plus
42
+ `perim07-origins-$TS.txt`. WHICH LINES MATTER: the count of directive lines
43
+ (step 1 — 0 directives means the 200 was the friendly-error trap and the item
44
+ is a NEGATIVE), every `Disallow:` line (hidden paths), and every line of
45
+ `perim07-origins-$TS.txt` (disclosed origins/hosts).
46
+
47
+ ## Pass/Fail
48
+
49
+ This item is RECORD-first (recon feed), not usually a standalone finding.
50
+ Finding material arises when robots discloses origins/hosts NOT in the client's
51
+ own inventory (feeds the inventory-management item) or hidden admin paths.
52
+ NEGATIVE if 404/403, or a 200 body with zero robots directives — that body is
53
+ the friendly-error/SPA-shell trap again; keep it as proof of the negative.
54
+ HARD RULE: never probe a disclosed origin that is out of engagement scope —
55
+ record it in the RUN-LOG/recon notes and surface it to the operator for a
56
+ scope decision.
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: PERIM-08 — sitemap.xml entry + internal-parameter inventory
3
+ item: PERIM-08
4
+ description: Body-verified sitemap parse — entry count and an inventory of internal-ID-class URL parameters that feed the IDOR/API lanes.
5
+ agents: [pensieve-tester, pensieve-reconner]
6
+ pack: web/unauth-perimeter
7
+ ---
8
+
9
+ ## Tools
10
+
11
+ curl
12
+
13
+ ## Steps
14
+
15
+ Body-over-status: status codes lie — verify the BODY is sitemap XML (`<loc>`
16
+ entries) before counting anything; a 200 serving the SPA shell or a
17
+ friendly-error body is the endemic negative.
18
+
19
+ ```sh
20
+ export PROXY=http://127.0.0.1:8080 # engagement proxy from PROJECT.md
21
+ export TS=$(date -u +%Y%m%dT%H%M%SZ)
22
+
23
+ # 1. Fetch + BODY-verify real sitemap XML:
24
+ curl -sk -x "$PROXY" -o "perim08-sitemap-$TS.txt" -w 'sitemap status=%{http_code} size=%{size_download}\n' \
25
+ "https://$TARGET/sitemap.xml"
26
+ grep -c '<loc>' "perim08-sitemap-$TS.txt"
27
+
28
+ # 2. URL extraction + entry count:
29
+ grep -oE '<loc>[^<]+' "perim08-sitemap-$TS.txt" | sed 's/<loc>//' \
30
+ | sort -u | tee "perim08-urls-$TS.txt"
31
+ wc -l "perim08-urls-$TS.txt"
32
+
33
+ # 3. Internal-parameter inventory — internal-ID-class parameters (p_l_id-style
34
+ # portlet/session ids, record ids, internal numeric params) leak the app's
35
+ # object-reference scheme and feed the IDOR/API lanes:
36
+ grep -oE '[?&][a-z_0-9]+=[^&<]+' "perim08-urls-$TS.txt" | sort | uniq -c | sort -rn \
37
+ | tee "perim08-params-$TS.txt"
38
+
39
+ # 4. Flag entries pointing at non-public-looking surfaces (admin/internal paths):
40
+ grep -iE '(admin|internal|staging|test|backend|manager)' "perim08-urls-$TS.txt"
41
+ ```
42
+
43
+ ## Expected Evidence
44
+
45
+ Timestamped raw capture `perim08-sitemap-$TS.txt` plus `perim08-urls-$TS.txt`
46
+ and `perim08-params-$TS.txt`. WHICH LINES MATTER: the `<loc>` count line
47
+ (step 1 — 0 means the negative trap fired), the total in `wc -l`, and every
48
+ row of the parameter frequency table (the internal-ID inventory).
49
+
50
+ ## Pass/Fail
51
+
52
+ RECORD-first: a verified sitemap yields the entry count + parameter inventory
53
+ for the recon notes and the IDOR/API lanes. Finding material if it leaks
54
+ internal/admin URLs, or internal-ID-class parameters that enumerate private
55
+ objects (p_l_id-class params on public URLs are exactly that signal).
56
+ NEGATIVE if 404/403, or 200 with zero `<loc>` entries — keep the head of that
57
+ body as proof of the negative (the friendly-error trap).
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: PERIM-09 — WAF block-page body leaks
3
+ item: PERIM-09
4
+ description: Trigger one WAF block with a harmless malicious-looking probe, then read the BLOCK PAGE BODY — the page itself is the finding surface.
5
+ agents: [pensieve-tester]
6
+ pack: web/unauth-perimeter
7
+ ---
8
+
9
+ ## Tools
10
+
11
+ curl
12
+
13
+ ## Steps
14
+
15
+ Body-over-status: status codes lie — a bare 403 only says "blocked". The
16
+ finding surface is the BLOCK PAGE BODY: internal hostnames, contact addresses,
17
+ rule/transaction ids, stack traces, backend banners. Fetch the block page and
18
+ READ it, line by line.
19
+
20
+ ```sh
21
+ export PROXY=http://127.0.0.1:8080 # engagement proxy from PROJECT.md
22
+ export TS=$(date -u +%Y%m%dT%H%M%SZ)
23
+
24
+ # 1. Trigger any block — malicious-LOOKING but harmless payloads only:
25
+ curl -sk -x "$PROXY" -o "perim09-block-$TS.txt" -D "perim09-block-hdr-$TS.txt" \
26
+ -w 'xss-probe status=%{http_code} size=%{size_download}\n' \
27
+ 'https://$TARGET/?q=%3Cscript%3Ealert%281%29%3C%2Fscript%3E'
28
+ curl -sk -x "$PROXY" -o "perim09-sqli-$TS.txt" \
29
+ -w 'sqli-probe status=%{http_code} size=%{size_download}\n' \
30
+ 'https://$TARGET/?q=%27%20OR%201%3D1--'
31
+
32
+ # 2. Read the block-page BODY for leaks (the finding surface):
33
+ # contact addresses / mailto / URLs:
34
+ grep -oiE '([a-z0-9._%+-]+@[a-z0-9.-]+|mailto:|https?://[a-z0-9.-]+)' "perim09-block-$TS.txt" | sort -u
35
+ # rule/transaction ids and internal detail:
36
+ grep -iE 'rule|ray-id|correlation|transaction|support|contact|internal|backend|server|stack|exception|nginx|apache|iis|cloudflare|akamai|imperva|f5' \
37
+ "perim09-block-$TS.txt" | head -30
38
+
39
+ # 3. Record the block SIGNATURE (status + body fingerprint) for the engagement:
40
+ grep -iE '^(HTTP/|server:|x-)' "perim09-block-hdr-$TS.txt"
41
+ md5sum "perim09-block-$TS.txt"
42
+ ```
43
+
44
+ ## Expected Evidence
45
+
46
+ Timestamped raw captures `perim09-block-$TS.txt` (+ sqli variant) with
47
+ `perim09-block-hdr-$TS.txt`. WHICH LINES MATTER: every line the step-2 greps
48
+ surface — emails/URLs that are internal, rule ids, transaction/correlation
49
+ ids, stack traces, backend/WAF product banners; plus the block signature lines
50
+ (status, Server:, product headers) used to calibrate later probes.
51
+
52
+ ## Pass/Fail
53
+
54
+ FINDING if the block page leaks internal detail: internal hostnames/IPs,
55
+ internal contact addresses, rule or transaction ids with stack detail, backend
56
+ server versions. PASS (negative) if the block page is a generic, detail-free
57
+ page — record its signature anyway (it calibrates every later probe: what a
58
+ "blocked" answer looks like on THIS target). TRAP: a 200/403 with the normal
59
+ app body means the probe did NOT trigger a block — that is a different record
60
+ ("no WAF reaction observed"), not a leak finding; also compare the two probe
61
+ bodies: identical shell bodies are the friendly-error pattern, not a block
62
+ page.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: PERIM-10 — Header consistency (XFO vs frame-ancestors) + cache discipline
3
+ item: PERIM-10
4
+ description: X-Frame-Options vs CSP frame-ancestors consistency check and Cache-Control on the sensitive replies (login POST, auth responses).
5
+ agents: [pensieve-tester]
6
+ pack: web/unauth-perimeter
7
+ ---
8
+
9
+ ## Tools
10
+
11
+ curl
12
+
13
+ ## Steps
14
+
15
+ Body-over-status: status codes lie — read the header LINES of the fetched
16
+ sensitive RESPONSES (the login POST reply especially; its 302 status says
17
+ nothing about its Cache-Control line). Reuses PERIM-01's captures when
18
+ available; otherwise snapshot fresh.
19
+
20
+ ```sh
21
+ export PROXY=http://127.0.0.1:8080 # engagement proxy from PROJECT.md
22
+ export TS=$(date -u +%Y%m%dT%H%M%SZ)
23
+
24
+ # 1. Framing-consistency pair — BOTH lines from the same capture:
25
+ curl -sk -x "$PROXY" -D "perim10-page-$TS.txt" -o /dev/null "https://$TARGET/<login-or-auth-page>"
26
+ grep -iE '^(x-frame-options|content-security-policy):' "perim10-page-$TS.txt" \
27
+ | tee "perim10-framing-$TS.txt"
28
+ # extract just the frame-ancestors directive for the comparison:
29
+ grep -i '^content-security-policy:' "perim10-page-$TS.txt" | tr ';' '\n' | grep -i 'frame-ancestors'
30
+
31
+ # 2. Cache discipline on the SENSITIVE replies — the login POST reply and an
32
+ # auth-error reply, not just the login page GET:
33
+ curl -sk -x "$PROXY" -X POST -d 'username=probe&password=probe' \
34
+ -D "perim10-post-$TS.txt" -o "perim10-post-body-$TS.txt" -w 'post status=%{http_code}\n' \
35
+ "https://$TARGET/<login-route>"
36
+ curl -sk -x "$PROXY" -H 'Authorization: Bearer invalid-probe' \
37
+ -D "perim10-auth-$TS.txt" -o /dev/null -w 'auth status=%{http_code}\n' \
38
+ "https://$TARGET/<api-route>"
39
+ grep -iE '^(cache-control|pragma|expires):' "perim10-post-$TS.txt" "perim10-auth-$TS.txt"
40
+ ```
41
+
42
+ ## Expected Evidence
43
+
44
+ Timestamped raw captures `perim10-page/post/auth-$TS.txt` (+ the consolidated
45
+ `perim10-framing-$TS.txt`). WHICH LINES MATTER: the XFO line AND the
46
+ frame-ancestors directive from the SAME response (the pair, not one of them),
47
+ and the `Cache-Control:` lines of the POST and auth replies specifically —
48
+ `no-store` missing there is the finding; the GET page's line is context.
49
+
50
+ ## Pass/Fail
51
+
52
+ FINDING if (a) XFO and frame-ancestors CONFLICT (e.g. `X-Frame-Options: DENY`
53
+ beside `frame-ancestors *` — the weaker one wins in mixed stacks), or BOTH are
54
+ absent; or (b) a sensitive reply (login POST, auth response bearing tokens or
55
+ PII) lacks `Cache-Control: no-store` (or equivalent) — cite that reply's
56
+ capture line. PASS if the pair is consistent (or one present and sane) and
57
+ every sensitive reply carries no-store. FALSE-POSITIVE TRAPS: judging cache
58
+ safety from the login page GET only (the POST reply is the cacheable one); and
59
+ treating an absent frame-ancestors as a conflict — absence is only a finding
60
+ when XFO is absent too (a lone XFO: DENY is fine).
@@ -0,0 +1,36 @@
1
+ # White-box Code Audit Core — Checklist
2
+
3
+ Source lives in `.pentest/source/` (ingested at scope time, ADR-012).
4
+ Status: `-` untested · `~` in progress · `x` tested-clean · `F-NNN` finding
5
+
6
+ | ID | Audit item | Status | Notes |
7
+ |----|-----------|--------|-------|
8
+ | AUD-INJ-01 | Injection sinks: SQL/NoSQL/cmd/LDAP built from input (semgrep taint rules) | - | |
9
+ | AUD-INJ-02 | Template rendering: SSTI-prone patterns, autoescape disabled | - | |
10
+ | AUD-AUTH-01 | AuthN: custom crypto, weak hashing (md5/sha1 on passwords), timing-unsafe compares | - | |
11
+ | AUD-AUTH-02 | AuthZ decorators/middleware: coverage gaps (routes WITHOUT checks) | - | |
12
+ | AUD-OBJ-01 | Object access: queries by user-controlled id without ownership predicate (BOLA patterns) | - | |
13
+ | AUD-SEC-01 | Secrets: hardcoded keys/tokens/connection strings (semgrep secrets rules) | - | |
14
+ | AUD-CRY-01 | Crypto: ECB, static IVs, weak RNG for security tokens, custom JWT verify | - | |
15
+ | AUD-DES-01 | Deserialization: pickle/yaml.load/Java readObject/.NET BinaryFormatter | - | |
16
+ | AUD-FILE-01 | Path handling: traversal-prone joins on user input; upload validation gaps | - | |
17
+ | AUD-SSRF-01 | Outbound requests built from user-controlled URLs (SSRF patterns) | - | |
18
+ | AUD-RACE-01 | Check-then-act on balances/limits without transactions/locks (fintech) | - | |
19
+ | AUD-LOG-01 | Sensitive data in logs; error handlers leaking internals | - | |
20
+
21
+ ## Protocol (pensieve-code-auditor)
22
+
23
+ 1. Run semgrep (auto-config + pack rules) inside toolbox over .pentest/source/;
24
+ store raw output as evidence (SARIF preferred — feeds the M1 ingest lane).
25
+ 2. Triage candidates: assume every mitigation ABSENT until the code proves it
26
+ (gsd-security-auditor stance). Framework defaults are not evidence.
27
+ 3. Confirm reachability: a finding needs a call path from an exposed entry
28
+ point — dead code is a note, not a finding.
29
+ 4. File draft findings with file:line evidence refs. Verdicts:
30
+ - running target exists → dynamic replay (validated)
31
+ - no runtime → independent code-path re-review by a fresh agent (validated-static)
32
+
33
+ ## Engagement learnings
34
+
35
+ - test: White-box: verify whether a token/JWT verify path accepts any correctly-signed token and skips caller-binding checks (IPHash / source-IP / User-Agent) when the claim is absent or the request omits it — forge a token with a known/plaintext secret and confirm acceptance with no binding. Source: captcha-bound-tokens-20260929 (F-001, verified).
36
+ - test: White-box: locate the token-signing secret in source (env / config / literal) and confirm it is NOT rotated, hashed, KMS-held, or loaded at runtime from a secret store — plaintext in-repo secret is a critical CWE-330 candidate. Source: captcha-bound-tokens-20260929 (F-001).
@@ -0,0 +1,6 @@
1
+ # Engagement learnings — candidate pool
2
+
3
+ _appended by pensieve-sdk pack.learn; promoted into the checklist by the pack author (ADR-022)_
4
+
5
+ - L-001 [promoted] (2026-09-30) White-box: verify whether a token/JWT verify path accepts any correctly-signed token and skips caller-binding checks (IPHash / source-IP / User-Agent) when the claim is absent or the request omits it — forge a token with a known/plaintext secret and confirm acceptance with no binding. Source: captcha-bound-tokens-20260929 (F-001, verified).
6
+ - L-002 [promoted] (2026-09-30) White-box: locate the token-signing secret in source (env / config / literal) and confirm it is NOT rotated, hashed, KMS-held, or loaded at runtime from a secret store — plaintext in-repo secret is a critical CWE-330 candidate. Source: captcha-bound-tokens-20260929 (F-001).
@@ -0,0 +1,14 @@
1
+ name: White-box Code Audit Core
2
+ slug: whitebox/code-audit-core
3
+ version: "1.0"
4
+ tier: DEFAULT
5
+ applies_to:
6
+ - white
7
+ - gray
8
+ source: "PENSIEVE ADR-012 (sources: gadievron/raptor, anthropics/claude-code-security-review, GSD gsd-security-auditor — see agents/README.md)"
9
+ license: internal
10
+ tools:
11
+ - semgrep|A|pip|semgrep
12
+ - joern|B|host-manual|host-bound CPG setup — user installs; see joern-cpg skill
13
+ checklist: checklist.md
14
+ notes: Static-analysis lane. Deterministic scanners produce candidates; pensieve-code-auditor reasons; verdicts enter the SAME register+gate (validated via dynamic replay when a target runs, else validated-static by independent re-review).
@@ -0,0 +1,52 @@
1
+ # PENSIEVE orchestrator core (profile-level protocol)
2
+
3
+ You are the PENSIEVE orchestrator: you run penetration-test ENGAGEMENTS, not
4
+ individual tricks. Your job is triage and delegation — the right specialist,
5
+ with the right contract, at the right checkpoint.
6
+
7
+ ## Prime rules
8
+
9
+ 1. Files over conversation. Engagement truth lives in the engagement
10
+ directory (flat layout: STATE/SCOPE/ROE/findings/evidence/... at the
11
+ root) — read it, write it, never hold state in your head (ADR-006).
12
+ 2. Determinism over cleverness. Scope verdicts, CVSS math, evidence hashing,
13
+ the findings gate → `pensieve-sdk` (ADR-004). You never eyeball these.
14
+ 3. Checkpoints are hard stops. Scope approval, plan approval, report approval.
15
+ You pause; the human decides; you never proceed through a checkpoint
16
+ because things "look fine" (ADR-009).
17
+ 4. Two enforcement layers are always on: pensieve-net (network) + scope-guard
18
+ hook (runtime). You never bypass, weaken, or "temporarily" disable either
19
+ (ADR-003/008). If they block something, the scope is wrong — surface it.
20
+
21
+ ## Triage
22
+
23
+ - New objective → /pensieve-new-engagement (or /pensieve-resume if a dir exists).
24
+ - Status says X → run the workflow for X (workflows/<x>.md). Never skip ahead
25
+ because a later step "seems ready".
26
+ - Ad-hoc small ask with no engagement → say so and propose /pensieve-new-engagement;
27
+ quick one-off tests without the full pipeline belong to M1 (/pensieve-quick).
28
+
29
+ ## Delegation map (fresh run per unit of work)
30
+
31
+ | Unit | Agent | Output marker |
32
+ |------|-------|---------------|
33
+ | Scoping interview | pensieve-scoper | `## SCOPE READY FOR APPROVAL` |
34
+ | Recon | pensieve-reconner | `## RECON COMPLETE` |
35
+ | Surface synthesis | pensieve-mapper | `## SURFACE MAPPED` |
36
+ | Plan | pensieve-planner | `## PLAN READY FOR APPROVAL` |
37
+ | ROE ruling | pensieve-roe-checker | `## ROE CHECK PASSED/FAILED` |
38
+ | One plan's testing | pensieve-tester | `## TEST RUN COMPLETE` |
39
+ | One finding's replay | pensieve-validator | `## FINDING VALIDATED/REJECTED` |
40
+ | White-box code audit | pensieve-code-auditor | `## AUDIT COMPLETE` |
41
+ | Report assembly | pensieve-reporter | `## REPORT READY` |
42
+
43
+ Each delegated run receives: the agent file content, the engagement dir path,
44
+ and its unit of work (plan id / finding id). It returns the marker; you verify
45
+ the FILES exist before accepting the marker (self-reports are not evidence).
46
+
47
+ ## Failure handling
48
+
49
+ - sdk error / containment self-check failure / hook refusal → stop, surface,
50
+ never work around safety mechanisms.
51
+ - Agent returns without its files → reject the run, re-delegate once, then
52
+ `## HUMAN NEEDED`.
@@ -0,0 +1,57 @@
1
+ # Attack playbooks (recon/test reference)
2
+
3
+ Ordered tool sequences with priority and tuned defaults. A playbook is the
4
+ STARTING shape of a recon or test lane — the agent adapts to what the target
5
+ returns, and cites deviations in the run log. Intensity presets live in
6
+ param-profiles.md and override the rates below.
7
+
8
+ Adapted from HexPensieve AI (MIT), Copyright (c) 2026 Muhammad Osama (0x4m4).
9
+
10
+ ## web_reconnaissance
11
+
12
+ 1. httpx — probe + tech-detect all in-scope web ports (`-tech-detect -status-code -title`)
13
+ 2. katana — crawl depth 3, JS crawl on (`-d 3 -jc`) — endpoint + JS inventory
14
+ 3. gau / waybackurls — historical URLs, subdomains included (`gau --subs`)
15
+ 4. nuclei — tech-tagged, severity critical,high (param-profiles rate)
16
+ 5. content discovery — ffuf OR gobuster (ONE, per tool-selection rule),
17
+ extensions per TECH.md stack
18
+ 6. arjun — parameter discovery on the interesting endpoints from 2–5
19
+
20
+ katana/gau/waybackurls/arjun are provisioned-lane tools (pip/go) if absent
21
+ from the toolbox image — `pensieve-sdk tools.check` first; never improvise
22
+ installs outside an ADR-014 provisioning window.
23
+
24
+ ## api_testing
25
+
26
+ 1. Inventory: OpenAPI/Swagger from recon; else build the route list from
27
+ JS bundles + ffuf route wordlist
28
+ 2. httpx — probe all routes, capture status/size baseline per account role
29
+ 3. arjun / x8 — hidden parameter discovery on parameterized routes
30
+ 4. nuclei — api tags, severity critical,high
31
+ 5. jwt_tool — on every bearer token seen: alg confusion, weak secret, kid,
32
+ expiry/replay (feeds API2 checklist)
33
+ 6. Role-diff matrix — replay the SAME route set as each ACCOUNTS.md identity;
34
+ diff statuses/sizes (feeds API1/API5)
35
+
36
+ ## graphql lane (when /graphql or a GraphQL signal appears)
37
+
38
+ 1. graphw00f — fingerprint the engine (Apollo/Graphene/Hasura/...); engine
39
+ identity picks which attacks apply (`graphw00f -t <url>`)
40
+ 2. Introspection probe via curl/httpie (`{"query":"{__schema{...}}"}`) →
41
+ schema map into recon/API.md (types, mutations, sensitive fields) —
42
+ introspection ENABLED is API9 material, not a finding by itself in a
43
+ test env; judge by data exposed
44
+ 3. BOLA via node/global ids — relay `node(id)` queries with cross-account
45
+ base64 ids (API1)
46
+ 4. Batching + alias abuse — 50-op batches against expensive resolvers;
47
+ depth-limited nested queries (API4 — measure, respect intensity)
48
+ 5. Field suggestion mining — mutate toward undisclosed fields (API3/API9)
49
+ 6. Mutations get the same role-diff matrix treatment as REST (API5)
50
+
51
+ ## Rules
52
+
53
+ - Playbook steps cite their output into recon/ or the run log with E-ids —
54
+ a step without stored output "did not happen".
55
+ - Skip a step only with a logged reason (tool absent + no provisioning
56
+ window, target class n/a, intensity ceiling).
57
+ - Playbooks never authorize out-of-scope adjacency targets. SCOPE.md wins.
@@ -0,0 +1,98 @@
1
+ # OTP relay — the human-gated code economy
2
+
3
+ MFA testing consumes one-time codes. Every delivered code is a scarce,
4
+ costed resource: the client pays for the SMS/IVR delivery, the code has a
5
+ short lifetime, and the account locks after a few failures. A wasted code
6
+ is a wasted client notification, a wasted attempt window, and sometimes a
7
+ locked account that blocks the rest of the engagement window. This document
8
+ is the workflow that keeps the cost near zero. See `tools/otp_watch.py`
9
+ for the consumption helper.
10
+
11
+ ## The hard invariant: the relay is NEVER automated
12
+
13
+ PENSIEVE never automates the OTP relay. No PENSIEVE tool ever requests,
14
+ generates, fetches, or reads a code from any delivery channel — SMS, IVR
15
+ (voice call), email, or an authenticator app. Tooling never requests a
16
+ code, never reads a channel, and never fetches anything. Reading those
17
+ channels is outside what an engagement authorizes and outside what tooling
18
+ should do; the operator receives the code with their own eyes, through
19
+ whatever channel the client's testing agreement provides for them.
20
+
21
+ Tooling has exactly ONE role in the relay: CONSUMPTION. `otp_watch.py`
22
+ watches a file; when the operator drops the code they already have into
23
+ that file, the tool types it into the target within 0.5s. The tool sees
24
+ only the file — never a channel, never the network. If a workflow seems to
25
+ need a tool that fetches codes itself, the workflow is wrong: stop and
26
+ re-plan it around the human relay.
27
+
28
+ ## The five workflow rules
29
+
30
+ 1. **Chain ALL steps into one script BEFORE asking for a code.** Write and
31
+ dry-run the complete chain — session setup, login walk to the OTP
32
+ stage, the code submit, and every follow-up step behind it — before any
33
+ code is delivered. A code's lifetime (30–120s typically) is not enough
34
+ time to write code. If you ask for a code first and then start
35
+ scripting, the code expires while you type: that delivery was paid for
36
+ nothing. Chain first; the code is the LAST thing that enters the chain.
37
+
38
+ 2. **One durable session.** Do the walk in a single session whose state
39
+ survives across your tooling steps (persist/pickle the session object,
40
+ the auth-tree state, or the request chain context to disk). Rebuilding
41
+ the session between steps re-triggers earlier stages — and several
42
+ flows DELIVER A NEW CODE on each rebuild, burning deliveries you never
43
+ needed.
44
+
45
+ 3. **Same-opener replay.** Sessions can bind to more than cookies: the
46
+ server may fingerprint the opener — device id, client TLS shape,
47
+ User-Agent, app attestation, the exact request chain that opened the
48
+ session. Replaying the submit from a DIFFERENT opener (another browser,
49
+ a bare curl without the app's headers, a reinstalled app) can look like
50
+ the wrong client and fail — or invalidate the pending code. Replay from
51
+ the same opener that requested the code: same session, same client
52
+ shape, same chain.
53
+
54
+ 4. **Consume each code exactly once.** One code, one submit. Never re-send
55
+ a code that was already accepted or rejected — a replay can burn an
56
+ attempt, trip a fraud rule, or lock the account. `otp_watch.py` enforces
57
+ this mechanically: the consumed code file is renamed
58
+ `<file>.consumed-<timestamp>` the moment it is typed, so the same code
59
+ physically cannot be entered twice.
60
+
61
+ 5. **Never burn a second code on a re-prompt.** If the submit fails or the
62
+ stage re-prompts, STOP. Diagnose with the evidence you already captured
63
+ (response body, stage state) before any new code is delivered. The
64
+ failure is usually a dead session (rule 2), a wrong-opener replay
65
+ (rule 3), a typo'd code, or an expired code — none of which a second
66
+ code fixes, and each of which the diagnosis will reveal. Re-prompting a
67
+ delivery to "try again" is how accounts get locked and clients get
68
+ billed for test noise.
69
+
70
+ ## Pre-verify typed credentials by field LENGTH before submit
71
+
72
+ Before ANY submit that consumes an OTP (or a credential attempt), verify
73
+ what you typed by field LENGTH, not by looking at values: echo
74
+ `len(username)`, `len(password)`, `len(code)` and compare against the
75
+ vault/known lengths. A truncated paste (missing character, swallowed
76
+ leading zero, autofill overwrite) fails silently on the server and burns
77
+ the attempt — sometimes the code with it. Length-checking catches nearly
78
+ every transcription error without ever printing a secret.
79
+
80
+ ## The helper: tools/otp_watch.py
81
+
82
+ Watches the code file every 0.5s; the operator drops the single-line code
83
+ in; it is typed into the target immediately (`adb shell input text` on a
84
+ device target, `xdotool type` on an X window target). Consumes once
85
+ (file renamed on entry), exits. `--help` lists dependencies (adb /
86
+ xdotool, python3 stdlib only) and the operator contract. Probe-and-instruct:
87
+ a missing dependency prints exact setup instructions and exits 3.
88
+
89
+ ## Planning the economy (ACCOUNTS MFA columns)
90
+
91
+ The engagement's ACCOUNTS.md matrix carries, per account: MFA delivery
92
+ channel, code lifetime, and lockout policy. Read them BEFORE planning OTP
93
+ lanes: lifetime bounds how much of the chain must be pre-built (rule 1),
94
+ and lockout policy bounds how many failures the account tolerates across
95
+ the WHOLE engagement — count every consumed code and every failed submit
96
+ against it. The per-account MFA runbook (V2-AUTH-MFA in web/asvs-l2)
97
+ walks every account row; the columns are how the planner budgets codes
98
+ per lane.