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
data/documentation/FFI.md CHANGED
@@ -1,4 +1,4 @@
1
- # `PWN::FFI` Native Calls for DSP & RF
1
+ # `PWN::FFI` - Native Calls for DSP & RF Front-Ends
2
2
 
3
3
  Thin `ffi`-gem bindings to **already-installed** system shared objects. Nothing
4
4
  is compiled at `gem install` time, nothing shells out. If a `.so` is missing the
@@ -7,21 +7,34 @@ pure Ruby.
7
7
 
8
8
  ```ruby
9
9
  PWN::FFI.backends
10
- # => {FFTW: true, HackRF: true, Liquid: true, RTLSdr: true, SoapySDR: true, Volk: true}
10
+ # => {AdalmPluto: true, FFTW: true, HackRF: true, Liquid: true,
11
+ # RTLSdr: true, SoapySDR: true, Volk: true}
11
12
 
12
13
  PWN::FFI.available?(mod: :Volk) # => true/false
13
14
  ```
14
15
 
16
+ ## Install the shared objects
17
+
18
+ ```bash
19
+ pwn setup --profile sdr # rtl-sdr, hackrf, libiio/libad9361, SoapySDR,
20
+ # libvolk, libliquid, libfftw3, libsndfile, libusb
21
+ ```
22
+
23
+ `pwn setup` (the [doctor](Installation.md)) reports each `PWN::FFI` backend
24
+ as `ok` / `MISSING` and knows the correct package name on `apt` / `dnf` /
25
+ `pacman` / `brew` / `port`.
26
+
15
27
  ## Modules (`lib/pwn/ffi/*.rb`)
16
28
 
17
29
  | Module | Shared object | Role |
18
30
  |---|---|---|
19
- | **`Volk`** | `libvolk` | SIMD kernels: s16f32 convert, accumulate, \|z\|², scale, dot-product. Backs `Decoder::DSP.unpack_s16le` / `rms_dbfs`. |
31
+ | **`Volk`** | `libvolk` | SIMD kernels: s16 to f32 convert, accumulate, \|z\|^2, scale, dot-product. Backs `Decoder::DSP.unpack_s16le` / `rms_dbfs`. |
20
32
  | **`Liquid`** | `libliquid` | liquid-dsp: `freqdem` (FM demod), `msresamp_rrrf` (arbitrary resample), Kaiser FIR, DC blocker. Backs `Decoder::DSP.resample` / `dc_block`. |
21
33
  | **`FFTW`** | `libfftw3f` | Single-precision FFTW3: real & complex 1-D FFTs, magnitude / power-dB helpers for spectrum work. |
22
- | **`HackRF`** | `libhackrf` | Control plane (init/open/tune/rate/gains) + device info for Extrospection `probe_rf` and wideband I/Q capture. |
23
- | **`RTLSdr`** | `librtlsdr` | Device list, tune, gain, blocking `read_sync` of raw u8 I/Q. |
24
- | **`SoapySDR`** | `libSoapySDR` | Enumerate every Soapy-backed front-end (RTL-SDR, HackRF, Airspy, Pluto, UHD, …); API/ABI/lib version. |
34
+ | **`RTLSdr`** | `librtlsdr` | Device list, open/tune/gain, blocking `read_sync` of raw cu8 I/Q. |
35
+ | **`HackRF`** | `libhackrf` | Open/tune/rate/gains + **callback RX streaming** (`start_rx`/`read_sync`/`stop_rx`/`capture`) of raw cs8 I/Q. |
36
+ | **`AdalmPluto`** | `libiio` (+ `libad9361`) | ADALM-Pluto (ad9361-phy). `open`/`configure`/`start_rx`/`read_sync`/`stop_rx`/`capture` of cs16 I/Q; USB or `ip:192.168.2.1`. |
37
+ | **`SoapySDR`** | `libSoapySDR` | Enumerate every Soapy-backed front-end (RTL-SDR, HackRF, Airspy, Pluto, LimeSDR, UHD, ...) **and** stream cs16 I/Q from any of them (`open`/`configure`/`start_rx`/`read_sync`/`stop_rx`/`close`). |
25
38
  | `Stdio` | `libc` | Classic `puts` / `printf` / `scanf` for shellcode / format-string research. |
26
39
 
27
40
  ## Design rules
@@ -29,11 +42,17 @@ PWN::FFI.available?(mod: :Volk) # => true/false
29
42
  1. **Thin & optional.** Attach a minimal surface; prefer high-level Ruby wrappers
30
43
  (`Liquid.freq_demod`, `Volk.unpack_s16le`) over raw C pointers in call sites.
31
44
  2. **No install-time compile.** Use the system package (`libvolk-dev`,
32
- `libliquid-dev`, `libfftw3-dev`, `libhackrf-dev`, ). On hosts without them
33
- every `.available?` is `false` and pure-Ruby paths keep working.
45
+ `libliquid-dev`, `libfftw3-dev`, `libhackrf-dev`, `libiio-dev`, ...). Install
46
+ them all with **`pwn setup --profile sdr`** (see [Installation](Installation.md)).
47
+ On hosts without them every `.available?` is `false` and pure-Ruby paths
48
+ keep working.
34
49
  3. **Namespace hygiene.** `PubFFI = ::FFI` (defined once in `lib/pwn/ffi.rb`)
35
- avoids the `PWN::FFI` `::FFI` collision when modules `extend PubFFI::Library`.
36
- 4. **Fallbacks in DSP.** `PWN::SDR::Decoder::DSP` probes `PWN::FFI.available?`
50
+ avoids the `PWN::FFI` vs `::FFI` collision when modules `extend PubFFI::Library`.
51
+ 4. **Uniform front-end contract.** Every hardware binding exposes the same
52
+ verbs: `available?`, `open`, `configure`, `start_rx`, `read_sync`, `stop_rx`,
53
+ `close`, plus a one-shot `capture` where practical. `Decoder::Base.run_iq`
54
+ only depends on that contract, not on any specific radio.
55
+ 5. **Fallbacks in DSP.** `PWN::SDR::Decoder::DSP` probes `PWN::FFI.available?`
37
56
  and rescues into pure Ruby. Toggle globally with
38
57
  `PWN::SDR::Decoder::DSP.native = false`.
39
58
 
@@ -50,29 +69,47 @@ audio = PWN::FFI::Liquid.freq_demod(iq: interleaved_iq, kf: 0.5)
50
69
  # Real FFT power spectrum
51
70
  db = PWN::FFI::FFTW.rfft_power_db(samples: audio, n: 4096)
52
71
 
53
- # RF inventory
72
+ # RF front-end inventory
54
73
  PWN::FFI::SoapySDR.list_devices
55
74
  PWN::FFI::HackRF.info
56
75
  PWN::FFI::RTLSdr.list_devices
76
+ PWN::FFI::AdalmPluto.list_uris
77
+
78
+ # Stream raw I/Q from ANY Soapy-backed device
79
+ h = PWN::FFI::SoapySDR.open(args: 'driver=rtlsdr')
80
+ PWN::FFI::SoapySDR.configure(handle: h, freq_hz: 929_612_500, rate_hz: 2_048_000)
81
+ PWN::FFI::SoapySDR.start_rx(handle: h)
82
+ data = PWN::FFI::SoapySDR.read_sync(handle: h) # cs16le interleaved I/Q
83
+ PWN::FFI::SoapySDR.close(handle: h)
84
+
85
+ # One-shot HackRF capture
86
+ iq = PWN::FFI::HackRF.capture(freq_hz: 1_090_000_000, rate_hz: 2_000_000, samples: 262_144)
57
87
  ```
58
88
 
59
- ## How this accelerates `PWN::SDR::Decoder::*`
89
+ ## True-air decode: how this drives `PWN::SDR::Decoder::*`
60
90
 
61
- Audio-rate protocols (POCSAG, FLEX, Morse, RTTY, APT, …) stay on the GQRX
62
- 48 kHz UDP tap and now automatically pick up VOLK/liquid for unpack + resample
63
- hot loops.
91
+ Every decoder module now has a **true over-the-air I/Q path** via
92
+ `PWN::SDR::Decoder::Base.run_iq`, which:
64
93
 
65
- Wideband protocols (ADS-B, GSM, LTE, LoRa, WiFi, …) still characterise bursts
66
- from the audio tap via `Base.run_detector`, but can graduate to true
67
- demodulation by:
94
+ 1. Calls `Base.resolve_iq_source(source: :auto)` to pick the first working
95
+ front-end in order `:file` -> `:rtlsdr` -> `:adalm_pluto` -> `:hackrf` ->
96
+ `:soapy` (or a forced `:source`).
97
+ 2. Streams raw I/Q via the uniform `read_sync` contract above.
98
+ 3. Unpacks (`cu8`/`cs8`/`cs16`) and either hands complex samples to
99
+ `demod#feed_iq(iq, rate:)` or FM-demodulates first and calls
100
+ `demod#feed(audio)` for narrowband protocols.
101
+ 4. Emits the same JSONL-logged Hash frames every decoder already produces.
102
+ 5. Falls back to `Base.run_detector` (energy characterizer) when no hardware
103
+ or capture file is present, so the operator still gets structured output.
68
104
 
69
- 1. Opening a front-end via `PWN::FFI::RTLSdr` / `HackRF` / `SoapySDR`
70
- 2. Reading raw I/Q
71
- 3. Running native DSP (`Liquid.freq_demod`, `FFTW.rfft`, VOLK magnitude)
72
- 4. Emitting the same Hash frames decoders already JSONL-log
105
+ | Decoder | Air path | I/Q entry point |
106
+ |---|---|---|
107
+ | ADSB, Bluetooth, DECT, GPS, GSM, Iridium, LoRa, LTE, P25, RFID, RTL433, WiFi, ZigBee | `run_iq` (wideband) | `#feed_iq(iq, rate:)` |
108
+ | APT, FLEX, Morse, Pager, POCSAG, RTTY | `run_iq(fm_demod: true)` or `run_native` (GQRX 48 kHz UDP) | `#feed(audio)` |
109
+ | RDS | GQRX built-in RDS decoder (`RDS.sample`) | n/a |
73
110
 
74
111
  No decoder shells out; Ruby remains the orchestrator.
75
112
 
76
- **See also:** [SDR](SDR.md) · [Hardware](Hardware.md)
113
+ **See also:** [SDR](SDR.md) - [Hardware](Hardware.md)
77
114
 
78
- [ Home](Home.md)
115
+ [<- Home](Home.md)
@@ -1,7 +1,10 @@
1
- # Fuzzing `PWN::Plugins::Fuzz` · `Sock` · `Packet`
1
+ # Fuzzing - `PWN::Plugins::Fuzz` · `Sock` · `Packet`
2
2
 
3
3
  ![Fuzzing workflow](diagrams/fuzzing-workflow.svg)
4
4
 
5
+ > **Install:** `pwn setup --profile net` - pcaprub headers · tshark ·
6
+ > tcpdump. See [Installation](Installation.md).
7
+
5
8
  ## Generate
6
9
 
7
10
  ```ruby
@@ -1,4 +1,4 @@
1
- # General Usage Day-One Cheat Sheet
1
+ # General Usage - Day-One Cheat Sheet
2
2
 
3
3
  ## Launch
4
4
 
@@ -8,12 +8,23 @@ $ pwn --ai "scan 10.0.0.0/24 with NmapIt and summarise open services"
8
8
  $ pwn_nmap_discover_tcp_udp -t 10.0.0.0/24 -o out/ # headless driver
9
9
  ```
10
10
 
11
+ ## Check / provision this host
12
+
13
+ ```bash
14
+ $ pwn setup # doctor: which PWN:: capabilities are usable here?
15
+ $ pwn setup --profile web # install what TransparentBrowser / Burp / ZAP need
16
+ $ pwn setup --list-profiles # core · ai · web · net · db · sdr · vision · voice · exploit · hardware · full
17
+ ```
18
+
19
+ See [Installation](Installation.md) for every flag and the `PWN::Setup` API.
20
+
11
21
  ## Inside the REPL
12
22
 
13
23
  ```ruby
14
24
  PWN.help # top-level help
15
25
  PWN::Plugins.constants.sort # list all 66 plugins
16
26
  PWN::Plugins::NmapIt.help # per-plugin usage
27
+ PWN::Setup.check # capability doctor from inside the REPL
17
28
  ls PWN::Plugins::BurpSuite # Pry: list methods
18
29
  show-source PWN::SAST::SQL.scan # Pry: read the code
19
30
  history # what you've typed → copy into a driver
@@ -25,6 +36,7 @@ history # what you've typed → copy into a driver
25
36
  |---|---|
26
37
  | `pwn-ai` | Enter the agent TUI (SHIFT+ENTER = newline, ENTER = submit) |
27
38
  | `pwn-asm` | Multi-line assembly ↔ opcode workbench |
39
+ | `pwn-vault` | Decrypt → edit `~/.pwn/pwn.yaml` in `$EDITOR` → re-encrypt |
28
40
  | `pwn-ai-memory` | Inspect / edit `~/.pwn/memory.json` |
29
41
  | `pwn-ai-sessions` | List / view / delete transcripts |
30
42
  | `pwn-ai-cron` | List / run scheduled jobs |
@@ -3,11 +3,15 @@
3
3
  ![Hardware hacking](diagrams/hardware-hacking.svg)
4
4
  ![Reverse engineering](diagrams/reverse-engineering-flow.svg)
5
5
 
6
+ > **Install:** `pwn setup --profile hardware` - libusb · adb · baresip
7
+ > (Serial · BusPirate · Android · BareSIP · `extro_serial` ·
8
+ > `extro_telecomm`). See [Installation](Installation.md).
9
+
6
10
  ## Serial / Bus
7
11
 
8
12
  | Module | Use |
9
13
  |---|---|
10
- | `PWN::Plugins::Serial` | Generic UART (`/dev/ttyUSB*`) read/write, baud detect |
14
+ | `PWN::Plugins::Serial` | Generic UART (`/dev/ttyUSB*`) - read/write, baud detect |
11
15
  | `PWN::Plugins::BusPirate` | SPI/I²C/1-Wire via Bus Pirate |
12
16
  | `PWN::Plugins::MSR206` | ISO magstripe read/write (tracks 1-3) |
13
17
 
@@ -16,7 +20,7 @@ CLI: `pwn_serial_msr206`, `pwn_serial_qualcomm_commands`,
16
20
 
17
21
  ## Mobile
18
22
 
19
- `PWN::Plugins::Android` `adb_net_connect`, `adb_sh`, `adb_push/pull`,
23
+ `PWN::Plugins::Android` - `adb_net_connect`, `adb_sh`, `adb_push/pull`,
20
24
  `take_screenshot`, `screen_record`, `list_installed_apps`, `dumpsys`,
21
25
  `open_app`, `find_hidden_codes`, `swipe`, `input`, `input_special`,
22
26
  `invoke_event_listener`. CLI war-dialer: `pwn_android_war_dialer`.
@@ -28,13 +32,13 @@ CLI: `pwn_phone`.
28
32
 
29
33
  ## Radio
30
34
 
31
- See [SDR](SDR.md) GQRX, FlipperZero, RFIDler, SonMicro.
35
+ See [SDR](SDR.md) - GQRX, FlipperZero, RFIDler, SonMicro.
32
36
 
33
37
  ## Binary / RE
34
38
 
35
- - `PWN::Plugins::XXD` hex dump / patch
36
- - `PWN::Plugins::Assembly` + `pwn-asm` REPL opcodes ↔ asm, multi-arch
37
- - `PWN::Plugins::BlackDuckBinaryAnalysis` SBOM + CVE match on firmware
38
- - [`PWN::FFI`](FFI.md) call libc from Ruby
39
+ - `PWN::Plugins::XXD` - hex dump / patch
40
+ - `PWN::Plugins::Assembly` + `pwn-asm` REPL - opcodes ↔ asm, multi-arch
41
+ - `PWN::Plugins::BlackDuckBinaryAnalysis` - SBOM + CVE match on firmware
42
+ - [`PWN::FFI`](FFI.md) - call libc from Ruby
39
43
 
40
44
  [← Home](Home.md) · [SDR](SDR.md) · [FFI](FFI.md)
@@ -1,8 +1,8 @@
1
1
  # PWN Documentation
2
2
 
3
- > **PWN** (/pōn/) an open-source offensive-security automation framework and
3
+ > **PWN** (/pōn/) - an open-source offensive-security automation framework and
4
4
  > continuous-security-integration platform written in Ruby.
5
- > 66 plugins · 48 SAST rules · 90 AWS wrappers · 21 WWW drivers · 52 CLI
5
+ > 66 plugins · 48 SAST rules · 90 AWS wrappers · 21 WWW drivers · 53 CLI
6
6
  > drivers · 5 LLM engines · a self-improving multi-agent AI · one REPL.
7
7
 
8
8
  **Repo root:** `/opt/pwn` · **This wiki:** `/opt/pwn/documentation/` ·
@@ -15,11 +15,11 @@
15
15
  | | |
16
16
  |---|---|
17
17
  | [What is PWN](What-is-PWN.md) | One-paragraph elevator pitch |
18
- | [Why PWN](Why-PWN.md) | Design philosophy why another framework |
18
+ | [Why PWN](Why-PWN.md) | Design philosophy - why another framework |
19
19
  | [How PWN Works](How-PWN-Works.md) | The five layers, with the architecture diagram |
20
- | [Installation](Installation.md) | RVM, gem, `./install.sh`, first launch |
20
+ | [Installation](Installation.md) | `gem install pwn` `pwn setup` doctor/provisioner · capability profiles |
21
21
  | [General Usage](General-PWN-Usage.md) | Day-one cheat sheet |
22
- | [Configuration](Configuration.md) | `~/.pwn/config.yml` engines, keys, agent options |
22
+ | [Configuration](Configuration.md) | `~/.pwn/pwn.yaml` (encrypted) - engines, keys, agent options · `pwn-vault` |
23
23
  | **[All Data-Flow Diagrams](Diagrams.md)** | **27 SVGs** in one scrollable page |
24
24
 
25
25
  ## 🚪 Entry Points
@@ -28,7 +28,7 @@
28
28
  |---|---|
29
29
  | [The `pwn` REPL](pwn-REPL.md) | Pry shell with the whole `PWN::` namespace pre-loaded |
30
30
  | [`pwn-ai` Autonomous Agent](pwn-ai-Agent.md) | Natural-language TUI + `pwn --ai PROMPT` one-shot |
31
- | [CLI Drivers `bin/pwn_*`](CLI-Drivers.md) | 52 headless executables for CI/CD |
31
+ | [CLI Drivers `bin/pwn_*`](CLI-Drivers.md) | 53 headless executables for CI/CD |
32
32
  | [Drivers (build your own)](Drivers.md) | Turn a REPL session into a shipped binary |
33
33
 
34
34
  ## 🤖 AI Subsystem (`PWN::AI`)
@@ -37,9 +37,9 @@
37
37
  |---|---|
38
38
  | [AI / LLM Integration](AI-Integration.md) | OpenAI · Anthropic · Grok (OAuth) · Gemini · Ollama |
39
39
  | [Agent Tool Registry](Agent-Tool-Registry.md) | 10 toolsets · 61 LLM-callable tools |
40
- | [Memory · Skills · Learning](Skills-Memory-Learning.md) | Introspection the self-improvement loop |
41
- | [Mistakes](Mistakes.md) | **Negative feedback** fingerprint failures · do-NOT-repeat · `[REPEATING]`/`[REGRESSED]` · inline self-correction |
42
- | [Extrospection](Extrospection.md) | World-awareness snapshot · drift · intel · **watch** · **verify** · **rf_tune** · correlate · **rf** · **web** |
40
+ | [Memory · Skills · Learning](Skills-Memory-Learning.md) | Introspection - the self-improvement loop |
41
+ | [Mistakes](Mistakes.md) | **Negative feedback** - fingerprint failures · do-NOT-repeat · `[REPEATING]`/`[REGRESSED]` · inline self-correction |
42
+ | [Extrospection](Extrospection.md) | World-awareness - snapshot · drift · intel · **watch** · **verify** · **rf_tune** · correlate · **rf** · **web** |
43
43
  | [Swarm (Multi-Agent)](Swarm.md) | Personas · ask · debate · broadcast · shared bus |
44
44
  | [Sessions](Sessions.md) | Transcript persistence + reflection |
45
45
  | [Cron](Cron.md) | Scheduled autonomous jobs |
@@ -6,23 +6,24 @@ below have no criss-crossing lines.
6
6
 
7
7
  ![Overall Architecture](diagrams/overall-pwn-architecture.svg)
8
8
 
9
- ## L0 Actors
9
+ ## L0 - Actors
10
10
 
11
- Humans (`pwn` REPL, `pwn-ai` TUI), CI runners (`pwn --ai ""`, `bin/pwn_*`),
11
+ Humans (`pwn` REPL, `pwn-ai` TUI), CI runners (`pwn --ai "..."`, `bin/pwn_*`),
12
12
  LLM providers (over HTTPS), and targets (hosts, web apps, clouds, radios,
13
13
  hardware).
14
14
 
15
- ## L1 Entry points (`bin/`)
15
+ ## L1 - Entry points (`bin/`)
16
16
 
17
17
  | Entry | File | Purpose |
18
18
  |---|---|---|
19
19
  | `pwn` REPL | `lib/pwn/plugins/repl.rb` | Pry with `PWN::` pre-loaded + custom commands |
20
20
  | `pwn-ai` | `lib/pwn/ai/agent/loop.rb` | Agent TUI inside the REPL |
21
21
  | `pwn --ai PROMPT` | `bin/pwn` | Headless one-shot agent (CI-friendly) |
22
- | `bin/pwn_*` | 52 files | Thin OptionParser wrappers over one plugin each |
22
+ | `pwn setup` | `lib/pwn/setup.rb` · `bin/pwn_setup` | Post-install doctor + capability provisioner (also `pwn --setup[=PROFILE]`) |
23
+ | `bin/pwn_*` | 53 files | Thin OptionParser wrappers over one plugin each |
23
24
  | `PWN::Cron` | `lib/pwn/cron.rb` | Scheduled jobs → any of the above |
24
25
 
25
- ## L2 AI agent core (`lib/pwn/ai/agent/`)
26
+ ## L2 - AI agent core (`lib/pwn/ai/agent/`)
26
27
 
27
28
  | Module | Role |
28
29
  |---|---|
@@ -30,21 +31,21 @@ hardware).
30
31
  | `Registry` | JSON-Schema function definitions grouped into 10 **toolsets** · 61 tools |
31
32
  | `Dispatch` / `Result` | execute a tool, capture stdout/value/error/duration |
32
33
  | `PromptBuilder` | inject MEMORY / SKILLS / LEARNING / **KNOWN MISTAKES + FIXES** / METRICS / EXTROSPECTION blocks |
33
- | `Metrics` · `Learning` | **introspection** how well am I doing? |
34
- | `Mistakes` | **negative feedback** fingerprint failures, do NOT repeat, `[REPEATING]`/`[REGRESSED]`, inline `correction_hint` |
35
- | `Extrospection` | **extrospection** on-demand world sensing (`intel` · **`verify`** · **`watch`** · **`rf_tune`**) + ambient baseline (host · net · toolchain · repo · env · **rf** · **web**) joined to introspection via `correlate` |
34
+ | `Metrics` · `Learning` | **introspection** - how well am I doing? |
35
+ | `Mistakes` | **negative feedback** - fingerprint failures, do NOT repeat, `[REPEATING]`/`[REGRESSED]`, inline `correction_hint` |
36
+ | `Extrospection` | **extrospection** - on-demand world sensing (`intel` · **`verify`** · **`watch`** · **`rf_tune`**) + ambient baseline (host · net · toolchain · repo · env · **rf** · **web**) joined to introspection via `correlate` |
36
37
  | `Swarm` | multi-agent personas over a shared JSONL bus |
37
38
 
38
39
  See [Agent Tool Registry](Agent-Tool-Registry.md) for every tool the LLM can call.
39
40
 
40
- ## L3 Capability namespaces (`lib/pwn/*`)
41
+ ## L3 - Capability namespaces (`lib/pwn/*`)
41
42
 
42
43
  `Plugins` (66) · `SAST` (48) · `WWW` (21) · `AWS` (90) · `SDR` · `Blockchain` ·
43
44
  `Bounty` · `Reports` · `FFI` · `Banner`. Each is a plain module of
44
- `public_class_method def self.x(opts = {})` methods callable identically from
45
+ `public_class_method def self.x(opts = {})` methods - callable identically from
45
46
  the REPL, from `pwn_eval`, or from a driver.
46
47
 
47
- ## L4 Persistence (`~/.pwn/`)
48
+ ## L4 - Persistence (`~/.pwn/`)
48
49
 
49
50
  Everything the framework remembers between processes lives in one directory:
50
51
 
@@ -54,7 +55,7 @@ See [Persistence](Persistence.md) for the byte-level layout of each file.
54
55
 
55
56
  ## The feedback loop
56
57
 
57
- The reason L2 exists is to close this loop on every turn successes
58
+ The reason L2 exists is to close this loop on every turn - successes
58
59
  become skills/lessons, **failures become fingerprinted mistakes with fixes**,
59
60
  **world-state is sensed on demand** (`extro_verify` / `extro_watch` /
60
61
  `extro_rf_tune` / `extro_osint` / `extro_serial` / `extro_telecomm` / `extro_packet` / `extro_vision` / `extro_voice` / `extro_intel`) and correlated against those failures, and
@@ -1,73 +1,237 @@
1
1
  # Installation
2
2
 
3
- PWN is tested on **Debian-based Linux** (Kali, Ubuntu) and **macOS**, using
4
- Ruby via **RVM**.
3
+ PWN ships as a **single Ruby gem** whose runtime is 100 % `autoload`ed -
4
+ a plugin whose native extension or OS binary is missing costs nothing until
5
+ you actually touch that constant. That means the install is **two steps**:
6
+
7
+ ```bash
8
+ gem install pwn # 1. get the gem (pure-Ruby core always works)
9
+ pwn setup # 2. doctor + provision this host's capabilities
10
+ ```
11
+
12
+ `pwn setup` is the built-in **doctor / provisioner** (`PWN::Setup`). It
13
+ detects your OS package manager (`apt` · `dnf` · `pacman` · `brew` · `port`),
14
+ reports which `PWN::` capabilities are usable on *this* host, and - when
15
+ asked - installs exactly the OS headers, external tools, and native gems
16
+ needed to unlock the ones you want. No `/opt/pwn` checkout, no `rvmsudo`
17
+ chain, no bash provisioners required.
18
+
19
+ Tested on **Kali / Debian / Ubuntu**, **Fedora**, **Arch**, and **macOS**
20
+ (Homebrew or MacPorts). Ruby ≥ 3.4 (RVM, rbenv, asdf, or system Ruby).
21
+
22
+ ---
5
23
 
6
24
  ## Quick install (recommended)
7
25
 
8
26
  ```bash
9
- cd /opt
10
- sudo git clone https://github.com/0dayinc/pwn
11
- cd /opt/pwn
12
- ./install.sh # system deps (nmap, chromium, graphviz, …)
13
- ./install.sh ruby-gem # rvm gemset + bundle install + rake install
14
- pwn # launch the REPL
27
+ gem install pwn
28
+ pwn setup # read-only doctor: what's usable, what's missing
29
+ pwn setup --profile full --yes # install everything for every PWN:: namespace
30
+ pwn # launch the REPL
31
+ ```
32
+
33
+ ```text
34
+ pwn[v0.5.628]:001 >>> PWN.help
35
+ ```
36
+
37
+ If you only need a subset (e.g. web testing on a CI runner, SDR on a lab
38
+ box), install just that **capability profile** - see below.
39
+
40
+ ---
41
+
42
+ ## `pwn setup` - the post-install doctor & provisioner
43
+
44
+ Three equivalent spellings ship with the gem:
45
+
46
+ | Invocation | Same as |
47
+ |---|---|
48
+ | `pwn setup [opts]` | bare-word subcommand of `bin/pwn` |
49
+ | `pwn_setup [opts]` | standalone driver (`bin/pwn_setup`) |
50
+ | `pwn --setup[=PROFILE]` | flag form; no `PROFILE` = check, `PROFILE` = deps |
51
+
52
+ ### Read-only doctor (default)
53
+
54
+ ```bash
55
+ $ pwn setup # or: pwn setup --check / pwn --setup / pwn_setup
56
+ ```
57
+
58
+ Prints a per-capability report and **exits non-zero if anything is degraded**
59
+ (so you can gate CI on it):
60
+
61
+ ```text
62
+ PWN v0.5.628 · ruby 4.0.5 · linux x86_64 · pkg-manager: apt
63
+
64
+ ~/.pwn/ ok (11 entries)
65
+ ~/.pwn/pwn.yaml ok (encrypted, decryptor present)
66
+ AI engine ok anthropic (key set)
67
+
68
+ Ruby extensions
69
+ pg MISSING (needs: postgresql-server-dev-all) → PWN::Plugins::DAOPostgres
70
+ pcaprub ok → PWN::Plugins::Packet, extro_packet
71
+ nokogiri ok → PWN::Plugins::TransparentBrowser, PWN::WWW
72
+ ...
73
+
74
+ External toolchain used by
75
+ nmap ok /usr/bin/nmap PWN::Plugins::NmapIt
76
+ gqrx MISSING PWN::SDR, extro_rf_tune
77
+ ...
78
+
79
+ 31 / 36 capabilities usable · 5 degraded
80
+
81
+ Run `pwn setup --deps` to install missing OS headers/tools, or
82
+ `pwn setup --profile <name>` for a subset. See `pwn setup --list-profiles`.
83
+ ```
84
+
85
+ ### Install dependencies
86
+
87
+ ```bash
88
+ pwn setup --deps # profile :full - everything
89
+ pwn setup --profile web # just TransparentBrowser · Burp · ZAP · Tor
90
+ pwn setup --profile sdr --yes # non-interactive (CI / packer / docker)
91
+ pwn setup --profile net --dry-run # print the apt/dnf/brew/... commands only
92
+ pwn setup --list-profiles
15
93
  ```
16
94
 
95
+ `--deps` / `--profile` will:
96
+
97
+ 1. Resolve the profile → set of native gems + external binaries.
98
+ 2. Map those to OS packages for **your** package manager (data lives in
99
+ `PWN::Setup::NATIVE_GEMS` / `::TOOLCHAIN` - versioned with the gem, so
100
+ `gem install pwn`, git checkout, Docker, Packer and Vagrant all read the
101
+ same table).
102
+ 3. Show the exact commands, prompt (unless `--yes`), run them, then
103
+ `gem pristine` / `gem install` any native extension that still fails to
104
+ load, and re-run the doctor.
105
+
106
+ ### Capability profiles
107
+
108
+ `pwn setup --list-profiles` (source of truth: `PWN::Setup::PROFILES`)
109
+
110
+ | Profile | Unlocks |
111
+ |---|---|
112
+ | `core` | `~/.pwn` bootstrap · vault · REPL - always applied |
113
+ | `ai` | verify at least one AI engine key/oauth in `~/.pwn/pwn.yaml` |
114
+ | `web` | `TransparentBrowser` · `BurpSuite` · `Zaproxy` · `extro_verify` · `extro_watch` · `sqlmap` · `tor` |
115
+ | `net` | `NmapIt` · `Packet` · `extro_packet` · `extro_osint` · `tshark`/`tcpdump` |
116
+ | `db` | `DAOPostgres` · `DAOSqlite3` · `DAOMongo` |
117
+ | `sdr` | `PWN::SDR` · GQRX · `PWN::FFI` DSP backends · `extro_rf_tune` · rtl-sdr / hackrf / SoapySDR |
118
+ | `vision` | `OCR` · `ScannableCodes` · `Reports` · `extro_vision` · tesseract / zbar / graphviz |
119
+ | `voice` | `PWN::Plugins::Voice` · `extro_voice` · espeak-ng / sox |
120
+ | `exploit` | `Metasploit` · `sqlmap` |
121
+ | `hardware` | `Serial` · `BusPirate` · `Android` · `BareSIP` · `extro_serial` · `extro_telecomm` |
122
+ | `full` | everything above |
123
+
124
+ ### All flags
125
+
17
126
  ```text
18
- pwn[v0.5.616]:001 >>> PWN.help
127
+ pwn setup [--check] [--deps] [--profile NAME] [--list-profiles]
128
+ [--yes] [--dry-run]
19
129
  ```
20
130
 
21
- ## Gem-only install
131
+ | Flag | Meaning |
132
+ |---|---|
133
+ | *(none)* / `-c`, `--check` | Read-only doctor. Exit 1 if any capability degraded. |
134
+ | `-d`, `--deps` | Install OS packages + rebuild native gems for `--profile` (default `full`). |
135
+ | `-p`, `--profile NAME` | One of the profiles above. Implies `--deps`. |
136
+ | `-l`, `--list-profiles` | Print profile table and exit. |
137
+ | `-y`, `--yes` | Assume yes; non-interactive (CI / Docker / Packer). |
138
+ | `-n`, `--dry-run` | Print the commands that *would* run, do nothing. |
139
+
140
+ ---
141
+
142
+ ## From a git checkout (contributors)
22
143
 
23
144
  ```bash
24
- rvm install ruby-4.0.5
25
- rvm use ruby-4.0.5@pwn --create
26
- gem install --verbose pwn
27
- pwn
145
+ git clone https://github.com/0dayinc/pwn /opt/pwn
146
+ cd /opt/pwn
147
+ bundle install
148
+ rake install # or: rvmsudo rake install (multi-user RVM)
149
+ pwn setup --profile full --yes # same provisioner, same data tables
28
150
  ```
29
151
 
152
+ The legacy `./install.sh` / `packer/provisioners/pwn.sh` bash paths still
153
+ work, but they now simply delegate to `pwn setup` - the `case $os` package
154
+ lists have been consolidated into `PWN::Setup::NATIVE_GEMS` / `::TOOLCHAIN`.
155
+
156
+ ---
157
+
158
+ ## Docker / Packer / Vagrant / CI
159
+
160
+ `pwn setup` is the single provisioning entry point for every image builder:
161
+
162
+ ```dockerfile
163
+ FROM kalilinux/kali-rolling
164
+ RUN gem install pwn && pwn setup --profile full --yes
165
+ ```
166
+
167
+ ```yaml
168
+ # .gitlab-ci.yml - fail the job if the runner is missing a capability
169
+ before_script:
170
+ - pwn setup --profile web --yes
171
+ - pwn setup --check
172
+ ```
173
+
174
+ ```bash
175
+ # packer / vagrant provisioner
176
+ pwn setup --profile ${PWN_PROFILE:-full} --yes
177
+ ```
178
+
179
+ ---
180
+
30
181
  ## Upgrading
31
182
 
32
183
  ```bash
33
- rvm use ruby-4.0.5@pwn
34
- gem uninstall --all --executables pwn
35
- gem install --verbose pwn
184
+ gem update pwn # or: gem uninstall --all --executables pwn && gem install pwn
185
+ pwn setup # re-doctor - new versions may add capabilities
36
186
  ```
37
187
 
38
- or from a checkout:
188
+ From a checkout:
39
189
 
40
190
  ```bash
41
- cd /opt/pwn && git pull && rvmsudo rake install
191
+ cd /opt/pwn && git pull && rake install && pwn setup
42
192
  ```
43
193
 
194
+ ---
195
+
44
196
  ## First-run configuration
45
197
 
46
- `pwn` creates `~/.pwn/` on first launch. Add at least one LLM engine to
47
- `~/.pwn/config.yml` to enable `pwn-ai` see [Configuration](Configuration.md).
198
+ The first `pwn` launch creates `~/.pwn/` and an **encrypted**
199
+ `~/.pwn/pwn.yaml` template. Add at least one LLM engine key with the
200
+ `pwn-vault` REPL command to enable `pwn-ai` - see
201
+ [Configuration](Configuration.md). `pwn setup` will report the AI-engine
202
+ row as `MISSING` until a key is set.
48
203
 
49
- ## Optional external tools
204
+ ---
50
205
 
51
- PWN wraps these when present on `$PATH`; none are hard requirements:
206
+ ## Programmatic API - `PWN::Setup`
52
207
 
53
- | Tool | Used by |
54
- |---|---|
55
- | `nmap` | `PWN::Plugins::NmapIt` |
56
- | Burp Suite Pro (+ REST API) | `PWN::Plugins::BurpSuite` |
57
- | `msfconsole` / msfrpcd | `PWN::Plugins::Metasploit` |
58
- | `chromium` / `google-chrome` | `PWN::Plugins::TransparentBrowser` |
59
- | `zaproxy` | `PWN::Plugins::Zaproxy` (fallback) |
60
- | `gqrx` | `PWN::SDR::GQRX` |
61
- | `adb` | `PWN::Plugins::Android` |
62
- | `graphviz` (`dot`) | rebuilding these diagrams |
63
- | `tor` | `PWN::Plugins::Tor` |
208
+ Everything above is a thin CLI over one autoloaded module:
209
+
210
+ ```ruby
211
+ PWN::Setup.check # { ok:, native_gems_missing:, toolchain_missing:, pkg_manager:, os:, arch: }
212
+ PWN::Setup.deps(profile: :web, yes: true) # install, then re-check
213
+ PWN::Setup.list_profiles
214
+ PWN::Setup.pkg_manager # { key: :apt, install: 'sudo apt-get install -y', sudo: true }
215
+
216
+ # The data tables - single source of truth, versioned with the gem:
217
+ PWN::Setup::NATIVE_GEMS # native ext → { apt:, dnf:, pacman:, brew:, port:, plugins: }
218
+ PWN::Setup::TOOLCHAIN # external bin → { apt:, dnf:, pacman:, brew:, port:, plugins: }
219
+ PWN::Setup::PROFILES # profile → { desc:, gems:, bins: }
220
+ ```
221
+
222
+ Adding a new native dependency or wrapped binary? Add **one row** to the
223
+ appropriate constant in `lib/pwn/setup.rb` - every install path (gem, git,
224
+ Docker, Packer, Vagrant, CI) picks it up automatically.
225
+
226
+ ---
64
227
 
65
228
  ## Verify
66
229
 
67
230
  ```ruby
68
- pwn[v0.5.616]:001 >>> PWN::Plugins.constants.count # => 66
69
- pwn[v0.5.616]:002 >>> PWN::SAST.constants.count # => 48
70
- pwn[v0.5.616]:003 >>> pwn-ai # launches agent TUI
231
+ pwn[v0.5.628]:001 >>> PWN::Setup.check[:ok] # => true
232
+ pwn[v0.5.628]:002 >>> PWN::Plugins.constants.count # => 66
233
+ pwn[v0.5.628]:003 >>> PWN::SAST.constants.count # => 48
234
+ pwn[v0.5.628]:004 >>> pwn-ai # launches agent TUI
71
235
  ```
72
236
 
73
237
  **Next:** [Configuration](Configuration.md) · [General Usage](General-PWN-Usage.md)
@@ -1,20 +1,23 @@
1
1
  # `PWN::Plugins::Metasploit`
2
2
 
3
- RPC client for `msfrpcd` search modules, set options, run exploits, interact
3
+ RPC client for `msfrpcd` - search modules, set options, run exploits, interact
4
4
  with sessions, all from Ruby.
5
5
 
6
+ > **Install:** `pwn setup --profile exploit` - metasploit-framework ·
7
+ > sqlmap. See [Installation](Installation.md).
8
+
6
9
  ## Configure
7
10
 
8
11
  ```yaml
9
- # ~/.pwn/config.yml
12
+ # ~/.pwn/pwn.yaml (edit via `pwn-vault`)
10
13
  metasploit:
11
14
  host: 127.0.0.1
12
15
  port: 55553
13
16
  user: msf
14
- pass:
17
+ pass: ...
15
18
  ```
16
19
 
17
- Start the daemon: `msfrpcd -U msf -P -a 127.0.0.1 -p 55553 -S`
20
+ Start the daemon: `msfrpcd -U msf -P ... -a 127.0.0.1 -p 55553 -S`
18
21
 
19
22
  ## Use
20
23