pwn 0.5.451 → 0.5.454
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +10 -5
- data/Gemfile +6 -11
- data/README.md +3 -3
- data/bin/pwn +4 -15
- data/bin/pwn_android_war_dialer +1 -10
- data/bin/pwn_aws_describe_resources +1 -10
- data/bin/pwn_bdba_groups +1 -10
- data/bin/pwn_bdba_scan +1 -10
- data/bin/pwn_burp_suite_pro_active_rest_api_scan +1 -10
- data/bin/pwn_burp_suite_pro_active_scan +1 -10
- data/bin/pwn_char_base64_encoding +1 -10
- data/bin/pwn_char_dec_encoding +1 -10
- data/bin/pwn_char_hex_escaped_encoding +1 -10
- data/bin/pwn_char_html_entity_encoding +1 -10
- data/bin/pwn_char_unicode_escaped_encoding +1 -10
- data/bin/pwn_char_url_encoding +1 -10
- data/bin/pwn_crt_sh +1 -10
- data/bin/pwn_defectdojo_engagement_create +1 -10
- data/bin/pwn_defectdojo_importscan +1 -10
- data/bin/pwn_defectdojo_reimportscan +1 -10
- data/bin/pwn_diff_csv_files_w_column_exclude +1 -6
- data/bin/pwn_domain_reversewhois +1 -10
- data/bin/pwn_fuzz_net_app_proto +1 -10
- data/bin/pwn_gqrx_scanner +1 -10
- data/bin/pwn_jenkins_create_job +1 -10
- data/bin/pwn_jenkins_create_view +1 -10
- data/bin/pwn_jenkins_install_plugin +1 -10
- data/bin/pwn_jenkins_thinBackup_aws_s3 +1 -10
- data/bin/pwn_jenkins_update_plugins +1 -10
- data/bin/pwn_jenkins_useradd +1 -10
- data/bin/pwn_mail_agent +1 -10
- data/bin/pwn_nessus_cloud_scan_crud +1 -10
- data/bin/pwn_nessus_cloud_vulnscan +1 -10
- data/bin/pwn_nexpose +1 -10
- data/bin/pwn_nmap_discover_tcp_udp +1 -10
- data/bin/pwn_openvas_vulnscan +1 -10
- data/bin/pwn_pastebin_sample_filter +1 -10
- data/bin/pwn_phone +1 -10
- data/bin/pwn_rdoc_to_jsonl +5 -7
- data/bin/pwn_sast +1 -25
- data/bin/pwn_serial_check_voicemail +1 -10
- data/bin/pwn_serial_msr206 +4 -6
- data/bin/pwn_serial_son_micro_sm132_rfid +4 -6
- data/bin/pwn_shodan_graphql_introspection +1 -6
- data/bin/pwn_shodan_search +1 -10
- data/bin/pwn_simple_http_server +4 -5
- data/bin/pwn_web_cache_deception +1 -10
- data/bin/pwn_www_checkip +7 -5
- data/bin/pwn_www_uri_buster +1 -10
- data/bin/pwn_xss_dom_vectors +1 -10
- data/bin/pwn_zaproxy_active_rest_api_scan +1 -10
- data/bin/pwn_zaproxy_active_scan +1 -10
- data/find_latest_gem_versions_per_Gemfile.sh +3 -0
- data/lib/pwn/ai/grok.rb +20 -38
- data/lib/pwn/ai/introspection.rb +44 -44
- data/lib/pwn/ai/ollama.rb +21 -38
- data/lib/pwn/ai/open_ai.rb +20 -149
- data/lib/pwn/blockchain/btc.rb +4 -4
- data/lib/pwn/config.rb +90 -43
- data/lib/pwn/driver.rb +85 -0
- data/lib/pwn/plugins/assembly.rb +14 -3
- data/lib/pwn/plugins/repl.rb +15 -77
- data/lib/pwn/plugins/transparent_browser.rb +320 -141
- data/lib/pwn/reports/sast.rb +1 -54
- data/lib/pwn/sast/pom_version.rb +8 -14
- data/lib/pwn/sast/test_case_engine.rb +8 -15
- data/lib/pwn/version.rb +1 -1
- data/lib/pwn.rb +5 -4
- data/spec/lib/pwn/driver_spec.rb +15 -0
- data/third_party/pwn_rdoc.jsonl +29 -25
- metadata +41 -13
- data/etc/pwn.decryptor.yaml.EXAMPLE +0 -5
- data/etc/pwn.yaml.EXAMPLE +0 -70
data/lib/pwn/config.rb
CHANGED
|
@@ -7,8 +7,44 @@ module PWN
|
|
|
7
7
|
# Used to manage PWN configuration settings within PWN drivers.
|
|
8
8
|
module Config
|
|
9
9
|
# Supported Method Parameters::
|
|
10
|
-
#
|
|
11
|
-
|
|
10
|
+
# PWN::Config.redact_sensitive_artifacts(
|
|
11
|
+
# config: 'optional - Hash to redact sensitive artifacts from. Defaults to PWN::Env'
|
|
12
|
+
# )
|
|
13
|
+
public_class_method def self.redact_sensitive_artifacts(opts = {})
|
|
14
|
+
config = opts[:config] ||= PWN::Env
|
|
15
|
+
|
|
16
|
+
sensitive_keys = %i[api_key key paswword psks token]
|
|
17
|
+
|
|
18
|
+
# Transform values at the current level: redact sensitive keys
|
|
19
|
+
config.transform_values.with_index do |v, k|
|
|
20
|
+
if sensitive_keys.include?(config.keys[k])
|
|
21
|
+
'>>> REDACTED >>> USE `pwn-vault` FOR ADMINISTRATION <<< REDACTED <<<'
|
|
22
|
+
else
|
|
23
|
+
v.is_a?(Hash) ? redact_sensitive_artifacts(config: v) : v
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
rescue StandardError => e
|
|
27
|
+
raise e
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Supported Method Parameters::
|
|
31
|
+
# env = PWN::Config.init_driver_options
|
|
32
|
+
public_class_method def self.init_driver_options
|
|
33
|
+
env = {
|
|
34
|
+
driver_opts: {
|
|
35
|
+
pwn_env_path: nil,
|
|
36
|
+
pwn_dec_path: nil
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
PWN.const_set(:Env, env)
|
|
40
|
+
# puts '[*] Loaded driver options.'
|
|
41
|
+
rescue StandardError => e
|
|
42
|
+
raise e
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Supported Method Parameters::
|
|
46
|
+
# env = PWN::Config.default_env
|
|
47
|
+
public_class_method def self.default_env(opts = {})
|
|
12
48
|
pwn_env_path = opts[:pwn_env_path]
|
|
13
49
|
pwn_dec_path = "#{File.dirname(pwn_env_path)}/pwn.decryptor.yaml"
|
|
14
50
|
|
|
@@ -50,45 +86,47 @@ module PWN
|
|
|
50
86
|
temp: 'optional - Ollama temperature'
|
|
51
87
|
}
|
|
52
88
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
irc: {
|
|
63
|
-
ui_nick: '_human_',
|
|
64
|
-
shared_chan: '#pwn',
|
|
65
|
-
ai_agent_nicks: {
|
|
66
|
-
browser: {
|
|
67
|
-
pwn_rb: '/opt/pwn/lib/pwn/plugins/transparent_browser.rb',
|
|
68
|
-
system_role_content: 'You are a browser. You are a web browser that can be controlled by a human or AI agent'
|
|
69
|
-
},
|
|
70
|
-
nimjeh: {
|
|
71
|
-
pwn_rb: '',
|
|
72
|
-
system_role_content: 'You are a sarcastic hacker. You find software zero day vulnerabilities. This involves analyzing source code, race conditions, application binaries, and network protocols from an offensive security perspective.'
|
|
73
|
-
},
|
|
74
|
-
nmap: {
|
|
75
|
-
pwn_rb: '/opt/pwn/lib/pwn/plugins/nmap_it.rb',
|
|
76
|
-
system_role_content: 'You are a network scanner. You are a network scanner that can be controlled by a human or AI agent'
|
|
77
|
-
},
|
|
78
|
-
shodan: {
|
|
79
|
-
pwn_rb: '/opt/pwn/lib/pwn/plugins/shodan.rb',
|
|
80
|
-
system_role_content: 'You are a passive reconnaissance agent. You are a passive reconnaissance agent that can be controlled by a human or AI agent'
|
|
89
|
+
plugins: {
|
|
90
|
+
asm: { arch: PWN::Plugins::DetectOS.arch, endian: PWN::Plugins::DetectOS.endian },
|
|
91
|
+
blockchain: {
|
|
92
|
+
bitcoin: {
|
|
93
|
+
rpc_host: 'localhost',
|
|
94
|
+
rpc_port: 8332,
|
|
95
|
+
rpc_user: 'bitcoin RPC Username',
|
|
96
|
+
rpc_pass: 'bitcoin RPC Password'
|
|
81
97
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
},
|
|
99
|
+
irc: {
|
|
100
|
+
ui_nick: '_human_',
|
|
101
|
+
shared_chan: '#pwn',
|
|
102
|
+
ai_agent_nicks: {
|
|
103
|
+
browser: {
|
|
104
|
+
pwn_rb: '/opt/pwn/lib/pwn/plugins/transparent_browser.rb',
|
|
105
|
+
system_role_content: 'You are a browser. You are a web browser that can be controlled by a human or AI agent'
|
|
106
|
+
},
|
|
107
|
+
nimjeh: {
|
|
108
|
+
pwn_rb: '',
|
|
109
|
+
system_role_content: 'You are a sarcastic hacker. You find software zero day vulnerabilities. This involves analyzing source code, race conditions, application binaries, and network protocols from an offensive security perspective.'
|
|
110
|
+
},
|
|
111
|
+
nmap: {
|
|
112
|
+
pwn_rb: '/opt/pwn/lib/pwn/plugins/nmap_it.rb',
|
|
113
|
+
system_role_content: 'You are a network scanner. You are a network scanner that can be controlled by a human or AI agent'
|
|
114
|
+
},
|
|
115
|
+
shodan: {
|
|
116
|
+
pwn_rb: '/opt/pwn/lib/pwn/plugins/shodan.rb',
|
|
117
|
+
system_role_content: 'You are a passive reconnaissance agent. You are a passive reconnaissance agent that can be controlled by a human or AI agent'
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
hunter: { api_key: 'hunter.how API Key' },
|
|
122
|
+
meshtastic: {
|
|
123
|
+
psks: {
|
|
124
|
+
LongFast: 'AQ==',
|
|
125
|
+
PWN: 'required - PSK for pwn channel'
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
shodan: { api_key: 'SHODAN API Key' }
|
|
129
|
+
}
|
|
92
130
|
}
|
|
93
131
|
# Remove beginning colon from key names
|
|
94
132
|
yaml_env = YAML.dump(env).gsub(/^(\s*):/, '\1')
|
|
@@ -122,7 +160,7 @@ module PWN
|
|
|
122
160
|
FileUtils.mkdir_p(pwn_env_root)
|
|
123
161
|
|
|
124
162
|
pwn_env_path = opts[:pwn_env_path] ||= "#{pwn_env_root}/pwn.yaml"
|
|
125
|
-
return
|
|
163
|
+
return default_env(pwn_env_path: pwn_env_path) unless File.exist?(pwn_env_path)
|
|
126
164
|
|
|
127
165
|
is_encrypted = PWN::Plugins::Vault.file_encrypted?(file: pwn_env_path)
|
|
128
166
|
|
|
@@ -183,9 +221,18 @@ module PWN
|
|
|
183
221
|
pwn_dec_path: pwn_dec_path
|
|
184
222
|
}
|
|
185
223
|
|
|
186
|
-
|
|
224
|
+
# Assign the refreshed env to PWN::Env
|
|
187
225
|
PWN.send(:remove_const, :Env) if PWN.const_defined?(:Env)
|
|
188
226
|
PWN.const_set(:Env, env.freeze)
|
|
227
|
+
|
|
228
|
+
# Redact sensitive artifacts from PWN::Env and store in PWN::EnvRedacted
|
|
229
|
+
env_redacted = redact_sensitive_artifacts(config: env)
|
|
230
|
+
PWN.send(:remove_const, :EnvRedacted) if PWN.const_defined?(:EnvRedacted)
|
|
231
|
+
PWN.const_set(:EnvRedacted, env_redacted.freeze)
|
|
232
|
+
|
|
233
|
+
Pry.config.refresh_pwn_env = false if defined?(Pry)
|
|
234
|
+
|
|
235
|
+
puts "[*] PWN::Env loaded via: #{pwn_env_path}\n"
|
|
189
236
|
rescue StandardError => e
|
|
190
237
|
raise e
|
|
191
238
|
end
|
|
@@ -202,7 +249,7 @@ module PWN
|
|
|
202
249
|
|
|
203
250
|
public_class_method def self.help
|
|
204
251
|
puts "USAGE:
|
|
205
|
-
#{self}.
|
|
252
|
+
#{self}.default_env(
|
|
206
253
|
pwn_env_path: 'optional - Path to pwn.yaml file. Defaults to ~/.pwn/pwn.yaml'
|
|
207
254
|
)
|
|
208
255
|
|
data/lib/pwn/driver.rb
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'optparse'
|
|
4
|
+
|
|
5
|
+
module PWN
|
|
6
|
+
# Used to consume options passed into PWN drivers and load PWN::Env
|
|
7
|
+
class Driver
|
|
8
|
+
# Add OptionParser options to PWN::Env
|
|
9
|
+
class Parser < OptionParser
|
|
10
|
+
attr_accessor :auto_opts_help,
|
|
11
|
+
:opts
|
|
12
|
+
|
|
13
|
+
def initialize
|
|
14
|
+
super
|
|
15
|
+
@opts = PWN::Env[:driver_opts]
|
|
16
|
+
@auto_opts_help = true
|
|
17
|
+
|
|
18
|
+
banner = "USAGE: #{File.basename($PROGRAM_NAME)} [opts]\n"
|
|
19
|
+
on(
|
|
20
|
+
'-YPATH',
|
|
21
|
+
'--pwn_env=PATH',
|
|
22
|
+
'<Optional - PWN::Env YAML file path (Default: ~/.pwn/pwn.yaml)>'
|
|
23
|
+
) do |o|
|
|
24
|
+
@opts[:pwn_env_path] = o
|
|
25
|
+
end
|
|
26
|
+
on(
|
|
27
|
+
'-ZPATH',
|
|
28
|
+
'--pwn_dec=PATH',
|
|
29
|
+
'<Optional - Out-of-Band YAML file path (Default: ~/.pwn/pwn.decryptor.yaml)>'
|
|
30
|
+
) do |o|
|
|
31
|
+
@opts[:pwn_dec_path] = o
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def parse!
|
|
36
|
+
super(ARGV, into: @opts)
|
|
37
|
+
# puts @opts
|
|
38
|
+
|
|
39
|
+
PWN::Config.refresh_env(
|
|
40
|
+
pwn_env_path: @opts[:pwn_env_path],
|
|
41
|
+
pwn_dec_path: @opts[:pwn_dec_path]
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
if @auto_opts_help && @opts.keys.join(' ') == 'pwn_env_path pwn_dec_path'
|
|
45
|
+
puts `#{File.basename($PROGRAM_NAME)} --help`
|
|
46
|
+
exit 1
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Author(s):: 0day Inc. <support@0dayinc.com>
|
|
52
|
+
|
|
53
|
+
public_class_method def self.authors
|
|
54
|
+
"AUTHOR(S):
|
|
55
|
+
0day Inc. <support@0dayinc.com>
|
|
56
|
+
"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Display Usage for this Module
|
|
60
|
+
|
|
61
|
+
public_class_method def self.help
|
|
62
|
+
puts "USAGE:
|
|
63
|
+
# Load default driver options into PWN::Env
|
|
64
|
+
opts = PWN::Env[:driver_opts]
|
|
65
|
+
#{self}::Parser.new.parse(&:on).parse!
|
|
66
|
+
|
|
67
|
+
# Add more options by passing a block to the parser
|
|
68
|
+
opts = PWN::Env[:driver_opts]
|
|
69
|
+
#{self}::Parser.new do |options|
|
|
70
|
+
# Boolean option
|
|
71
|
+
options.on('-b', '--boolean') do |o|
|
|
72
|
+
opts[:boolean] = o
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# String option
|
|
76
|
+
options.on('-sSTRING', '--string=STRING') do |o|
|
|
77
|
+
opts[:string] = o
|
|
78
|
+
end
|
|
79
|
+
end.parse!
|
|
80
|
+
|
|
81
|
+
#{self}.authors
|
|
82
|
+
"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
data/lib/pwn/plugins/assembly.rb
CHANGED
|
@@ -25,6 +25,12 @@ module PWN
|
|
|
25
25
|
|
|
26
26
|
raise 'ERROR: opcodes parameter is required.' if opcodes.nil?
|
|
27
27
|
|
|
28
|
+
system_role_content = "Analyze the #{endian} endian #{arch} assembly opcodes below and provide a concise summary of their functionality."
|
|
29
|
+
ai_analysis = PWN::AI::Introspection.reflect_on(
|
|
30
|
+
request: opcodes,
|
|
31
|
+
system_role_content: system_role_content
|
|
32
|
+
)
|
|
33
|
+
|
|
28
34
|
case arch.to_s.downcase
|
|
29
35
|
when 'i386', 'i686', 'x86'
|
|
30
36
|
arch_obj = Metasm::Ia32.new(endian)
|
|
@@ -109,7 +115,7 @@ module PWN
|
|
|
109
115
|
opcodes = [opcodes].pack('H*')
|
|
110
116
|
# puts opcodes.inspect
|
|
111
117
|
|
|
112
|
-
Metasm::Shellcode.disassemble(arch_obj, opcodes).to_s.squeeze("\n")
|
|
118
|
+
"#{ai_analysis}\n\n* Assembly Instructions >>>#{Metasm::Shellcode.disassemble(arch_obj, opcodes).to_s.squeeze("\n")}\n"
|
|
113
119
|
rescue StandardError => e
|
|
114
120
|
raise e
|
|
115
121
|
end
|
|
@@ -131,6 +137,12 @@ module PWN
|
|
|
131
137
|
|
|
132
138
|
raise 'ERROR: asm parameter is required.' if asm.nil?
|
|
133
139
|
|
|
140
|
+
system_role_content = "Analyze the #{endian} endian #{arch} assembly instructions below and provide a concise summary of their functionality."
|
|
141
|
+
ai_analysis = PWN::AI::Introspection.reflect_on(
|
|
142
|
+
request: asm,
|
|
143
|
+
system_role_content: system_role_content
|
|
144
|
+
)
|
|
145
|
+
|
|
134
146
|
case arch.to_s.downcase
|
|
135
147
|
when 'i386', 'i686', 'x86'
|
|
136
148
|
arch_obj = Metasm::Ia32.new(endian)
|
|
@@ -175,9 +187,8 @@ module PWN
|
|
|
175
187
|
end
|
|
176
188
|
|
|
177
189
|
opcodes = Metasm::Shellcode.assemble(arch_obj, asm).encode_string
|
|
178
|
-
hex_encoded_opcodes = opcodes.bytes.map { |b| format('\x%02x', b) }.join
|
|
179
190
|
|
|
180
|
-
"\n#{
|
|
191
|
+
"#{ai_analysis}\n\n* Hex-Escaped Opcodes >>>\n#{opcodes.bytes.map { |b| format('\x%02x', b) }.join}\n"
|
|
181
192
|
rescue Metasm::ParseError
|
|
182
193
|
puts "Invalid assembly instruction(s) provided:\n#{asm}"
|
|
183
194
|
# Should we try to call opcode_to_asm here or just raise the error?
|
data/lib/pwn/plugins/repl.rb
CHANGED
|
@@ -34,8 +34,8 @@ module PWN
|
|
|
34
34
|
dchars = "\001\e[33m\002***\001\e[0m\002" if mode == :splat
|
|
35
35
|
|
|
36
36
|
if pi.config.pwn_asm
|
|
37
|
-
arch = PWN::Env[:asm][:arch] ||= PWN::Plugins::DetectOS.arch
|
|
38
|
-
endian = PWN::Env[:asm][:endian] ||= PWN::Plugins::DetectOS.endian
|
|
37
|
+
arch = PWN::Env[:plugins][:asm][:arch] ||= PWN::Plugins::DetectOS.arch
|
|
38
|
+
endian = PWN::Env[:plugins][:asm][:endian] ||= PWN::Plugins::DetectOS.endian
|
|
39
39
|
|
|
40
40
|
pi.config.prompt_name = "pwn.asm:#{arch}/#{endian}"
|
|
41
41
|
name = "\001\e[1m\002\001\e[37m\002#{pi.config.prompt_name}\001\e[0m\002"
|
|
@@ -173,10 +173,10 @@ module PWN
|
|
|
173
173
|
|
|
174
174
|
reply = nil
|
|
175
175
|
response_history = nil
|
|
176
|
-
shared_chan = PWN::Env[:irc][:shared_chan]
|
|
176
|
+
shared_chan = PWN::Env[:plugins][:irc][:shared_chan]
|
|
177
177
|
mem_chan = '#mem'
|
|
178
|
-
ai_agents = PWN::Env[:irc][:ai_agent_nicks]
|
|
179
|
-
ai_agents_arr = PWN::Env[:irc][:ai_agent_nicks].keys
|
|
178
|
+
ai_agents = PWN::Env[:plugins][:irc][:ai_agent_nicks]
|
|
179
|
+
ai_agents_arr = PWN::Env[:plugins][:irc][:ai_agent_nicks].keys
|
|
180
180
|
total_ai_agents = ai_agents_arr.length
|
|
181
181
|
mutex = Mutex.new
|
|
182
182
|
PWN::Plugins::ThreadPool.fill(
|
|
@@ -303,11 +303,6 @@ module PWN
|
|
|
303
303
|
|
|
304
304
|
response_history = ai_agents[dm_agent.to_sym][:response_history]
|
|
305
305
|
engine = PWN::Env[:ai][:active].to_s.downcase.to_sym
|
|
306
|
-
base_uri = PWN::Env[:ai][engine][:base_uri]
|
|
307
|
-
key = PWN::Env[:ai][engine][:key] ||= ''
|
|
308
|
-
temp = PWN::Env[:ai][engine][:temp]
|
|
309
|
-
model = PWN::Env[:ai][engine][:model]
|
|
310
|
-
system_role_content = PWN::Env[:ai][engine][:system_role_content]
|
|
311
306
|
|
|
312
307
|
users_in_chan = PWN::Plugins::IRC.names(
|
|
313
308
|
irc_obj: irc_obj,
|
|
@@ -319,55 +314,21 @@ module PWN
|
|
|
319
314
|
chan: shared_chan
|
|
320
315
|
)
|
|
321
316
|
|
|
322
|
-
system_role_content = "
|
|
323
|
-
#{system_role_content}
|
|
324
|
-
You joined the IRC channel #{shared_chan}
|
|
325
|
-
with the following users: #{users_in_shared_chan}
|
|
326
|
-
"
|
|
327
|
-
|
|
328
|
-
system_role_content = "
|
|
329
|
-
#{system_role_content}
|
|
330
|
-
You also joined your own IRC channel #{chan}
|
|
331
|
-
with the following users: #{users_in_chan}
|
|
332
|
-
"
|
|
333
|
-
|
|
334
|
-
system_role_content = "
|
|
335
|
-
#{system_role_content}
|
|
336
|
-
You can dm/collaborate/speak with users to
|
|
337
|
-
achieve your goals using '@<nick>' in your
|
|
338
|
-
message.
|
|
339
|
-
"
|
|
340
|
-
|
|
341
317
|
case engine
|
|
342
318
|
when :grok
|
|
343
319
|
response = PWN::AI::Grok.chat(
|
|
344
|
-
base_uri: base_uri,
|
|
345
|
-
token: key,
|
|
346
|
-
model: model,
|
|
347
|
-
temp: temp,
|
|
348
|
-
system_role_content: system_role_content,
|
|
349
320
|
request: request,
|
|
350
321
|
response_history: response_history,
|
|
351
322
|
spinner: false
|
|
352
323
|
)
|
|
353
324
|
when :ollama
|
|
354
325
|
response = PWN::AI::Ollama.chat(
|
|
355
|
-
base_uri: base_uri,
|
|
356
|
-
token: key,
|
|
357
|
-
model: model,
|
|
358
|
-
temp: temp,
|
|
359
|
-
system_role_content: system_role_content,
|
|
360
326
|
request: request,
|
|
361
327
|
response_history: response_history,
|
|
362
328
|
spinner: false
|
|
363
329
|
)
|
|
364
330
|
when :openai
|
|
365
331
|
response = PWN::AI::OpenAI.chat(
|
|
366
|
-
base_uri: base_uri,
|
|
367
|
-
token: key,
|
|
368
|
-
model: model,
|
|
369
|
-
temp: temp,
|
|
370
|
-
system_role_content: system_role_content,
|
|
371
332
|
request: request,
|
|
372
333
|
response_history: response_history,
|
|
373
334
|
spinner: false
|
|
@@ -431,7 +392,7 @@ module PWN
|
|
|
431
392
|
|
|
432
393
|
# TODO: Use TLS for IRC Connections
|
|
433
394
|
# Use an IRC nCurses CLI Client
|
|
434
|
-
ui_nick = PWN::Env[:irc][:ui_nick]
|
|
395
|
+
ui_nick = PWN::Env[:plugins][:irc][:ui_nick]
|
|
435
396
|
join_channels = ai_agents_arr.map { |ai_chan| "##{ai_chan}" }.join(',')
|
|
436
397
|
|
|
437
398
|
cmd0 = "/server add pwn #{host}/#{port} -notls"
|
|
@@ -528,6 +489,7 @@ module PWN
|
|
|
528
489
|
# Define REPL Hooks
|
|
529
490
|
# Welcome Banner Hook
|
|
530
491
|
Pry.config.hooks.add_hook(:before_session, :welcome) do |output, _binding, _pi|
|
|
492
|
+
Pry.config.refresh_pwn_env = false
|
|
531
493
|
output.puts PWN::Banner.welcome
|
|
532
494
|
end
|
|
533
495
|
|
|
@@ -535,8 +497,8 @@ module PWN
|
|
|
535
497
|
if pi.config.pwn_asm && !request.chomp.empty?
|
|
536
498
|
request = pi.input.line_buffer
|
|
537
499
|
|
|
538
|
-
arch = PWN::Env[:asm][:arch]
|
|
539
|
-
endian = PWN::Env[:asm][:endian]
|
|
500
|
+
arch = PWN::Env[:plugins][:asm][:arch]
|
|
501
|
+
endian = PWN::Env[:plugins][:asm][:endian]
|
|
540
502
|
|
|
541
503
|
# Analyze request to determine if it should be processed as opcodes or asm.
|
|
542
504
|
straight_hex = /^[a-fA-F0-9\s]+$/
|
|
@@ -573,22 +535,12 @@ module PWN
|
|
|
573
535
|
request = pi.input.line_buffer.to_s
|
|
574
536
|
debug = pi.config.pwn_ai_debug
|
|
575
537
|
engine = PWN::Env[:ai][:active].to_s.downcase.to_sym
|
|
576
|
-
base_uri = PWN::Env[:ai][engine][:base_uri]
|
|
577
|
-
key = PWN::Env[:ai][engine][:key] ||= ''
|
|
578
538
|
response_history = PWN::Env[:ai][engine][:response_history]
|
|
579
539
|
speak_answer = pi.config.pwn_ai_speak
|
|
580
|
-
model = PWN::Env[:ai][engine][:model]
|
|
581
|
-
system_role_content = PWN::Env[:ai][engine][:system_role_content]
|
|
582
|
-
temp = PWN::Env[:ai][engine][:temp]
|
|
583
540
|
|
|
584
541
|
case engine
|
|
585
542
|
when :grok
|
|
586
543
|
response = PWN::AI::Grok.chat(
|
|
587
|
-
base_uri: base_uri,
|
|
588
|
-
token: key,
|
|
589
|
-
model: model,
|
|
590
|
-
system_role_content: system_role_content,
|
|
591
|
-
temp: temp,
|
|
592
544
|
request: request.chomp,
|
|
593
545
|
response_history: response_history,
|
|
594
546
|
speak_answer: speak_answer,
|
|
@@ -596,11 +548,6 @@ module PWN
|
|
|
596
548
|
)
|
|
597
549
|
when :ollama
|
|
598
550
|
response = PWN::AI::Ollama.chat(
|
|
599
|
-
base_uri: base_uri,
|
|
600
|
-
token: key,
|
|
601
|
-
model: model,
|
|
602
|
-
system_role_content: system_role_content,
|
|
603
|
-
temp: temp,
|
|
604
551
|
request: request.chomp,
|
|
605
552
|
response_history: response_history,
|
|
606
553
|
speak_answer: speak_answer,
|
|
@@ -608,11 +555,6 @@ module PWN
|
|
|
608
555
|
)
|
|
609
556
|
when :openai
|
|
610
557
|
response = PWN::AI::OpenAI.chat(
|
|
611
|
-
base_uri: base_uri,
|
|
612
|
-
token: key,
|
|
613
|
-
model: model,
|
|
614
|
-
system_role_content: system_role_content,
|
|
615
|
-
temp: temp,
|
|
616
558
|
request: request.chomp,
|
|
617
559
|
response_history: response_history,
|
|
618
560
|
speak_answer: speak_answer,
|
|
@@ -656,11 +598,11 @@ module PWN
|
|
|
656
598
|
end
|
|
657
599
|
|
|
658
600
|
# Supported Method Parameters::
|
|
659
|
-
# PWN::Plugins::REPL.start
|
|
660
|
-
|
|
661
|
-
|
|
601
|
+
# PWN::Plugins::REPL.start
|
|
602
|
+
|
|
603
|
+
public_class_method def self.start
|
|
604
|
+
opts = PWN::Env[:driver_opts]
|
|
662
605
|
|
|
663
|
-
public_class_method def self.start(opts = {})
|
|
664
606
|
# Monkey Patch Pry, add commands, && hooks
|
|
665
607
|
PWN::Plugins::MonkeyPatch.pry
|
|
666
608
|
pwn_env_root = "#{Dir.home}/.pwn"
|
|
@@ -705,13 +647,9 @@ module PWN
|
|
|
705
647
|
|
|
706
648
|
#{self}.add_commands
|
|
707
649
|
|
|
708
|
-
#{self}.add_hooks
|
|
709
|
-
opts: 'required - Hash object passed in via pwn OptParser'
|
|
710
|
-
)
|
|
650
|
+
#{self}.add_hooks
|
|
711
651
|
|
|
712
|
-
#{self}.start
|
|
713
|
-
opts: 'required - Hash object passed in via pwn OptParser'
|
|
714
|
-
)
|
|
652
|
+
#{self}.start
|
|
715
653
|
|
|
716
654
|
#{self}.authors
|
|
717
655
|
"
|