pwn 0.5.783 → 0.5.785

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 (264) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/Gemfile +8 -8
  4. data/README.md +37 -0
  5. data/Rakefile +19 -1
  6. data/bin/pwn +2 -1
  7. data/bin/pwn_setup +1 -1
  8. data/bin/pwn_web_cache_deception +35 -7
  9. data/build_gem.sh +1 -1
  10. data/documentation/AI-Integration.md +7 -5
  11. data/documentation/Agent-Tool-Registry.md +2 -2
  12. data/documentation/Backup-Retention.md +82 -0
  13. data/documentation/Configuration.md +10 -6
  14. data/documentation/Contributing.md +1 -1
  15. data/documentation/Cron.md +64 -35
  16. data/documentation/Diagrams.md +2 -2
  17. data/documentation/General-PWN-Usage.md +4 -3
  18. data/documentation/Home.md +6 -5
  19. data/documentation/How-PWN-Works.md +7 -6
  20. data/documentation/Installation.md +254 -10
  21. data/documentation/Mission-Cancellation.md +134 -0
  22. data/documentation/Operability.md +17 -0
  23. data/documentation/Persistence.md +8 -6
  24. data/documentation/Plugin-Degradation.md +12 -0
  25. data/documentation/Plugins.md +3 -2
  26. data/documentation/Reinforcement-Learning.md +5 -6
  27. data/documentation/Runtime-Source-Protection.md +162 -0
  28. data/documentation/Transparent-Browser.md +11 -0
  29. data/documentation/Troubleshooting.md +3 -2
  30. data/documentation/What-is-PWN.md +2 -2
  31. data/documentation/YubiKey-Vaults.md +183 -0
  32. data/documentation/YubiKey.md +339 -0
  33. data/documentation/diagrams/cron-scheduling.svg +130 -128
  34. data/documentation/diagrams/dot/cron-scheduling.dot +5 -5
  35. data/documentation/diagrams/dot/persistence-filesystem.dot +5 -3
  36. data/documentation/diagrams/dot/plugin-ecosystem.dot +2 -2
  37. data/documentation/diagrams/persistence-filesystem.svg +172 -142
  38. data/documentation/diagrams/plugin-ecosystem.svg +64 -64
  39. data/documentation/pwn-ai-Agent.md +10 -4
  40. data/etc/default_cron/session_cleanup.rb +1245 -22
  41. data/etc/default_skills/pwn/ai/agent/mission_namespace/SKILL.md +21 -0
  42. data/etc/default_skills/pwn/ai/agent/tools/browser_act/SKILL.md +45 -0
  43. data/etc/default_skills/pwn/ai/agent/tools/loot_query/SKILL.md +27 -26
  44. data/etc/default_skills/pwn/ai/agent/tools/recon_run/SKILL.md +25 -15
  45. data/etc/default_skills/pwn/ai/agent/tools/workspace_tool/SKILL.md +24 -0
  46. data/etc/default_skills/pwn/ai/server_tools/SKILL.md +25 -0
  47. data/etc/default_skills/pwn/backups/SKILL.md +54 -0
  48. data/etc/default_skills/pwn/plugins/recon/SKILL.md +12 -1
  49. data/etc/default_skills/pwn/plugins/yubikey/SKILL.md +157 -0
  50. data/etc/default_skills/pwn/plugins/yubikey/fido/SKILL.md +189 -0
  51. data/etc/default_skills/pwn/plugins/yubikey/hsmauth/SKILL.md +83 -0
  52. data/etc/default_skills/pwn/plugins/yubikey/management/SKILL.md +80 -0
  53. data/etc/default_skills/pwn/plugins/yubikey/oath/SKILL.md +115 -0
  54. data/etc/default_skills/pwn/plugins/yubikey/openpgp/SKILL.md +144 -0
  55. data/etc/default_skills/pwn/plugins/yubikey/otp/SKILL.md +97 -0
  56. data/etc/default_skills/pwn/plugins/yubikey/piv/SKILL.md +110 -0
  57. data/etc/default_skills/pwn/plugins/yubikey/protocol/SKILL.md +21 -0
  58. data/etc/default_skills/pwn/plugins/yubikey/security_domain/SKILL.md +75 -0
  59. data/etc/default_skills/pwn/plugins/yubikey/security_domain/scp/SKILL.md +46 -0
  60. data/etc/default_skills/pwn/plugins/yubikey/transport/SKILL.md +98 -0
  61. data/etc/default_skills/pwn/redaction/SKILL.md +13 -1
  62. data/lib/pwn/ai/agent/dispatch.rb +26 -15
  63. data/lib/pwn/ai/agent/extrospection.rb +6 -7
  64. data/lib/pwn/ai/agent/learning.rb +62 -25
  65. data/lib/pwn/ai/agent/loop.rb +17 -1
  66. data/lib/pwn/ai/agent/mission_namespace.rb +331 -0
  67. data/lib/pwn/ai/agent/policy.rb +5 -0
  68. data/lib/pwn/ai/agent/policy_evaluation.rb +8 -8
  69. data/lib/pwn/ai/agent/prompt_builder.rb +13 -2
  70. data/lib/pwn/ai/agent/request_runtime.rb +122 -18
  71. data/lib/pwn/ai/agent/reward.rb +5 -3
  72. data/lib/pwn/ai/agent/skill_consolidation.rb +3 -2
  73. data/lib/pwn/ai/agent/skill_review.rb +9 -5
  74. data/lib/pwn/ai/agent/swarm.rb +35 -16
  75. data/lib/pwn/ai/agent/tools/browser_act.rb +32 -0
  76. data/lib/pwn/ai/agent/tools/loot_query.rb +11 -1
  77. data/lib/pwn/ai/agent/tools/recon_run.rb +11 -1
  78. data/lib/pwn/ai/agent/tools/workspace_tool.rb +29 -0
  79. data/lib/pwn/ai/agent/turn_finalizer.rb +6 -2
  80. data/lib/pwn/ai/agent.rb +1 -0
  81. data/lib/pwn/ai/anthropic.rb +8 -33
  82. data/lib/pwn/ai/cli.rb +34 -5
  83. data/lib/pwn/ai/gemini.rb +1 -0
  84. data/lib/pwn/ai/grok.rb +39 -28
  85. data/lib/pwn/ai/ollama.rb +4 -2
  86. data/lib/pwn/ai/open_ai.rb +11 -32
  87. data/lib/pwn/ai/open_web_ui.rb +62 -4
  88. data/lib/pwn/ai/router.rb +53 -3
  89. data/lib/pwn/ai/server_tools.rb +231 -0
  90. data/lib/pwn/ai.rb +1 -0
  91. data/lib/pwn/backups.rb +347 -0
  92. data/lib/pwn/config.rb +70 -39
  93. data/lib/pwn/cron.rb +120 -49
  94. data/lib/pwn/migrate.rb +150 -68
  95. data/lib/pwn/module_skills.rb +7 -0
  96. data/lib/pwn/plugins/ai_sandbox.rb +538 -1
  97. data/lib/pwn/plugins/authentication_helper.rb +74 -4
  98. data/lib/pwn/plugins/basic_auth.rb +2 -1
  99. data/lib/pwn/plugins/binary_parser.rb +5 -4
  100. data/lib/pwn/plugins/ghidra.rb +4 -3
  101. data/lib/pwn/plugins/google_workspace.rb +4 -21
  102. data/lib/pwn/plugins/jobs.rb +1 -1
  103. data/lib/pwn/plugins/log.rb +21 -3
  104. data/lib/pwn/plugins/preflight_checker.rb +34 -9
  105. data/lib/pwn/plugins/recon.rb +4 -1
  106. data/lib/pwn/plugins/repl/ai.rb +305 -27
  107. data/lib/pwn/plugins/repl/ai_console.rb +273 -89
  108. data/lib/pwn/plugins/repl/ai_swarm.rb +181 -62
  109. data/lib/pwn/plugins/repl/mesh.rb +3 -16
  110. data/lib/pwn/plugins/repl/vault.rb +4 -15
  111. data/lib/pwn/plugins/repl.rb +1 -216
  112. data/lib/pwn/plugins/sandbox/driver.rb +4 -0
  113. data/lib/pwn/plugins/transparent_browser.rb +215 -0
  114. data/lib/pwn/plugins/vault.rb +412 -135
  115. data/lib/pwn/plugins/yubikey/fido.rb +1288 -0
  116. data/lib/pwn/plugins/yubikey/hsmauth.rb +439 -0
  117. data/lib/pwn/plugins/yubikey/management.rb +686 -0
  118. data/lib/pwn/plugins/yubikey/oath.rb +766 -0
  119. data/lib/pwn/plugins/yubikey/openpgp.rb +1063 -0
  120. data/lib/pwn/plugins/yubikey/otp.rb +897 -0
  121. data/lib/pwn/plugins/yubikey/piv.rb +1315 -0
  122. data/lib/pwn/plugins/yubikey/protocol.rb +341 -0
  123. data/lib/pwn/plugins/yubikey/security_domain/scp.rb +482 -0
  124. data/lib/pwn/plugins/yubikey/security_domain.rb +464 -0
  125. data/lib/pwn/plugins/yubikey/transport.rb +1017 -0
  126. data/lib/pwn/plugins/yubikey.rb +844 -0
  127. data/lib/pwn/plugins.rb +1 -0
  128. data/lib/pwn/redaction.rb +69 -12
  129. data/lib/pwn/session_trace.rb +4 -0
  130. data/lib/pwn/sessions.rb +58 -16
  131. data/lib/pwn/setup.rb +123 -41
  132. data/lib/pwn/version.rb +1 -1
  133. data/lib/pwn/www/app_cobalt_io.rb +16 -5
  134. data/lib/pwn/www/bug_crowd.rb +16 -5
  135. data/lib/pwn/www/coinbase_pro.rb +16 -5
  136. data/lib/pwn/www/github.rb +30 -14
  137. data/lib/pwn/www/paypal.rb +15 -4
  138. data/lib/pwn/www/synack.rb +16 -5
  139. data/lib/pwn/www/twitter.rb +17 -6
  140. data/lib/pwn.rb +1 -0
  141. data/scripts/build_gate.rb +58 -0
  142. data/spec/documentation/installation_md_spec.rb +1 -1
  143. data/spec/fixtures/yubikey/apdu_frames.json +162 -0
  144. data/spec/integration/authentication_helper_oath_spec.rb +117 -0
  145. data/spec/integration/build_gate_spec.rb +73 -0
  146. data/spec/integration/controller_spill_spec.rb +48 -0
  147. data/spec/integration/harness_process_spec.rb +97 -0
  148. data/spec/integration/mission_cancel_spec.rb +79 -0
  149. data/spec/integration/mission_curses_pty_spec.rb +44 -0
  150. data/spec/integration/persistence_roundtrip_spec.rb +1 -7
  151. data/spec/integration/readme_security_spec.rb +47 -0
  152. data/spec/integration/web_cache_deception_yubikey_spec.rb +159 -0
  153. data/spec/lib/pwn/ai/agent/dispatch_spec.rb +6 -3
  154. data/spec/lib/pwn/ai/agent/dispatch_vault_safety_spec.rb +86 -0
  155. data/spec/lib/pwn/ai/agent/injection_guard_spec.rb +2 -0
  156. data/spec/lib/pwn/ai/agent/learning_spec.rb +4 -4
  157. data/spec/lib/pwn/ai/agent/loop_artifacts_spec.rb +5 -0
  158. data/spec/lib/pwn/ai/agent/loop_spec.rb +104 -29
  159. data/spec/lib/pwn/ai/agent/mission_namespace_spec.rb +138 -0
  160. data/spec/lib/pwn/ai/agent/policy_spec.rb +27 -0
  161. data/spec/lib/pwn/ai/agent/request_runtime_spec.rb +48 -0
  162. data/spec/lib/pwn/ai/agent/shell_search_effect_spec.rb +44 -0
  163. data/spec/lib/pwn/ai/agent/solve_spec.rb +6 -4
  164. data/spec/lib/pwn/ai/agent/tools/browser_act_spec.rb +44 -0
  165. data/spec/lib/pwn/ai/agent/tools/loot_query_yubikey_spec.rb +55 -0
  166. data/spec/lib/pwn/ai/agent/tools/recon_run_yubikey_spec.rb +43 -0
  167. data/spec/lib/pwn/ai/agent/tools/workspace_tool_spec.rb +20 -0
  168. data/spec/lib/pwn/ai/agent/turn_finalizer_spec.rb +7 -0
  169. data/spec/lib/pwn/ai/anthropic_vault_enrollment_spec.rb +37 -0
  170. data/spec/lib/pwn/ai/cli_spec.rb +6 -9
  171. data/spec/lib/pwn/ai/oauth_vault_persistence_spec.rb +195 -0
  172. data/spec/lib/pwn/ai/open_ai_spec.rb +2 -2
  173. data/spec/lib/pwn/ai/open_web_ui_workspace_spec.rb +36 -0
  174. data/spec/lib/pwn/ai/router_spec.rb +31 -3
  175. data/spec/lib/pwn/ai/server_tools_spec.rb +39 -0
  176. data/spec/lib/pwn/backups_spec.rb +114 -0
  177. data/spec/lib/pwn/config_redaction_yubikey_spec.rb +28 -0
  178. data/spec/lib/pwn/config_yubikey_spec.rb +92 -0
  179. data/spec/lib/pwn/cron_spec.rb +113 -6
  180. data/spec/lib/pwn/migrate_spec.rb +108 -5
  181. data/spec/lib/pwn/migrate_yubikey_spec.rb +128 -0
  182. data/spec/lib/pwn/module_skills_spec.rb +8 -0
  183. data/spec/lib/pwn/plugins/ai_sandbox_spec.rb +230 -0
  184. data/spec/lib/pwn/plugins/authentication_helper_native_yubikey_spec.rb +40 -0
  185. data/spec/lib/pwn/plugins/authentication_helper_yubikey_spec.rb +90 -0
  186. data/spec/lib/pwn/plugins/capability_broker/daemon_spec.rb +1 -1
  187. data/spec/lib/pwn/plugins/google_workspace_spec.rb +17 -35
  188. data/spec/lib/pwn/plugins/log_spec.rb +7 -0
  189. data/spec/lib/pwn/plugins/log_yubikey_spec.rb +47 -0
  190. data/spec/lib/pwn/plugins/preflight_checker_native_yubikey_spec.rb +19 -0
  191. data/spec/lib/pwn/plugins/preflight_checker_yubikey_spec.rb +55 -0
  192. data/spec/lib/pwn/plugins/recon_yubikey_spec.rb +43 -0
  193. data/spec/lib/pwn/plugins/repl/ai_console_spec.rb +125 -78
  194. data/spec/lib/pwn/plugins/repl/ai_legacy_containment_spec.rb +200 -0
  195. data/spec/lib/pwn/plugins/repl/ai_swarm_spec.rb +30 -16
  196. data/spec/lib/pwn/plugins/repl/ai_vault_edit_yubikey_spec.rb +103 -0
  197. data/spec/lib/pwn/plugins/repl/ai_yubikey_spec.rb +48 -0
  198. data/spec/lib/pwn/plugins/repl/mesh_vault_persistence_spec.rb +149 -0
  199. data/spec/lib/pwn/plugins/repl/vault_yaml_serialization_spec.rb +11 -0
  200. data/spec/lib/pwn/plugins/repl/vault_yubikey_spec.rb +39 -0
  201. data/spec/lib/pwn/plugins/repl_spec.rb +56 -5
  202. data/spec/lib/pwn/plugins/transparent_browser_jev_spec.rb +46 -0
  203. data/spec/lib/pwn/plugins/vault_native_yubikey_spec.rb +29 -0
  204. data/spec/lib/pwn/plugins/vault_publication_safety_spec.rb +258 -0
  205. data/spec/lib/pwn/plugins/vault_store_safety_spec.rb +241 -0
  206. data/spec/lib/pwn/plugins/vault_yubikey_safety_spec.rb +168 -0
  207. data/spec/lib/pwn/plugins/vault_yubikey_spec.rb +128 -0
  208. data/spec/lib/pwn/plugins/vault_yubikey_vector_spec.rb +45 -0
  209. data/spec/lib/pwn/plugins/yubikey/fido_spec.rb +854 -0
  210. data/spec/lib/pwn/plugins/yubikey/hsmauth_spec.rb +235 -0
  211. data/spec/lib/pwn/plugins/yubikey/management_spec.rb +277 -0
  212. data/spec/lib/pwn/plugins/yubikey/oath_spec.rb +349 -0
  213. data/spec/lib/pwn/plugins/yubikey/openpgp_spec.rb +810 -0
  214. data/spec/lib/pwn/plugins/yubikey/otp_spec.rb +337 -0
  215. data/spec/lib/pwn/plugins/yubikey/piv_spec.rb +646 -0
  216. data/spec/lib/pwn/plugins/yubikey/protocol_secure_spec.rb +28 -0
  217. data/spec/lib/pwn/plugins/yubikey/protocol_spec.rb +149 -0
  218. data/spec/lib/pwn/plugins/yubikey/protocol_vectors_spec.rb +18 -0
  219. data/spec/lib/pwn/plugins/yubikey/security_domain/scp_spec.rb +256 -0
  220. data/spec/lib/pwn/plugins/yubikey/security_domain/support.rb +153 -0
  221. data/spec/lib/pwn/plugins/yubikey/security_domain_spec.rb +296 -0
  222. data/spec/lib/pwn/plugins/yubikey/transport_spec.rb +760 -0
  223. data/spec/lib/pwn/plugins/yubikey_security_spec.rb +260 -0
  224. data/spec/lib/pwn/plugins/yubikey_spec.rb +209 -0
  225. data/spec/lib/pwn/plugins/yubikey_terminal_spec.rb +147 -0
  226. data/spec/lib/pwn/redaction_spec.rb +13 -10
  227. data/spec/lib/pwn/redaction_yubikey_spec.rb +61 -0
  228. data/spec/lib/pwn/session_cleanup_concurrency_spec.rb +201 -0
  229. data/spec/lib/pwn/session_cleanup_default_spec.rb +167 -2
  230. data/spec/lib/pwn/session_cleanup_legacy_spec.rb +101 -0
  231. data/spec/lib/pwn/session_cleanup_payload_spec.rb +335 -2
  232. data/spec/lib/pwn/session_cleanup_recovery_spec.rb +403 -0
  233. data/spec/lib/pwn/sessions_spec.rb +112 -0
  234. data/spec/lib/pwn/setup_native_yubikey_spec.rb +66 -0
  235. data/spec/lib/pwn/setup_spec.rb +3 -1
  236. data/spec/lib/pwn/setup_vault_yubikey_spec.rb +61 -0
  237. data/spec/lib/pwn/setup_yubikey_spec.rb +40 -0
  238. data/spec/lib/pwn/www/login_yubikey_spec.rb +273 -0
  239. data/spec/spec_helper.rb +15 -0
  240. data/spec/support/gate_failure_formatter.rb +14 -0
  241. data/spec/support/harness/cli_faults.rb +13 -9
  242. data/spec/support/harness/controller_spill.rb +26 -0
  243. data/spec/support/harness/controller_state.rb +54 -0
  244. data/spec/support/harness/evaluate.rb +12 -1
  245. data/spec/support/harness/experiments.rb +1 -1
  246. data/spec/support/harness/fake_provider.rb +22 -6
  247. data/spec/support/harness/fault_preload.rb +3 -1
  248. data/spec/support/harness/mission_console.rb +54 -0
  249. data/spec/support/harness/mission_curses_pty.rb +41 -0
  250. data/spec/support/harness/mission_dispatch.rb +30 -0
  251. data/spec/support/harness/mission_fixture_preload.rb +24 -0
  252. data/spec/support/harness/mission_job_lifetime.rb +25 -0
  253. data/spec/support/harness/mission_legacy.rb +25 -0
  254. data/spec/support/harness/mission_normal_exit.rb +34 -0
  255. data/spec/support/harness/mission_swarm.rb +23 -0
  256. data/spec/support/harness/mission_unsupported.rb +29 -0
  257. data/spec/support/harness/package_acceptance.rb +33 -5
  258. data/spec/support/harness/session_acceptance.rb +4 -4
  259. data/spec/support/harness/swarm_acceptance.rb +1 -1
  260. data/spec/support/harness/swarm_control.rb +44 -0
  261. data/spec/support/mission_namespace.rb +14 -0
  262. data/spec/support/mission_pipe_queue.rb +33 -0
  263. data/third_party/pwn_rdoc.jsonl +599 -15
  264. metadata +140 -17
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: pwn-ai-agent-mission-namespace
3
+ description: Compiler-free Linux mission process ownership.
4
+ preserve: true
5
+ metadata:
6
+ bundled: true
7
+ module: PWN::AI::Agent::MissionNamespace
8
+ source: pwn/ai/agent/mission_namespace.rb
9
+ ---
10
+
11
+ # PWN::AI::Agent::MissionNamespace
12
+
13
+ Launch typed mission descriptors using util-linux `unshare`, Ruby stdlib
14
+ Fiddle pidfds, and private inherited sockets. Install `pwn setup --profile ai`.
15
+ Linux user/PID namespaces and pidfds must be enabled. Unsupported hosts fail
16
+ closed; there is no process-group or uncontained fallback.
17
+
18
+ The controller remains outside namespaces. Each request transfers its private
19
+ configuration snapshot in memory, then owns a PID namespace. Cancellation kills
20
+ namespace PID 1 and waits for the supervisor to reap it. Arbitrary Ruby closures
21
+ are only supported inside an already-owned mission for protected tool workers.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: pwn-ai-agent-tools-browseract
3
+ description: Drive PWN::Ai::Agent::Tools::BrowserAct from pwn_eval.
4
+ license: MIT
5
+ allowed-tools: [pwn, pwn_eval]
6
+ metadata:
7
+ bundled: true
8
+ generated: true
9
+ module: PWN::Ai::Agent::Tools::BrowserAct
10
+ source: pwn/ai/agent/tools/browser_act.rb
11
+ ---
12
+
13
+ # PWN::Ai::Agent::Tools::BrowserAct
14
+
15
+ Public API for PWN::Ai::Agent::Tools::BrowserAct.
16
+
17
+ ## When to use
18
+
19
+ Call `PWN::Ai::Agent::Tools::BrowserAct` from `pwn_eval` when the task needs this module.
20
+ Do not reimplement it in shell.
21
+
22
+ ## Methodologies
23
+
24
+ Generated from `pwn/ai/agent/tools/browser_act.rb`. Prefer the public class methods below.
25
+ Class methods take `(opts = {})` and read `opts`.
26
+
27
+ ## How to call
28
+
29
+ ```ruby
30
+ PWN::Ai::Agent::Tools::BrowserAct.help
31
+ PWN::Ai::Agent::Tools::BrowserAct.help(opts)
32
+ ```
33
+
34
+ ## Public methods
35
+
36
+ - _(no public class methods parsed)_
37
+
38
+ ## Source
39
+
40
+ `pwn/ai/agent/tools/browser_act.rb`
41
+
42
+ ## Verification
43
+
44
+ `PWN::Ai::Agent::Tools::BrowserAct.respond_to?(:help)` after the
45
+ module is loaded. Read the source for parameter names.
@@ -1,45 +1,46 @@
1
1
  ---
2
2
  name: pwn-ai-agent-tools-lootquery
3
- description: Drive PWN::Ai::Agent::Tools::LootQuery from pwn_eval.
3
+ description: Query and capture encrypted engagement loot.
4
4
  license: MIT
5
5
  allowed-tools: [pwn, pwn_eval]
6
6
  metadata:
7
7
  bundled: true
8
- generated: true
9
- module: PWN::Ai::Agent::Tools::LootQuery
8
+ generated: false
10
9
  source: pwn/ai/agent/tools/loot_query.rb
11
10
  ---
12
11
 
13
- # PWN::Ai::Agent::Tools::LootQuery
12
+ # loot_query
14
13
 
15
- Public API for PWN::Ai::Agent::Tools::LootQuery.
16
-
17
- ## When to use
18
-
19
- Call `PWN::Ai::Agent::Tools::LootQuery` from `pwn_eval` when the task needs this module.
20
- Do not reimplement it in shell.
21
-
22
- ## Methodologies
23
-
24
- Generated from `pwn/ai/agent/tools/loot_query.rb`. Prefer the public class methods below.
25
- Class methods take `(opts = {})` and read `opts`.
14
+ Use the registered `loot_query` tool to query, store, ingest, or offer engagement
15
+ loot. This file registers a tool; it does not define a `Tools::LootQuery` module.
26
16
 
27
17
  ## How to call
28
18
 
29
- ```ruby
30
- PWN::Ai::Agent::Tools::LootQuery.help
31
- PWN::Ai::Agent::Tools::LootQuery.help(opts)
32
- ```
33
-
34
- ## Public methods
19
+ Select `op: query` (the default) with `engagement`, `host`, `service`, `kind`, or
20
+ `finding_id` filters to obtain metadata without plaintext credentials. The Vault
21
+ query handler does not decrypt or open a device. Dispatch's separate output
22
+ redaction can require access to stored hardware secrets.
35
23
 
36
- - _(no public class methods parsed)_
24
+ For `store` or `ingest`, pass `yubikey: {slot: 2, serial: "12345678", timeout: 30}`
25
+ only when hardware protection is intended. The slot must already be provisioned
26
+ for HMAC-SHA1. An empty selector chooses hardware defaults. The model-facing
27
+ schema allows only `slot`, `serial`, and `timeout`; never put a PIN, PUK, key,
28
+ password, or executable path in the selector. `offer` can use the same selector
29
+ when decrypting matching hardware loot.
37
30
 
38
- ## Source
31
+ ## Pitfalls
39
32
 
40
- `pwn/ai/agent/tools/loot_query.rb`
33
+ - Missing hardware or failed touch raises; do not retry with software protection.
34
+ - Replacing an existing hardware label without a selector retains that backend.
35
+ - Treat `offer` results as secrets. Dispatch redacts array results before returning
36
+ them; direct Ruby callers must not print or persist plaintext credentials.
37
+ - `VAULT_EXPANSION_FAILED` means Dispatch did not execute the handler.
38
+ `VAULT_REDACTION_FAILED` with `handler_executed: true` means it already ran;
39
+ reconcile effects before retrying.
41
40
 
42
41
  ## Verification
43
42
 
44
- `PWN::Ai::Agent::Tools::LootQuery.respond_to?(:help)` after the
45
- module is loaded. Read the source for parameter names.
43
+ Use `PWN::AI::Agent::Registry.lookup(name: 'loot_query')` to inspect its schema
44
+ and handler after discovery. Offline tests stub only the device HMAC boundary,
45
+ use an isolated home, verify encrypted loot has no disk master key, and reject
46
+ selector executable overrides through Dispatch before any vault access.
@@ -1,39 +1,48 @@
1
1
  ---
2
2
  name: pwn-ai-agent-tools-reconrun
3
- description: Drive PWN::Ai::Agent::Tools::ReconRun from pwn_eval.
3
+ description: Run recon pipelines with optional hardware-protected loot.
4
4
  license: MIT
5
5
  allowed-tools: [pwn, pwn_eval]
6
6
  metadata:
7
7
  bundled: true
8
- generated: true
8
+ preserve: true
9
9
  module: PWN::Ai::Agent::Tools::ReconRun
10
10
  source: pwn/ai/agent/tools/recon_run.rb
11
11
  ---
12
12
 
13
- # PWN::Ai::Agent::Tools::ReconRun
13
+ # recon_run registry tool
14
14
 
15
- Public API for PWN::Ai::Agent::Tools::ReconRun.
15
+ Use the registered `recon_run` tool or `PWN::Plugins::Recon.run`; this file
16
+ registers a tool, not a Ruby class named `PWN::Ai::Agent::Tools::ReconRun`.
16
17
 
17
18
  ## When to use
18
19
 
19
- Call `PWN::Ai::Agent::Tools::ReconRun` from `pwn_eval` when the task needs this module.
20
- Do not reimplement it in shell.
20
+ Run selected recon modules against a single authorized target and persist their
21
+ asset/evidence model. Scanner observations are not proven findings.
21
22
 
22
23
  ## Methodologies
23
24
 
24
- Generated from `pwn/ai/agent/tools/recon_run.rb`. Prefer the public class methods below.
25
- Class methods take `(opts = {})` and read `opts`.
25
+ Supply `target` and a nonempty `modules` array from `nmap`, `banner`, `tls`,
26
+ `subfinder`, `nuclei`. Optional `ports`, `engagement_id`, positive `timeout` up to
27
+ 300 seconds and `ingest` control the pipeline; tool ingestion defaults to true.
26
28
 
27
29
  ## How to call
28
30
 
29
- ```ruby
30
- PWN::Ai::Agent::Tools::ReconRun.help
31
- PWN::Ai::Agent::Tools::ReconRun.help(opts)
31
+ ```json
32
+ {"target":"app.example.test","modules":["banner"],"ports":[443],"ingest":false,"yubikey":{"slot":2}}
32
33
  ```
33
34
 
34
- ## Public methods
35
+ ## Hardware protection
35
36
 
36
- - _(no public class methods parsed)_
37
+ The optional `yubikey` selector accepts only integer `slot` 1/2, decimal String
38
+ `serial`, and positive `timeout` seconds. An empty object chooses hardware
39
+ defaults. It forwards into Vault ingestion without provisioning or software
40
+ fallback. Device access errors remain failures. PINs, seeds, arbitrary executable
41
+ paths and secret selector fields are forbidden by the tool schema.
42
+
43
+ Only harvested loot is hardware encrypted. Raw scanner evidence and the asset
44
+ model remain ordinary files; protect those separately. Do not claim a completed
45
+ scan when harvesting failed, or replay an expensive scan blindly after device loss.
37
46
 
38
47
  ## Source
39
48
 
@@ -41,5 +50,6 @@ PWN::Ai::Agent::Tools::ReconRun.help(opts)
41
50
 
42
51
  ## Verification
43
52
 
44
- `PWN::Ai::Agent::Tools::ReconRun.respond_to?(:help)` after the
45
- module is loaded. Read the source for parameter names.
53
+ Run `spec/lib/pwn/ai/agent/tools/recon_run_spec.rb` and
54
+ `spec/lib/pwn/ai/agent/tools/recon_run_yubikey_spec.rb`. The latter exercises the
55
+ real handler/Recon/Vault path with fake socket/device boundaries and no live scan.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: pwn-ai-agent-tools-workspacetool
3
+ description: Drive PWN::Ai::Agent::Tools::WorkspaceTool from pwn_eval.
4
+ license: MIT
5
+ allowed-tools: [pwn, pwn_eval]
6
+ metadata:
7
+ bundled: true
8
+ generated: true
9
+ module: PWN::Ai::Agent::Tools::WorkspaceTool
10
+ source: pwn/ai/agent/tools/workspace_tool.rb
11
+ ---
12
+
13
+ # PWN::Ai::Agent::Tools::WorkspaceTool
14
+
15
+ Public API for PWN::Ai::Agent::Tools::WorkspaceTool.
16
+
17
+ ## When to use
18
+
19
+ Call `workspace_tool` when the task needs a provider-hosted tool. Ask Jev is
20
+ an Open WebUI workspace tool. Do not reimplement it in shell.
21
+
22
+ ## Source
23
+
24
+ `pwn/ai/agent/tools/workspace_tool.rb`
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: pwn-ai-servertools
3
+ description: Use provider-hosted tools without replacing Registry client tools.
4
+ license: MIT
5
+ allowed-tools: [pwn, pwn_eval]
6
+ metadata:
7
+ bundled: true
8
+ generated: true
9
+ module: PWN::AI::ServerTools
10
+ source: pwn/ai/server_tools.rb
11
+ ---
12
+
13
+ # PWN::AI::ServerTools
14
+
15
+ Open WebUI is the only engine with a user-installed tool workspace. Ask Jev
16
+ runs there through `workspace_tool` or `chat(server_tools:)`. Do not send a
17
+ client `tools` array on that same Open WebUI request.
18
+
19
+ Anthropic, Gemini, and OpenAI Responses can carry their fixed hosted tools
20
+ beside Registry tools. xAI hosted tools use the Responses API, not
21
+ chat/completions. Ollama has no server-side tool workspace.
22
+
23
+ ## Source
24
+
25
+ `pwn/ai/server_tools.rb`
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: pwn-backups
3
+ description: Drive PWN::Backups from pwn_eval.
4
+ license: MIT
5
+ allowed-tools: [pwn, pwn_eval]
6
+ metadata:
7
+ bundled: true
8
+ generated: true
9
+ module: PWN::Backups
10
+ source: pwn/backups.rb
11
+ ---
12
+
13
+ # PWN::Backups
14
+
15
+ All first-party recovery copies share one serialized seven-generation store. Evidence artifacts are not recovery copies and must not enter this store.
16
+
17
+ ## When to use
18
+
19
+ Call `PWN::Backups` from `pwn_eval` when the task needs this module.
20
+ Do not reimplement it in shell.
21
+
22
+ ## Methodologies
23
+
24
+ Generated from `pwn/backups.rb`. Prefer the public class methods below.
25
+ Class methods take `(opts = {})` and read `opts`.
26
+
27
+ ## How to call
28
+
29
+ ```ruby
30
+ PWN::Backups.help
31
+ PWN::Backups.active(opts)
32
+ ```
33
+
34
+ ## Public methods
35
+
36
+ - `active`
37
+ - `transaction`
38
+ - `directory`
39
+ - `capture`
40
+ - `configure`
41
+ - `reconcile`
42
+ - `relocate_legacy`
43
+ - `authors`
44
+ - `help`
45
+ - `active?`
46
+
47
+ ## Source
48
+
49
+ `pwn/backups.rb`
50
+
51
+ ## Verification
52
+
53
+ `PWN::Backups.respond_to?(:active)` after the
54
+ module is loaded. Read the source for parameter names.
@@ -6,6 +6,7 @@ allowed-tools: [pwn, pwn_eval]
6
6
  metadata:
7
7
  bundled: true
8
8
  generated: true
9
+ preserve: true
9
10
  module: PWN::Plugins::Recon
10
11
  source: pwn/plugins/recon.rb
11
12
  ---
@@ -26,9 +27,19 @@ Class methods take `(opts = {})` and read `opts`.
26
27
 
27
28
  ## How to call
28
29
 
30
+ Pass an explicit `yubikey: {slot: 2, serial: '12345678', timeout: 30}` to `run`
31
+ or `harvest_loot` to encrypt harvested credentials with an already provisioned
32
+ HMAC-SHA1 OTP slot. Both entry points preserve the selector through Vault.ingest.
33
+ Device failure raises without falling back to a software master key. Raw scan
34
+ evidence remains governed by the existing recon persistence contract; selecting
35
+ hardware loot protection does not encrypt the entire asset/evidence directory.
36
+
37
+ Verify offline with a fake banner and a stubbed 20-byte challenge-response; assert
38
+ the saved loot envelope has the hardware KDF and no `.pwn-vault.key` is created.
39
+
29
40
  ```ruby
30
41
  PWN::Plugins::Recon.help
31
- PWN::Plugins::Recon.required_bins(opts)
42
+ PWN::Plugins::Recon.required_bins
32
43
  ```
33
44
 
34
45
  ## Public methods
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: pwn-plugins-yubikey
3
+ description: Manage YubiKeys with explicit mutation guards.
4
+ license: MIT
5
+ allowed-tools: [pwn, pwn_eval]
6
+ metadata:
7
+ bundled: true
8
+ preserve: true
9
+ module: PWN::Plugins::YubiKey
10
+ source: pwn/plugins/yubikey.rb
11
+ ---
12
+
13
+ # PWN::Plugins::YubiKey
14
+
15
+ Use the native Ruby wrapper around the official `ykman` executable. Never
16
+ provision, overwrite, repair or reset a slot as part of routine inventory,
17
+ authentication or vault access. See `documentation/YubiKey.md` for the device
18
+ contract and `documentation/YubiKey-Vaults.md` for storage/recovery integration.
19
+
20
+ ## When to use
21
+
22
+ - Inventory and application status, or explicit YubiKey management requests.
23
+ - Binary HMAC-SHA1 challenge-response from an **already provisioned** OTP slot.
24
+ - OATH account listing and retrieval with consent for authentication, remembered-key
25
+ cleanup, counter and credential-repair effects.
26
+ - Do not use device management as a substitute for browser WebAuthn ceremonies.
27
+
28
+ ## Prerequisites
29
+
30
+ Install the official `yubikey-manager` separately. `required_bins` returns
31
+ `['ykman']`; `available?` probes `--version` without opening a device. Use a trusted
32
+ explicit `ykman:` path when PATH selection is unsuitable. The reviewed management
33
+ grammar is 5.9.1; automatic provisioning intentionally accepts only that version.
34
+ Use decimal String serials, integer slots 1 or 2, and a finite positive timeout.
35
+
36
+ ## How to call
37
+
38
+ ```ruby
39
+ PWN::Plugins::YubiKey.help
40
+ PWN::Plugins::YubiKey.available?
41
+ PWN::Plugins::YubiKey.devices
42
+ PWN::Plugins::YubiKey.info(serial: '12345678')
43
+ PWN::Plugins::YubiKey.otp(args: ['info'], serial: '12345678')
44
+ PWN::Plugins::YubiKey.cli_help(path: %w[piv keys generate])
45
+ ```
46
+
47
+ Serials above are placeholders. Family methods take an `args:` argv Array after
48
+ the family name; omission returns official help. Use long options as separate
49
+ array elements, not a shell string or `--option=value`. `command` takes the full
50
+ management argv. All return raw output without logging it; successful output can
51
+ still contain secrets and must not be echoed into a transcript.
52
+
53
+ ## Public methods
54
+
55
+ - `required_bins`, `available?`, `devices`, `info`, `cli_help`, `help`, `authors`
56
+ - `command`, `interact`, `config`, `otp`, `oath`, `fido`, `piv`, `openpgp`, `hsmauth`,
57
+ `security_domain` (official **sd** family), `apdu`
58
+ - `challenge_response`, `provision_challenge_response`, `oath_code`
59
+
60
+ ## Procedure
61
+
62
+ 1. Identify the intended device and application with read-only inventory. Pin a
63
+ serial when selecting a device; never choose the first key automatically.
64
+ 2. Read the specific command's help. The wrapper guards the complete reviewed
65
+ management tree, but model/firmware/interface support still belongs to ykman.
66
+ 3. Obtain explicit `confirm: true` for every non-allowlisted operation, including
67
+ resets, provisioning, authentication attempts, exports, OATH listing/calculation and
68
+ all raw APDUs. Unknown commands stay rejected even after consent. Do not add
69
+ `--force` merely to make a command succeed.
70
+ 4. Keep credentials out of argv, environment variables, history and logs. Generic
71
+ calls close stdin. Use `interact(args: ..., confirm: true)` only in a private
72
+ operator terminal outside curses/recorded tool sessions. It bridges a native
73
+ PTY, returns only `:completed`, restores terminal mode and descriptor status flags,
74
+ and bounds total traffic and elapsed time, including human input. Its terminal
75
+ must be readable and writable, including the Ruby wrapper mode; validation
76
+ consumes no input and never closes caller-owned IO. Some upstream secret prompts
77
+ are not masked. Never guess a PIN. Key imports and SCP11 use protected existing files;
78
+ custom SCP03 import KIDs are refused before filename checks, even when the
79
+ inline key string names an existing file. SCP11 file-import KIDs accept unsigned
80
+ decimal, `0x` hex or `SCP11a`/`SCP11b`/`SCP11c` names, without coercion.
81
+ 5. Read the exact result or device state after a mutation. A timeout is uncertain
82
+ device state, not proof that nothing changed. Do not automatically retry.
83
+
84
+ ### Existing HMAC slot
85
+
86
+ ```ruby
87
+ challenge = SecureRandom.random_bytes(32)
88
+ response = PWN::Plugins::YubiKey.challenge_response(
89
+ challenge: challenge, slot: 2, serial: '12345678', timeout: 30
90
+ ); nil
91
+ ```
92
+
93
+ Pass **raw 1–64 bytes**, not pre-encoded hex. The wrapper sends `otp calculate
94
+ SLOT HEX_CHALLENGE` and returns exactly **20 binary bytes**. Slot 2 is only a
95
+ selector default, never implicit provisioning. Touch the device if required;
96
+ the wrapper suppresses the CLI's stderr prompt. The challenge is public in argv;
97
+ never use a password as the challenge. Keep the response out of transcripts.
98
+
99
+ ### Explicit provisioning
100
+
101
+ Only after inspecting the slot and obtaining consent, use
102
+ `provision_challenge_response(key: key_bytes, serial: serial, slot: 2,
103
+ confirm: true)`. `key_bytes` must be exactly 20 raw bytes acquired in local memory,
104
+ not a literal pasted into a console. The method checks ykman 5.9.1, supplies a
105
+ validated key/consent sequence through stdin without `--force`, enables touch,
106
+ and verifies a fresh random challenge with Ruby OpenSSL before returning
107
+ `:verified`. It overwrites the slot. Plan and test independent recovery before
108
+ discarding the key. Protected slots and other CLI versions require the separately
109
+ reviewed private-terminal workflow described in `documentation/YubiKey.md`.
110
+ No Ruby zeroization guarantee is made.
111
+
112
+ ### Exact OATH
113
+
114
+ `oath_code(account: exact_identifier, serial: serial, confirm: true)` returns
115
+ 6–8 digits, retaining leading zeros, or raises. It verifies a unique full
116
+ inventory identifier and the returned account label; substring-only, ambiguous,
117
+ changed-identity and nonnumeric output is refused. Official 5.9.1 has **no
118
+ --exact** option; `--single` alone is not exact matching. Confirmation is mandatory
119
+ for listing too: upstream may authenticate using a remembered key and delete/persist
120
+ that key if authentication fails, even without `--remember`. HOTP advances counters
121
+ and upstream code can delete corrupted credentials automatically. Do not treat
122
+ this as a read-only operation or use it for SMS/passkey
123
+ challenges. Password-protected OATH may require the private terminal workflow.
124
+
125
+ ## Pitfalls
126
+
127
+ - Missing executable, unsupported device capability or malformed output is an
128
+ error, not permission to reset, provision or fall back to a software key.
129
+ - `ykman script`, debug/traffic logging, secret argv fields, arbitrary stdin and
130
+ unreviewed future commands are intentionally unavailable.
131
+ - Raw APDU bytes are visible in argv. Never put credentials in arbitrary payloads;
132
+ the wrapper cannot infer their confidentiality.
133
+ - Noninteractive mutations needing prompts can abort/time out. Confirmation in
134
+ Ruby does not bypass the CLI's own confirmation except the fixed provisioning
135
+ stdin flow; no force flag is inserted.
136
+ - `timeout` defaults to 30 seconds and combined output to 1 MiB. Timeout/output
137
+ failures kill the Unix child process group and reap the direct child. This is
138
+ not a sandbox against a malicious executable escaping its process group.
139
+ - FIDO credential/PIN/fingerprint management is not website authentication.
140
+ Browser and relying party must perform genuine security-key ceremonies.
141
+
142
+ ## Verification
143
+
144
+ Run the paired offline suites:
145
+
146
+ ```text
147
+ bundle exec rspec spec/lib/pwn/plugins/yubikey_spec.rb spec/lib/pwn/plugins/yubikey_security_spec.rb spec/lib/pwn/plugins/yubikey_terminal_spec.rb
148
+ bundle exec rubocop lib/pwn/plugins/yubikey.rb spec/lib/pwn/plugins/yubikey_spec.rb spec/lib/pwn/plugins/yubikey_security_spec.rb spec/lib/pwn/plugins/yubikey_terminal_spec.rb
149
+ ```
150
+
151
+ Specs exercise real child processes with fake device executables, argument guards,
152
+ binary HMAC vectors, exact OATH parsing, validated provisioning, private PTY
153
+ prompts, descriptor/terminal restoration on success and failure, pre-spawn duplex
154
+ validation without consuming input, and cleanup. The
155
+ real 5.9.1 CLI's management help tree and Click stdin contract were separately
156
+ checked offline. None of this proves USB/NFC hardware, physical touches, PIN
157
+ protection, every firmware variant, or live website login. Report those boundaries.