pwn 0.5.737 → 0.5.739

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +0 -1
  3. data/Gemfile +2 -2
  4. data/documentation/Agent-Tool-Registry.md +17 -3
  5. data/documentation/Diagrams.md +1 -1
  6. data/documentation/How-PWN-Works.md +1 -1
  7. data/documentation/Plugin-Degradation.md +74 -0
  8. data/documentation/Swarm.md +2 -3
  9. data/documentation/What-is-PWN.md +1 -1
  10. data/documentation/pwn-REPL.md +0 -1
  11. data/documentation/pwn-ai-Agent.md +1 -1
  12. data/etc/default_skills/browser-exploitation/SKILL.md +10 -0
  13. data/etc/default_skills/firmware-unpack-emulate/SKILL.md +10 -0
  14. data/etc/default_skills/heap-exploitation/SKILL.md +11 -0
  15. data/etc/default_skills/kernel-pwn-triage/SKILL.md +11 -0
  16. data/etc/default_skills/pwn/ai/agent/swarm/SKILL.md +1 -1
  17. data/etc/default_skills/pwn/ai/agent/tools/sbom_scan/SKILL.md +45 -0
  18. data/etc/default_skills/pwn/corpus/SKILL.md +52 -0
  19. data/etc/default_skills/pwn/corpus/references/urls.md +3 -0
  20. data/etc/default_skills/pwn/engagement/SKILL.md +55 -0
  21. data/etc/default_skills/pwn/plugins/debugger/SKILL.md +62 -0
  22. data/etc/default_skills/pwn/plugins/fuzz/SKILL.md +1 -0
  23. data/etc/default_skills/pwn/plugins/handler/SKILL.md +52 -0
  24. data/etc/default_skills/pwn/plugins/jobs/SKILL.md +1 -0
  25. data/etc/default_skills/pwn/plugins/mitm_proxy/SKILL.md +1 -0
  26. data/etc/default_skills/pwn/plugins/nmap_it/SKILL.md +1 -0
  27. data/etc/default_skills/pwn/plugins/packet/SKILL.md +1 -0
  28. data/etc/default_skills/pwn/plugins/process_tube/SKILL.md +2 -0
  29. data/etc/default_skills/pwn/plugins/redb/SKILL.md +52 -0
  30. data/etc/default_skills/pwn/plugins/sbom/SKILL.md +48 -0
  31. data/etc/default_skills/pwn/redaction/SKILL.md +1 -0
  32. data/etc/default_skills/rop-jop-chain-construction/SKILL.md +10 -0
  33. data/etc/default_skills/windows-internals-triage/SKILL.md +10 -0
  34. data/lib/pwn/ai/agent/loop.rb +80 -11
  35. data/lib/pwn/ai/agent/prompt_builder.rb +19 -1
  36. data/lib/pwn/ai/agent/registry.rb +34 -4
  37. data/lib/pwn/ai/agent/swarm.rb +4 -5
  38. data/lib/pwn/ai/agent/tool_guard.rb +11 -4
  39. data/lib/pwn/ai/agent/tools/fuzz_campaign.rb +2 -1
  40. data/lib/pwn/ai/agent/tools/job_run.rb +9 -3
  41. data/lib/pwn/ai/agent/tools/pty_session.rb +7 -1
  42. data/lib/pwn/ai/agent/tools/sbom_scan.rb +25 -0
  43. data/lib/pwn/ai/agent/tools/shell.rb +3 -2
  44. data/lib/pwn/ai/agent/tools/swarm.rb +3 -6
  45. data/lib/pwn/ai/agent/turn_finalizer.rb +2 -2
  46. data/lib/pwn/corpus.rb +107 -0
  47. data/lib/pwn/engagement.rb +158 -0
  48. data/lib/pwn/plugins/debugger.rb +284 -0
  49. data/lib/pwn/plugins/findings.rb +14 -3
  50. data/lib/pwn/plugins/fuzz.rb +62 -0
  51. data/lib/pwn/plugins/handler.rb +171 -0
  52. data/lib/pwn/plugins/jobs.rb +55 -0
  53. data/lib/pwn/plugins/mitm_proxy.rb +37 -2
  54. data/lib/pwn/plugins/nmap_it.rb +32 -0
  55. data/lib/pwn/plugins/packet.rb +18 -0
  56. data/lib/pwn/plugins/preflight_checker.rb +6 -2
  57. data/lib/pwn/plugins/process_tube.rb +99 -8
  58. data/lib/pwn/plugins/redb.rb +210 -0
  59. data/lib/pwn/plugins/repl.rb +0 -3
  60. data/lib/pwn/plugins/sbom.rb +145 -0
  61. data/lib/pwn/plugins.rb +4 -0
  62. data/lib/pwn/redaction.rb +53 -0
  63. data/lib/pwn/reports/engagement.rb +2 -1
  64. data/lib/pwn/sessions.rb +3 -1
  65. data/lib/pwn/version.rb +1 -1
  66. data/lib/pwn.rb +2 -0
  67. data/packer/provisioners/irc.sh +1 -1
  68. data/spec/lib/pwn/ai/agent/harness_2026_09_15_spec.rb +144 -0
  69. data/spec/lib/pwn/ai/agent/registry_spec.rb +50 -0
  70. data/spec/lib/pwn/ai/agent/tools/mcp_spec.rb +31 -0
  71. data/spec/lib/pwn/ai/agent/tools/sbom_scan_spec.rb +10 -0
  72. data/spec/lib/pwn/corpus_spec.rb +23 -0
  73. data/spec/lib/pwn/engagement_spec.rb +27 -0
  74. data/spec/lib/pwn/plugins/debugger_spec.rb +27 -0
  75. data/spec/lib/pwn/plugins/handler_spec.rb +25 -0
  76. data/spec/lib/pwn/plugins/redb_spec.rb +33 -0
  77. data/spec/lib/pwn/plugins/repl_spec.rb +7 -1
  78. data/spec/lib/pwn/plugins/sbom_spec.rb +22 -0
  79. data/third_party/pwn_rdoc.jsonl +97 -4
  80. metadata +36 -9
  81. data/etc/default_skills/pwn/plugins/repl/irc/SKILL.md +0 -47
  82. data/lib/pwn/plugins/repl/irc.rb +0 -153
  83. data/spec/lib/pwn/plugins/repl/irc_spec.rb +0 -21
@@ -1,47 +0,0 @@
1
- ---
2
- name: pwn-plugins-repl-irc
3
- description: Drive PWN::Plugins::REPL::IRC from pwn_eval.
4
- license: MIT
5
- allowed-tools: [pwn, pwn_eval]
6
- metadata:
7
- bundled: true
8
- generated: true
9
- module: PWN::Plugins::REPL::IRC
10
- source: pwn/plugins/repl/irc.rb
11
- ---
12
-
13
- # PWN::Plugins::REPL::IRC
14
-
15
- pwn-irc REPL mode.
16
-
17
- ## When to use
18
-
19
- Call `PWN::Plugins::REPL::IRC` from `pwn_eval` when the task needs this module.
20
- Do not reimplement it in shell.
21
-
22
- ## Methodologies
23
-
24
- Generated from `pwn/plugins/repl/irc.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::Plugins::REPL::IRC.help
31
- PWN::Plugins::REPL::IRC.add_commands(opts)
32
- ```
33
-
34
- ## Public methods
35
-
36
- - `add_commands`
37
- - `authors`
38
- - `help`
39
-
40
- ## Source
41
-
42
- `pwn/plugins/repl/irc.rb`
43
-
44
- ## Verification
45
-
46
- `PWN::Plugins::REPL::IRC.respond_to?(:add_commands)` after the
47
- module is loaded. Read the source for parameter names.
@@ -1,153 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'json'
4
- require 'pry'
5
-
6
- module PWN
7
- module Plugins
8
- module REPL
9
- # pwn-irc REPL mode.
10
- module IRC
11
- # Register Pry commands for this REPL mode.
12
- public_class_method def self.add_commands
13
- Pry::Commands.create_command 'pwn-irc' do
14
- description 'IRC viewport onto a PWN::AI::Agent::Swarm (deprecated as multi-agent transport).'
15
-
16
- # pwn-irc is now a THIN OBSERVER over PWN::AI::Agent::Swarm.
17
- # The old inspircd/weechat block spun up N text-only .chat bots
18
- # per nick — that bypassed tools, Memory, Skills, Learning,
19
- # Metrics and Extrospection. Multi-agent now lives in
20
- # PWN::AI::Agent::Swarm (agent_ask / agent_debate / agent_broadcast
21
- # from inside pwn-ai). This command just bridges a swarm's
22
- # bus.jsonl into an IRC channel so you can watch in weechat and
23
- # type `@red enumerate ports on 10.0.0.5` to route into Swarm.ask.
24
- def process
25
- host = '127.0.0.1'
26
- port = 6667
27
- chan = '#pwn'
28
-
29
- unless PWN::Plugins::Sock.check_port_in_use(server_ip: host, port: port)
30
- puts <<~MIGRATE
31
- pwn-irc is now an optional viewport onto PWN::AI::Agent::Swarm.
32
- Multi-agent no longer requires IRC:
33
-
34
- pwn-ai
35
- » agent_list
36
- » agent_debate(names: %w[red blue], topic: '...', rounds: 3)
37
-
38
- or from Ruby:
39
- PWN::AI::Agent::Swarm.debate(names: %w[red blue], topic: '...')
40
-
41
- Personas: #{PWN::AI::Agent::Swarm::AGENTS_FILE}
42
- Bus : ~/.pwn/swarm/<swarm_id>/bus.jsonl
43
-
44
- (Start inspircd on #{host}:#{port} if you still want the weechat view.)
45
- MIGRATE
46
- return
47
- end
48
-
49
- personas = PWN::AI::Agent::Swarm.personas
50
- if personas.empty?
51
- puts "No personas defined in #{PWN::AI::Agent::Swarm::AGENTS_FILE} — " \
52
- 'use PWN::AI::Agent::Swarm.spawn or agent_spawn from pwn-ai.'
53
- return
54
- end
55
-
56
- swarm = PWN::AI::Agent::Swarm.create(topic: 'pwn-irc bridge')
57
- sid = swarm[:swarm_id]
58
- bus = swarm[:bus]
59
- ui = ENV.fetch('USER', 'human')
60
- bridge = 'swarmbot'
61
-
62
- irc = PWN::Plugins::IRC.connect(host: host.to_s, port: port.to_s, nick: bridge)
63
- PWN::Plugins::IRC.join(irc_obj: irc, nick: bridge, chan: chan)
64
- PWN::Plugins::IRC.privmsg(
65
- irc_obj: irc, nick: bridge, chan: chan,
66
- message: "*** swarm #{sid} bridged | personas: #{personas.keys.join(', ')} " \
67
- "| say '@<persona> <request>' | tailing #{bus}"
68
- )
69
-
70
- # bus.jsonl → #pwn
71
- tailer = Thread.new do
72
- seen = File.exist?(bus) ? File.foreach(bus).count : 0
73
- loop do
74
- lines = File.exist?(bus) ? File.readlines(bus) : []
75
- lines[seen..].to_a.each do |l|
76
- m = JSON.parse(l, symbolize_names: true)
77
- PWN::Plugins::IRC.privmsg(
78
- irc_obj: irc, nick: bridge, chan: chan,
79
- message: "[#{m[:from]}→#{m[:to]}] #{m[:content].to_s.tr("\n", ' ')[0, 400]}"
80
- )
81
- rescue StandardError
82
- next
83
- end
84
- seen = lines.length
85
- sleep 1
86
- end
87
- end
88
-
89
- # #pwn '@persona ...' → Swarm.ask
90
- listener = Thread.new do
91
- PWN::Plugins::IRC.listen(irc_obj: irc) do |raw|
92
- next unless raw.to_s.split[1] == 'PRIVMSG'
93
-
94
- body = raw.to_s.split(' :', 2).last.to_s
95
- from = raw.to_s.split('!').first.to_s.delete_prefix(':')
96
- m = body.match(/@(\w+)\s+(.+)/)
97
- next unless m && personas.key?(m[1].to_sym)
98
-
99
- begin
100
- PWN::AI::Agent::Swarm.ask(
101
- name: m[1], request: m[2], swarm_id: sid, from: from
102
- )
103
- rescue StandardError => e
104
- PWN::Plugins::IRC.privmsg(
105
- irc_obj: irc, nick: bridge, chan: chan,
106
- message: "[error] #{m[1]}: #{e.class}: #{e.message[0, 200]}"
107
- )
108
- end
109
- end
110
- end
111
-
112
- if File.exist?('/usr/bin/weechat')
113
- cmds = [
114
- "/server add pwn #{host}/#{port} -notls", '/connect pwn',
115
- "/wait 3 /allserv /nick #{ui}", "/wait 4 /join -server pwn #{chan}"
116
- ].join(';')
117
- system('/usr/bin/weechat', '--run-command', "'#{cmds}'")
118
- else
119
- puts "Bridging swarm #{sid} on ##{chan} (weechat not found — use any IRC client). Ctrl-C to stop."
120
- listener.join
121
- end
122
- ensure
123
- tailer&.kill
124
- listener&.kill
125
- PWN::Plugins::IRC.quit(irc_obj: irc) if defined?(irc) && irc
126
- end
127
- end
128
- end
129
-
130
- # Author(s):: 0day Inc. <support@0dayinc.com>
131
-
132
- public_class_method def self.authors
133
- "AUTHOR(S):
134
- 0day Inc. <support@0dayinc.com>
135
- "
136
- end
137
-
138
- # Display usage for this module.
139
-
140
- public_class_method def self.help
141
- puts "USAGE:
142
- # Register the pwn-irc Pry command.
143
- #{self}.add_commands
144
-
145
- # Print the AUTHOR(S) string for this module.
146
- #{self}.authors
147
- "
148
- constants.sort
149
- end
150
- end
151
- end
152
- end
153
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe PWN::Plugins::REPL::IRC do
6
- it 'should display information for authors' do
7
- authors_response = PWN::Plugins::REPL::IRC
8
- expect(authors_response).to respond_to :authors
9
- end
10
-
11
- it 'should display information for existing help method' do
12
- help_response = PWN::Plugins::REPL::IRC
13
- expect(help_response).to respond_to :help
14
- end
15
-
16
- it 'registers the pwn-irc Pry command' do
17
- expect(described_class).to respond_to :add_commands
18
- described_class.add_commands
19
- expect(Pry::Commands.find_command('pwn-irc')).not_to be_nil
20
- end
21
- end