pwn 0.5.628 → 0.5.631

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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -36
  3. data/bin/pwn +35 -1
  4. data/bin/pwn_setup +64 -0
  5. data/documentation/AI-Integration.md +50 -11
  6. data/documentation/AWS.md +3 -3
  7. data/documentation/Agent-Tool-Registry.md +24 -0
  8. data/documentation/Banner.md +1 -1
  9. data/documentation/Blockchain.md +3 -3
  10. data/documentation/Bounty.md +4 -4
  11. data/documentation/BurpSuite.md +5 -2
  12. data/documentation/CLI-Drivers.md +29 -12
  13. data/documentation/Configuration.md +92 -65
  14. data/documentation/Contributing.md +14 -4
  15. data/documentation/Cron.md +5 -5
  16. data/documentation/Diagrams.md +4 -4
  17. data/documentation/Drivers.md +4 -4
  18. data/documentation/Extrospection.md +162 -152
  19. data/documentation/FFI.md +61 -24
  20. data/documentation/Fuzzing.md +4 -1
  21. data/documentation/General-PWN-Usage.md +13 -1
  22. data/documentation/Hardware.md +11 -7
  23. data/documentation/Home.md +9 -9
  24. data/documentation/How-PWN-Works.md +13 -12
  25. data/documentation/Installation.md +201 -37
  26. data/documentation/Metasploit.md +7 -4
  27. data/documentation/Mistakes.md +22 -22
  28. data/documentation/NmapIt.md +3 -0
  29. data/documentation/Persistence.md +8 -5
  30. data/documentation/Plugins.md +11 -11
  31. data/documentation/Reporting.md +5 -2
  32. data/documentation/SAST.md +1 -1
  33. data/documentation/SDR.md +55 -17
  34. data/documentation/Sessions.md +5 -5
  35. data/documentation/Skills-Memory-Learning.md +82 -69
  36. data/documentation/Swarm.md +26 -6
  37. data/documentation/Transparent-Browser.md +11 -8
  38. data/documentation/Troubleshooting.md +66 -10
  39. data/documentation/WWW.md +2 -2
  40. data/documentation/What-is-PWN.md +11 -11
  41. data/documentation/Why-PWN.md +4 -4
  42. data/documentation/diagrams/agent-tool-registry.svg +120 -109
  43. data/documentation/diagrams/ai-integration-tool-calling.svg +76 -65
  44. data/documentation/diagrams/aws-cloud-security.svg +1 -1
  45. data/documentation/diagrams/burp-vs-zap-preference.svg +27 -27
  46. data/documentation/diagrams/code-scanning-sast.svg +1 -1
  47. data/documentation/diagrams/cron-scheduling.svg +1 -1
  48. data/documentation/diagrams/dot/_THEME.md +1 -1
  49. data/documentation/diagrams/dot/agent-tool-registry.dot +6 -4
  50. data/documentation/diagrams/dot/ai-integration-tool-calling.dot +4 -3
  51. data/documentation/diagrams/dot/aws-cloud-security.dot +1 -1
  52. data/documentation/diagrams/dot/burp-vs-zap-preference.dot +1 -1
  53. data/documentation/diagrams/dot/code-scanning-sast.dot +1 -1
  54. data/documentation/diagrams/dot/cron-scheduling.dot +1 -1
  55. data/documentation/diagrams/dot/driver-framework.dot +1 -1
  56. data/documentation/diagrams/dot/extrospection-world-awareness.dot +1 -1
  57. data/documentation/diagrams/dot/history-to-drivers.dot +1 -1
  58. data/documentation/diagrams/dot/memory-skills-detailed.dot +27 -5
  59. data/documentation/diagrams/dot/mistakes-negative-feedback.dot +6 -6
  60. data/documentation/diagrams/dot/overall-pwn-architecture.dot +7 -5
  61. data/documentation/diagrams/dot/persistence-filesystem.dot +6 -4
  62. data/documentation/diagrams/dot/plugin-ecosystem.dot +1 -1
  63. data/documentation/diagrams/dot/pwn-ai-feedback-learning-loop.dot +31 -10
  64. data/documentation/diagrams/dot/pwn-repl-prototyping.dot +1 -1
  65. data/documentation/diagrams/dot/reporting-pipeline.dot +1 -1
  66. data/documentation/diagrams/dot/sdr-radio-flow.dot +16 -12
  67. data/documentation/diagrams/dot/sessions-cron-automation.dot +1 -1
  68. data/documentation/diagrams/dot/swarm-multi-agent.dot +8 -2
  69. data/documentation/diagrams/driver-framework.svg +1 -1
  70. data/documentation/diagrams/extrospection-world-awareness.svg +129 -129
  71. data/documentation/diagrams/history-to-drivers.svg +32 -32
  72. data/documentation/diagrams/memory-skills-detailed.svg +268 -137
  73. data/documentation/diagrams/mistakes-negative-feedback.svg +51 -51
  74. data/documentation/diagrams/overall-pwn-architecture.svg +188 -171
  75. data/documentation/diagrams/persistence-filesystem.svg +120 -89
  76. data/documentation/diagrams/plugin-ecosystem.svg +1 -1
  77. data/documentation/diagrams/pwn-ai-feedback-learning-loop.svg +407 -255
  78. data/documentation/diagrams/pwn-repl-prototyping.svg +1 -1
  79. data/documentation/diagrams/reporting-pipeline.svg +1 -1
  80. data/documentation/diagrams/sdr-radio-flow.svg +181 -146
  81. data/documentation/diagrams/sessions-cron-automation.svg +1 -1
  82. data/documentation/diagrams/swarm-multi-agent.svg +156 -119
  83. data/documentation/pwn-REPL.md +8 -7
  84. data/documentation/pwn-ai-Agent.md +57 -29
  85. data/lib/pwn/ai/agent/dispatch.rb +1 -1
  86. data/lib/pwn/ai/agent/extrospection.rb +39 -39
  87. data/lib/pwn/ai/agent/learning.rb +1 -1
  88. data/lib/pwn/ai/agent/loop.rb +40 -0
  89. data/lib/pwn/ai/agent/metrics.rb +1 -1
  90. data/lib/pwn/ai/agent/tools/extrospection.rb +20 -20
  91. data/lib/pwn/config.rb +3 -3
  92. data/lib/pwn/ffi/hack_rf.rb +119 -0
  93. data/lib/pwn/ffi/soapy_sdr.rb +165 -3
  94. data/lib/pwn/memory_index.rb +1 -1
  95. data/lib/pwn/plugins/repl.rb +26 -2
  96. data/lib/pwn/sdr/decoder/adsb.rb +1 -1
  97. data/lib/pwn/sdr/decoder/base.rb +30 -16
  98. data/lib/pwn/sdr/decoder/flex.rb +378 -120
  99. data/lib/pwn/sdr/decoder/rtl433.rb +1 -1
  100. data/lib/pwn/sdr/decoder/rtty.rb +1 -1
  101. data/lib/pwn/sdr/decoder.rb +1 -1
  102. data/lib/pwn/sdr/gqrx.rb +7 -7
  103. data/lib/pwn/setup.rb +563 -0
  104. data/lib/pwn/version.rb +1 -1
  105. data/lib/pwn.rb +1 -0
  106. data/spec/lib/pwn/sdr/decoder/flex_spec.rb +67 -0
  107. data/spec/lib/pwn/setup_spec.rb +28 -0
  108. data/third_party/pwn_rdoc.jsonl +40 -12
  109. metadata +5 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 44fdb9e4897d83ad9ab54d65bc774eed6be14c379eea42b1a7984abab23c03bd
4
- data.tar.gz: ba801dabf738c43b3fe7ce9cf40bdfb38d1cf62f7a0b98b05861626c33d2d008
3
+ metadata.gz: f125b1fd9398d2de99e6b311a1950e646992736f38552b818cb269e9d8704a6d
4
+ data.tar.gz: a84266bb38a93fecb6e8c5fa0b5c73b638dcaa9196838a436c31127f95eedf31
5
5
  SHA512:
6
- metadata.gz: 205805e3088246b711249ba3b778e9418fb1616ad576dde6c22c0c632409de88b2545fda88ee30316fe7a203a2ff9a46236136e94ba291a7dc27c800d7b8c02c
7
- data.tar.gz: 4e439c01661f7707c9bf79e8e4be656e76f9d57d5bb17cf9778536bd1a8ebbc63aebd4effbcce38d4ed89f4cfdbe188072ab710a7374d0a951fd8a0c7bd7d0fd
6
+ metadata.gz: 9a2114b37283201211235e16fb558b51e5eb64ebec22d164898fc5b40db763696f56fdea8a99e9cf3905701fa3738a866726822a797e970a1de64c3ded54503d
7
+ data.tar.gz: fb3452718e38139450c34b8de7905188906e5d10935aabb592f6c96c0789e61ab1e29d4b4bc6e4563c1c124ffa87c835c4c417bccd99a0c919a93443e757f70f
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- ![PWN](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/PWN.png) -->
2
2
 
3
3
  <p align="center">
4
- <img src="documentation/pwn_silent_help_learn_demo.gif" alt="PWN Silent Demo Help Surfaces + Learning Feedback Loop" width="640">
4
+ <img src="documentation/pwn_silent_help_learn_demo.gif" alt="PWN Silent Demo - Help Surfaces + Learning Feedback Loop" width="640">
5
5
  </p>
6
6
 
7
7
  ### **Table of Contents** ###
@@ -24,16 +24,16 @@
24
24
 
25
25
  #### **What is PWN** ####
26
26
 
27
- PWN (pronounced /pōn/ *pone*) is an open-source **offensive-security
27
+ PWN (pronounced /pōn/ - *pone*) is an open-source **offensive-security
28
28
  automation framework** and **continuous-security-integration** platform.
29
29
  It gives security researchers, red teamers, penetration testers and
30
30
  vulnerability researchers a single, scriptable Ruby surface over the entire
31
- offensive toolchain from OSINT and network discovery, through web / cloud /
32
- hardware / radio exploitation, to reporting and disclosure and puts a
31
+ offensive toolchain - from OSINT and network discovery, through web / cloud /
32
+ hardware / radio exploitation, to reporting and disclosure - and puts a
33
33
  **self-improving, tool-calling, multi-agent AI** on top of it.
34
34
 
35
35
  **In numbers:** 66 `PWN::Plugins` · 48 `PWN::SAST` rules · 90 `PWN::AWS`
36
- service wrappers · 21 `PWN::WWW` site drivers · 52 `bin/pwn_*` CLI drivers ·
36
+ service wrappers · 21 `PWN::WWW` site drivers · 53 `bin/pwn_*` CLI drivers ·
37
37
  5 LLM engines · 10 agent toolsets · 45+ LLM-callable tools.
38
38
 
39
39
  Full page: [What is PWN](documentation/What-is-PWN.md)
@@ -43,7 +43,7 @@ Full page: [What is PWN](documentation/What-is-PWN.md)
43
43
  Offensive security is a *toolchain problem*. PWN's bet is that the right
44
44
  abstraction is **plain Ruby methods with a uniform `opts = {}` signature**,
45
45
  exposed simultaneously to a human in a REPL, an LLM in a tool-calling loop, a
46
- shell script in CI, and a cron job at 3 am all open-source and auditable,
46
+ shell script in CI, and a cron job at 3 am - all open-source and auditable,
47
47
  which matters when the caller is autonomous.
48
48
 
49
49
  Full page: [Why PWN](documentation/Why-PWN.md)
@@ -54,10 +54,10 @@ Five layers, edges only ever go down:
54
54
 
55
55
  ![PWN Overall Architecture](documentation/diagrams/overall-pwn-architecture.svg)
56
56
 
57
- The AI layer closes a **self-improvement loop** on every turn Metrics +
57
+ The AI layer closes a **self-improvement loop** on every turn - Metrics +
58
58
  Learning + **Mistakes** (introspection / negative feedback) joined with
59
- Snapshot + Drift + Intel + RF + **Web** (extrospection) plus browser-backed **`extro_verify`** / **`extro_watch`** and RF **`extro_rf_tune`** sensing via `extro_correlate`, so the
60
- agent knows whether a failure was *its* fault or *the world* changed
59
+ Snapshot + Drift + Intel + RF + **Web** (extrospection) - plus browser-backed **`extro_verify`** / **`extro_watch`** and RF **`extro_rf_tune`** sensing - via `extro_correlate`, so the
60
+ agent knows whether a failure was *its* fault or *the world* changed -
61
61
  **and does not repeat the same mistake twice**:
62
62
 
63
63
  ![pwn-ai Feedback Learning Loop](documentation/diagrams/pwn-ai-feedback-learning-loop.svg)
@@ -68,8 +68,8 @@ on the next recurrence:
68
68
 
69
69
  ![Mistakes Negative-Feedback Loop](documentation/diagrams/mistakes-negative-feedback.svg)
70
70
 
71
- And **Swarm** runs multiple personas each a full tool-calling agent,
72
- optionally on a *different* LLM engine over a shared append-only bus:
71
+ And **Swarm** runs multiple personas - each a full tool-calling agent,
72
+ optionally on a *different* LLM engine - over a shared append-only bus:
73
73
 
74
74
  ![Swarm Multi-Agent](documentation/diagrams/swarm-multi-agent.svg)
75
75
 
@@ -86,7 +86,7 @@ The complete wiki lives in this repo at **[`documentation/Home.md`](documentatio
86
86
  |---|---|---|---|
87
87
  | [What is PWN](documentation/What-is-PWN.md) | [`pwn` REPL](documentation/pwn-REPL.md) | [AI / LLM Integration](documentation/AI-Integration.md) | [Plugins (66)](documentation/Plugins.md) |
88
88
  | [Why PWN](documentation/Why-PWN.md) | [`pwn-ai` Agent](documentation/pwn-ai-Agent.md) | [Agent Tool Registry](documentation/Agent-Tool-Registry.md) | [SAST (48)](documentation/SAST.md) |
89
- | [How PWN Works](documentation/How-PWN-Works.md) | [CLI Drivers (52)](documentation/CLI-Drivers.md) | [Memory · Skills · Learning](documentation/Skills-Memory-Learning.md) | [AWS (90)](documentation/AWS.md) |
89
+ | [How PWN Works](documentation/How-PWN-Works.md) | [CLI Drivers (53)](documentation/CLI-Drivers.md) | [Memory · Skills · Learning](documentation/Skills-Memory-Learning.md) | [AWS (90)](documentation/AWS.md) |
90
90
  | [Installation](documentation/Installation.md) | [Build a Driver](documentation/Drivers.md) | [Mistakes (neg-feedback)](documentation/Mistakes.md) | [WWW (21)](documentation/WWW.md) |
91
91
  | [General Usage](documentation/General-PWN-Usage.md) | | [Extrospection](documentation/Extrospection.md) | [SDR / Radio](documentation/SDR.md) |
92
92
  | [Configuration](documentation/Configuration.md) | | [Swarm (multi-agent)](documentation/Swarm.md) | [Hardware](documentation/Hardware.md) |
@@ -103,18 +103,31 @@ Rebuild every SVG from its Graphviz source:
103
103
 
104
104
  ### **Installation** ###
105
105
 
106
- Tested on Debian-based Linux & macOS, Ruby via RVM.
106
+ PWN is a **single gem** with a built-in post-install doctor/provisioner -
107
+ `pwn setup` - that detects your package manager (`apt` · `dnf` · `pacman` ·
108
+ `brew` · `port`) and installs exactly the OS headers + external tools each
109
+ `PWN::` capability needs. Tested on Kali/Debian/Ubuntu, Fedora, Arch, macOS.
107
110
 
108
111
  ```
109
- $ cd /opt
110
- $ sudo git clone https://github.com/0dayinc/pwn
111
- $ cd /opt/pwn
112
- $ ./install.sh
113
- $ ./install.sh ruby-gem
112
+ $ gem install pwn
113
+ $ pwn setup # read-only doctor: which capabilities are usable?
114
+ $ pwn setup --profile full --yes # provision everything (or: web | net | sdr | vision | ...)
114
115
  $ pwn
115
- pwn[v0.5.628]:001 >>> PWN.help
116
+ pwn[v0.5.631]:001 >>> PWN.help
116
117
  ```
117
118
 
119
+ Only need a subset?
120
+
121
+ ```
122
+ $ pwn setup --list-profiles
123
+ $ pwn setup --profile web # TransparentBrowser · Burp · ZAP · Tor · sqlmap
124
+ $ pwn setup --profile sdr --yes # GQRX · rtl-sdr · hackrf · SoapySDR · FFI DSP
125
+ $ pwn setup --profile net --dry-run
126
+ ```
127
+
128
+ Also available as `pwn_setup` (standalone driver) and `pwn --setup[=PROFILE]`.
129
+ The doctor exits non-zero when capabilities are degraded, so CI can gate on it.
130
+
118
131
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](https://youtu.be/G7iLUY4FzsI)
119
132
 
120
133
  Full page: [Installation](documentation/Installation.md) ·
@@ -127,29 +140,25 @@ Full page: [Installation](documentation/Installation.md) ·
127
140
  [General Usage Quick-Start](https://github.com/0dayinc/pwn/wiki/General-PWN-Usage) ·
128
141
  local: [General PWN Usage](documentation/General-PWN-Usage.md)
129
142
 
130
- Update PWN frequently new plugins, agent tools, skills and zero-day tooling
143
+ Update PWN frequently - new plugins, agent tools, skills and zero-day tooling
131
144
  land regularly:
132
145
 
133
146
  ```
134
- $ rvm list gemsets
135
- $ rvm use ruby-4.0.5@pwn
136
- $ gem uninstall --all --executables pwn
137
- $ gem install --verbose pwn
147
+ $ gem update pwn
148
+ $ pwn setup # re-doctor - new versions may add capabilities
138
149
  $ pwn
139
- pwn[v0.5.628]:001 >>> PWN.help
150
+ pwn[v0.5.631]:001 >>> PWN.help
140
151
  ```
141
152
 
142
- If using a multi-user RVM install:
153
+ From a git checkout:
143
154
 
144
155
  ```
145
- $ rvm use ruby-4.0.5@pwn
146
- $ rvmsudo gem uninstall --all --executables pwn
147
- $ rvmsudo gem install --verbose pwn
156
+ $ cd /opt/pwn && git pull && rake install && pwn setup
148
157
  ```
149
158
 
150
159
  **Inside the `pwn` REPL:**
151
160
  - Full access to every `PWN::` module.
152
- - `pwn-ai` launch the autonomous agent TUI (SHIFT+ENTER newline, ENTER submit).
161
+ - `pwn-ai` - launch the autonomous agent TUI (SHIFT+ENTER newline, ENTER submit).
153
162
  - `pwn-asm`, `pwn-ai-memory`, `pwn-ai-sessions`, `pwn-ai-cron`, `pwn-ai-delegate`.
154
163
 
155
164
  **Headless / CI one-shot (`pwn --ai`):**
@@ -160,11 +169,10 @@ $ echo "$LONG_PROMPT" | pwn --ai -
160
169
  $ pwn -Y ./ci/pwn.yaml --ai 'Run pwn_sast against ./src and summarise HIGH findings' > findings.txt
161
170
  ```
162
171
 
163
- PWN periodically upgrades to the latest Ruby (`/opt/pwn/.ruby-version`).
164
- Easiest upgrade of Ruby + pwn from a previous install:
172
+ **Provision a CI runner / Docker image:**
165
173
 
166
174
  ```
167
- $ /opt/pwn/vagrant/provisioners/pwn.sh
175
+ $ pwn setup --profile web --yes && pwn setup --check # exits 1 if degraded
168
176
  ```
169
177
 
170
178
  ---
@@ -173,7 +181,7 @@ $ /opt/pwn/vagrant/provisioners/pwn.sh
173
181
 
174
182
  Contributions that expand PWN's offensive capabilities are welcome. If you can
175
183
  provide access to additional commercial LLMs, security scanners, or bounty
176
- platforms or wish to contribute plugins, AI skills, or exploit modules
184
+ platforms - or wish to contribute plugins, AI skills, or exploit modules -
177
185
  please [email us](mailto:support@0dayinc.com). See
178
186
  [CONTRIBUTING.md](https://github.com/0dayInc/pwn/blob/master/CONTRIBUTING.md)
179
187
  and the local [Contributing](documentation/Contributing.md) page.
@@ -182,7 +190,7 @@ and the local [Contributing](documentation/Contributing.md) page.
182
190
 
183
191
  ### **Module Documentation** ###
184
192
 
185
- **Primary:** [`documentation/Home.md`](documentation/Home.md) the full local
193
+ **Primary:** [`documentation/Home.md`](documentation/Home.md) - the full local
186
194
  wiki with 30+ pages and 26 SVG data-flow diagrams.
187
195
 
188
196
  **API reference:** [rubydoc.info/gems/pwn](https://www.rubydoc.info/gems/pwn),
@@ -198,7 +206,7 @@ Highlights:
198
206
  [SAST](documentation/SAST.md) ·
199
207
  [AI Integration](documentation/AI-Integration.md)
200
208
 
201
- I hope you enjoy PWN and remember: **always have permission** before any
209
+ I hope you enjoy PWN - and remember: **always have permission** before any
202
210
  security testing. Now go pwn all the things (responsibly)!
203
211
 
204
212
  ---
data/bin/pwn CHANGED
@@ -3,6 +3,19 @@
3
3
 
4
4
  require 'pwn'
5
5
 
6
+ # ----------------------------------------------------------------------
7
+ # Bare-word subcommand: `pwn setup [...]` → delegate to bin/pwn_setup so
8
+ # `gem install pwn && pwn setup` is the canonical two-step install path.
9
+ # Must be handled BEFORE OptionParser (which would reject `setup`).
10
+ # ----------------------------------------------------------------------
11
+ if ARGV.first == 'setup'
12
+ ARGV.shift
13
+ setup_bin = File.expand_path('pwn_setup', __dir__)
14
+ setup_bin = Gem.bin_path('pwn', 'pwn_setup') unless File.file?(setup_bin)
15
+ load setup_bin
16
+ exit
17
+ end
18
+
6
19
  opts = PWN::Env[:driver_opts]
7
20
  pwn_driver = PWN::Driver::Parser.new do |options|
8
21
  options.on(
@@ -14,6 +27,16 @@ pwn_driver = PWN::Driver::Parser.new do |options|
14
27
  ) do |a|
15
28
  opts[:ai] = a
16
29
  end
30
+
31
+ options.on(
32
+ '-S[PROFILE]',
33
+ '--setup[=PROFILE]',
34
+ '<Optional - Post-install doctor / capability provisioner. With no ' \
35
+ "PROFILE runs a read-only check; with PROFILE (#{PWN::Setup::PROFILES.keys.join('|')}) " \
36
+ 'installs OS deps for that capability set. Same as `pwn setup` / `pwn_setup`>'
37
+ ) do |p|
38
+ opts[:setup] = p || true
39
+ end
17
40
  end
18
41
  pwn_driver.auto_opts_help = false
19
42
  pwn_driver.parse!
@@ -21,7 +44,18 @@ pwn_driver.parse!
21
44
  begin
22
45
  pwn_pid = Process.pid
23
46
 
24
- if opts[:ai]
47
+ if opts[:setup]
48
+ # ------------------------------------------------------------------
49
+ # `pwn --setup` → PWN::Setup.check (read-only doctor)
50
+ # `pwn --setup=web` → PWN::Setup.deps(profile: :web)
51
+ # ------------------------------------------------------------------
52
+ if opts[:setup] == true
53
+ r = PWN::Setup.check
54
+ exit(r[:ok] ? 0 : 1)
55
+ else
56
+ PWN::Setup.deps(profile: opts[:setup])
57
+ end
58
+ elsif opts[:ai]
25
59
  # ------------------------------------------------------------------
26
60
  # Headless pwn-ai: behave as if the user typed PROMPT at the pwn-ai
27
61
  # TUI, but non-interactively — a single agent-loop turn with native
data/bin/pwn_setup ADDED
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'pwn'
5
+
6
+ opts = PWN::Env[:driver_opts]
7
+ pwn_driver = PWN::Driver::Parser.new do |options|
8
+ options.banner = "USAGE: #{File.basename($PROGRAM_NAME)} [opts]\n " \
9
+ "Post-install doctor & capability provisioner for the PWN gem.\n " \
10
+ "With no options, runs a read-only capability check.\n"
11
+
12
+ options.on('-c', '--check',
13
+ '<Optional - Read-only doctor: which PWN capabilities are usable on this host? (default action)>') do |o|
14
+ opts[:check] = o
15
+ end
16
+
17
+ options.on('-d', '--deps',
18
+ '<Optional - Install OS headers + external tools + rebuild native gems for --profile (default: full)>') do |o|
19
+ opts[:deps] = o
20
+ end
21
+
22
+ options.on('-pNAME', '--profile=NAME',
23
+ "<Optional - Capability profile: #{PWN::Setup::PROFILES.keys.join(' | ')} (default: full)>") do |o|
24
+ opts[:profile] = o
25
+ end
26
+
27
+ options.on('-l', '--list-profiles',
28
+ '<Optional - List capability profiles and exit>') do |o|
29
+ opts[:list] = o
30
+ end
31
+
32
+ options.on('-y', '--yes',
33
+ '<Optional - Assume yes; non-interactive (CI-friendly)>') do |o|
34
+ opts[:yes] = o
35
+ end
36
+
37
+ options.on('-n', '--dry-run',
38
+ '<Optional - Print the commands that would run, do not execute>') do |o|
39
+ opts[:dry_run] = o
40
+ end
41
+ end
42
+ pwn_driver.auto_opts_help = false
43
+ pwn_driver.parse!
44
+
45
+ begin
46
+ if opts[:list]
47
+ PWN::Setup.list_profiles
48
+ elsif opts[:deps] || opts[:profile]
49
+ PWN::Setup.deps(
50
+ profile: opts[:profile],
51
+ yes: opts[:yes],
52
+ dry_run: opts[:dry_run]
53
+ )
54
+ else
55
+ r = PWN::Setup.check
56
+ exit 1 unless r[:ok]
57
+ end
58
+ rescue Interrupt
59
+ puts "\naborted."
60
+ exit 130
61
+ rescue StandardError => e
62
+ warn "pwn_setup: #{e.class}: #{e.message}"
63
+ exit 1
64
+ end
@@ -1,7 +1,7 @@
1
- # AI / LLM Integration `PWN::AI`
1
+ # AI / LLM Integration - `PWN::AI`
2
2
 
3
3
  One agent loop, five interchangeable engines. Swap providers by changing one
4
- line in `~/.pwn/config.yml`; the tool-calling contract is normalised so the
4
+ line in `~/.pwn/pwn.yaml`; the tool-calling contract is normalised so the
5
5
  agent code never cares which model is behind it.
6
6
 
7
7
  ![Multi-provider integration](diagrams/ai-integration-tool-calling.svg)
@@ -12,25 +12,60 @@ agent code never cares which model is behind it.
12
12
  |---|---|---|---|
13
13
  | `openai` | `PWN::AI::OpenAI` | `key:` | function-calling native |
14
14
  | `anthropic` | `PWN::AI::Anthropic` | `key:` | tool-use native |
15
- | `grok` | `PWN::AI::Grok` | `key:` **or** `oauth: true` | OAuth = RFC-8628 device-code flow using xAI's public Grok-CLI client id (no secret) see skill `xai_grok_oauth_device_flow` |
15
+ | `grok` | `PWN::AI::Grok` | `key:` **or** `oauth: true` | OAuth = RFC-8628 device-code flow using xAI's public Grok-CLI client id (no secret) - see skill `xai_grok_oauth_device_flow` |
16
16
  | `gemini` | `PWN::AI::Gemini` | `key:` | function-calling native |
17
- | `ollama` | `PWN::AI::Ollama` | none | local, `base_url:` + `model:` |
17
+ | `ollama` | `PWN::AI::Ollama` | none | local - native `/api/chat` (`num_ctx`, `keep_alive`, low-temp + `format:'json'` on tool turns) and `/api/embed` for `PWN::MemoryIndex` |
18
+
19
+ > PWN is **model-agnostic**. `ai.<engine>.model` is passed straight through to
20
+ > the provider - the codebase and docs deliberately never name a specific
21
+ > model id so you can point each engine at whatever the vendor currently
22
+ > ships (or whatever `ollama list` shows locally).
18
23
 
19
24
  ## Selecting an engine
20
25
 
21
26
  ```yaml
22
- # ~/.pwn/config.yml
27
+ # ~/.pwn/pwn.yaml
23
28
  ai:
24
- engine: grok
29
+ active: grok
25
30
  grok:
26
- oauth: true # first run opens https://accounts.x.ai/… device page
31
+ oauth:
32
+ enroll: true # first run opens https://accounts.x.ai/... device page
27
33
  ```
28
34
 
29
35
  ```ruby
30
36
  # at runtime
31
- PWN::Env[:ai][:engine] = :ollama
37
+ PWN::Env[:ai][:active] = :ollama
32
38
  ```
33
39
 
40
+ ## Engine-aware behavior
41
+
42
+ The harness adapts to the *class* of engine, not the model name:
43
+
44
+ | Concern | Frontier (`openai` · `anthropic` · `grok` · `gemini`) | Local (`ollama`) |
45
+ |---|---|---|
46
+ | **PromptBuilder.budget** | full MEMORY / METRICS / MISTAKES / LEARNING / EXTRO blocks | tightened via `ai.ollama.prompt_budget` (extro off by default) |
47
+ | **MEMORY ranking** | relevance-ranked when a local Ollama `embed_model` is reachable, else newest-first | relevance-ranked via `PWN::MemoryIndex` (`~/.pwn/memory.idx`) |
48
+ | **Tool schemas shipped** | all toolsets | `CORE_TOOLS` + top-K keyword matches when `ai.agent.tool_router` is on |
49
+ | **Pre-pass** | none | `plan_first` numbered tool plan before first dispatch |
50
+ | **Few-shot** | none | `Learning.exemplars_for(request)` splices a prior successful trace |
51
+ | **Dispatch parsing** | strict | tolerant - Levenshtein tool-name repair + JSON5-ish arg cleanup, each repair fingerprinted into `Mistakes` |
52
+ | **Post-answer** | `auto_introspect` | `auto_introspect` **+** `fact_check_local_final` (auto `extro_verify` on CVE/version-shaped claims) |
53
+ | **Metrics bucket** | `metrics.json[:tools][name][:engines][:<engine>]` | same - the `TOOL EFFECTIVENESS` block is per-engine so local telemetry never blends with frontier |
54
+
55
+ ## Teacher-student reflection
56
+
57
+ `ai.reflect_engine` decouples *doing* from *learning-about-doing*:
58
+
59
+ ```yaml
60
+ ai:
61
+ active: ollama # the local model executes tools and answers
62
+ reflect_engine: anthropic # a frontier model writes the durable Memory :lesson
63
+ ```
64
+
65
+ `PWN::AI::Agent::Reflect.on` temporarily flips the active engine for the
66
+ introspection call only, so the local model reads back distilled reasoning it
67
+ could not have produced itself.
68
+
34
69
  ## Direct client use (no agent)
35
70
 
36
71
  ```ruby
@@ -43,10 +78,14 @@ puts resp[:content]
43
78
  ## Model diversity in Swarm
44
79
 
45
80
  Because each persona in [`agents.yml`](Swarm.md) can override `engine:`, an
46
- `agent_debate` can literally pit Claude against Grok against a local Llama
47
- real antagonism, not one model role-playing three voices.
81
+ `agent_debate` can pit five *different providers* against each other - real
82
+ antagonism, not one model role-playing three voices. The same mechanism backs
83
+ `ai.agent.escalation_persona`: when a local model is stuck, `Loop.run` asks a
84
+ frontier persona for a 3-line corrective hint and injects it as a synthetic
85
+ tool result.
48
86
 
49
87
  **See also:** [pwn-ai Agent](pwn-ai-Agent.md) ·
50
- [Agent Tool Registry](Agent-Tool-Registry.md) · [Swarm](Swarm.md)
88
+ [Agent Tool Registry](Agent-Tool-Registry.md) · [Swarm](Swarm.md) ·
89
+ [Configuration](Configuration.md)
51
90
 
52
91
  [← Home](Home.md)
data/documentation/AWS.md CHANGED
@@ -1,4 +1,4 @@
1
- # `PWN::AWS` Cloud Security (90 service wrappers)
1
+ # `PWN::AWS` - Cloud Security (90 service wrappers)
2
2
 
3
3
  One thin module per AWS service, each wrapping the official `aws-sdk-*` gem
4
4
  with the PWN `opts = {}` convention so they compose in the REPL and in
@@ -10,7 +10,7 @@ with the PWN `opts = {}` convention so they compose in the REPL and in
10
10
 
11
11
  Standard AWS SDK chain: `~/.aws/credentials` profile, env vars
12
12
  (`AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `AWS_SESSION_TOKEN`), or
13
- instance profile. Optionally pin in `~/.pwn/config.yml` under `aws:`.
13
+ instance profile. Optionally pin in `~/.pwn/pwn.yaml` under `aws:`.
14
14
 
15
15
  ## Quick enumeration
16
16
 
@@ -51,7 +51,7 @@ CLI: `pwn_aws_describe_resources -r us-east-1 -o out/`
51
51
  `ec2:RunInstances` with instance profile.
52
52
  - **Persist** → new access key, Lambda backdoor, EC2 userdata.
53
53
 
54
- Record everything with `extro_observe(source: 'aws', )` so
54
+ Record everything with `extro_observe(source: 'aws', ...)` so
55
55
  [Extrospection](Extrospection.md) can correlate later.
56
56
 
57
57
  [← Home](Home.md)
@@ -21,6 +21,30 @@ toolsets; the JSON-Schema for each tool is what the model actually sees.
21
21
  | `cron` | `cron_list` · `cron_create` · `cron_run` · `cron_enable` · `cron_disable` · `cron_remove` | `PWN::Cron` → `~/.pwn/cron/jobs.yml` |
22
22
  | `swarm` | `agent_list` · `agent_spawn` · `agent_ask` · `agent_debate` · `agent_broadcast` · `swarm_bus` · `swarm_list` | `PWN::AI::Agent::Swarm` → `~/.pwn/agents.yml` + `~/.pwn/swarm/` |
23
23
 
24
+
25
+ ## Dynamic tool-set slimming (`ai.agent.tool_router`)
26
+
27
+ Shipping every schema on every turn overwhelms a small local model - the
28
+ choice space is huge and it mis-routes (e.g. picks an RF tool for a git
29
+ question). When `ai.agent.tool_router: true` **and** `Loop.run` passes the
30
+ user request through as `relevance:`, `Registry.definitions` shrinks the
31
+ pool to:
32
+
33
+ ```text
34
+ CORE_TOOLS = shell · pwn_eval · memory_remember · memory_recall
35
+ mistakes_record · mistakes_resolve · learning_note_outcome
36
+ + top-K keyword-ranked matches for THIS request
37
+ (ties break on Metrics per-engine success_rate → the router
38
+ itself is a learned component)
39
+ ```
40
+
41
+ ```ruby
42
+ PWN::AI::Agent::Registry.definitions(relevance: 'nmap sweep 10.0.0.0/8', top_k: 10)
43
+ PWN::AI::Agent::Registry.rank(query: 'run a shell command') # inspect ranking
44
+ ```
45
+
46
+ Frontier engines leave `tool_router` off and receive the full set.
47
+
24
48
  ## Adding a tool
25
49
 
26
50
  ```ruby
@@ -1,4 +1,4 @@
1
- # `PWN::Banner` Startup Art
1
+ # `PWN::Banner` - Startup Art
2
2
 
3
3
  15 ANSI banners; one is picked at random every time the REPL starts. Purely
4
4
  cosmetic, entirely necessary.
@@ -1,4 +1,4 @@
1
- # `PWN::Blockchain` BTC · ETH
1
+ # `PWN::Blockchain` - BTC · ETH
2
2
 
3
3
  Lightweight helpers for on-chain recon and wallet interaction.
4
4
  Source: `lib/pwn/blockchain/*.rb`.
@@ -11,8 +11,8 @@ Source: `lib/pwn/blockchain/*.rb`.
11
11
  Also exposed to the agent via `PWN::AI::Agent::BTC` for wallet-aware prompts.
12
12
 
13
13
  ```ruby
14
- PWN::Blockchain::BTC.balance(address: 'bc1q')
15
- PWN::Blockchain::ETH.call(contract: '0x', method: 'owner()')
14
+ PWN::Blockchain::BTC.balance(address: 'bc1q...')
15
+ PWN::Blockchain::ETH.call(contract: '0x...', method: 'owner()')
16
16
  ```
17
17
 
18
18
  [← Home](Home.md)
@@ -1,4 +1,4 @@
1
- # `PWN::Bounty` Bug-Bounty Lifecycle Tooling
1
+ # `PWN::Bounty` - Bug-Bounty Lifecycle Tooling
2
2
 
3
3
  | Module | Purpose |
4
4
  |---|---|
@@ -6,9 +6,9 @@
6
6
 
7
7
  Pairs naturally with:
8
8
 
9
- - [`PWN::WWW::HackerOne`](WWW.md) / `BugCrowd` / `Synack` programme navigation
10
- - `PWN::Plugins::HackerOne` submissions API
11
- - [`PWN::Plugins::BurpSuite`](BurpSuite.md) capture the session to replay
9
+ - [`PWN::WWW::HackerOne`](WWW.md) / `BugCrowd` / `Synack` - programme navigation
10
+ - `PWN::Plugins::HackerOne` - submissions API
11
+ - [`PWN::Plugins::BurpSuite`](BurpSuite.md) - capture the session to replay
12
12
 
13
13
  ```ruby
14
14
  PWN::Bounty::LifecycleAuthzReplay.start(
@@ -6,10 +6,13 @@ Professional's headless mode + REST API.
6
6
 
7
7
  ![Web application testing](diagrams/web-application-testing.svg)
8
8
 
9
+ > **Install:** `pwn setup --profile web` - burpsuite · zaproxy · chromium ·
10
+ > geckodriver · sqlmap · tor. See [Installation](Installation.md).
11
+
9
12
  ## Configure
10
13
 
11
14
  ```yaml
12
- # ~/.pwn/config.yml
15
+ # ~/.pwn/pwn.yaml (edit via `pwn-vault`)
13
16
  burp:
14
17
  jar: /opt/burpsuite_pro/burpsuite_pro.jar
15
18
  api_key: <REST-API-KEY>
@@ -39,7 +42,7 @@ PWN::Plugins::BurpSuite.stop(burp_obj: burp)
39
42
  ## CLI drivers
40
43
 
41
44
  - `pwn_burp_suite_pro_active_scan -t URL -o out/`
42
- - `pwn_burp_suite_pro_active_rest_api_scan` pure REST, no JVM spawn
45
+ - `pwn_burp_suite_pro_active_rest_api_scan` - pure REST, no JVM spawn
43
46
 
44
47
  ## Why preferred over ZAP
45
48
 
@@ -1,6 +1,6 @@
1
- # CLI Drivers `bin/pwn_*`
1
+ # CLI Drivers - `bin/pwn_*`
2
2
 
3
- 52 headless executables, each a thin `OptionParser` wrapper over one plugin
3
+ 53 headless executables, each a thin `OptionParser` wrapper over one plugin
4
4
  (or one workflow). They exist so CI/CD can call PWN without a REPL or an LLM.
5
5
 
6
6
  ![Driver anatomy](diagrams/driver-framework.svg)
@@ -26,19 +26,34 @@ pwn_crt_sh pwn_serial_check_voicemail
26
26
  pwn_defectdojo_engagement_create pwn_serial_msr206
27
27
  pwn_defectdojo_importscan pwn_serial_qualcomm_commands
28
28
  pwn_defectdojo_reimportscan pwn_serial_son_micro_sm132_rfid
29
- pwn_diff_csv_files_w_column_exclude pwn_shodan_graphql_introspection
30
- pwn_domain_reversewhois pwn_shodan_search
31
- pwn_fuzz_net_app_proto pwn_simple_http_server
32
- pwn_gqrx_scanner pwn_web_cache_deception
33
- pwn_jenkins_create_job pwn_www_checkip
34
- pwn_jenkins_create_view pwn_www_uri_buster
35
- pwn_jenkins_install_plugin pwn_xss_dom_vectors
36
- pwn_zaproxy_active_rest_api_scan
37
- pwn_zaproxy_active_scan
29
+ pwn_diff_csv_files_w_column_exclude pwn_setup
30
+ pwn_domain_reversewhois pwn_shodan_graphql_introspection
31
+ pwn_fuzz_net_app_proto pwn_shodan_search
32
+ pwn_gqrx_scanner pwn_simple_http_server
33
+ pwn_jenkins_create_job pwn_web_cache_deception
34
+ pwn_jenkins_create_view pwn_www_checkip
35
+ pwn_jenkins_install_plugin pwn_www_uri_buster
38
36
  ```
39
37
 
40
38
  Run any with `--help` for its flags.
41
39
 
40
+ ## `pwn_setup` - post-install doctor & capability provisioner
41
+
42
+ The one driver that isn't a plugin wrapper. It grows a bare `gem install pwn`
43
+ into a fully-armed host by installing OS headers / external tools for whatever
44
+ capability profile you ask for. Also reachable as `pwn setup` and
45
+ `pwn --setup[=PROFILE]`.
46
+
47
+ ```bash
48
+ pwn_setup # read-only doctor; exit 1 if degraded
49
+ pwn_setup --list-profiles
50
+ pwn_setup --profile web --yes # CI-friendly, non-interactive
51
+ pwn_setup --deps --dry-run # print the apt/dnf/pacman/brew/port commands only
52
+ ```
53
+
54
+ See [Installation](Installation.md) for the full profile table and
55
+ `PWN::Setup` API.
56
+
42
57
  ## Typical CI usage
43
58
 
44
59
  ```yaml
@@ -46,13 +61,15 @@ Run any with `--help` for its flags.
46
61
  sast:
47
62
  image: 0dayinc/pwn:latest
48
63
  script:
64
+ - pwn_setup --profile net --yes
65
+ - pwn_setup --check # gate: exit 1 if degraded
49
66
  - pwn_sast -d "$CI_PROJECT_DIR" -o sast_out/
50
67
  - pwn_defectdojo_importscan -f sast_out/report.json -e "$DD_ENGAGEMENT"
51
68
  ```
52
69
 
53
70
  ## Write your own
54
71
 
55
- See [Drivers](Drivers.md) copy any file in `bin/`, swap the plugin call,
72
+ See [Drivers](Drivers.md) - copy any file in `bin/`, swap the plugin call,
56
73
  `rake install`, done.
57
74
 
58
75
  [← Home](Home.md)