pwn 0.5.421 → 0.5.422
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/README.md +3 -3
- data/lib/pwn/plugins/repl.rb +2 -92
- data/lib/pwn/plugins/vault.rb +97 -2
- data/lib/pwn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fda4003c5c2b625faae80ac66aa29bd12a7a450e3dc9259cb2d5d82e1d71716
|
4
|
+
data.tar.gz: 758acc86bc80e1dc4038ee14314025d163fa63d1682bd1cd9c9c2a184332d059
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8db71ed909971e84ce91cc04d3922de9a194c3b2179be7eb56f53ff47ae3e0c1624731cc6ca430ecad984f262968b89fd81146a0ac01e14f20e0b2e6a2b7f802
|
7
|
+
data.tar.gz: cb1af569edffd8ec983ddb9118b64cf0fc63a0e814de86adc35cfd8d5e39d38427b49228a9cb313c8dab2f393d9d15da6efae94cbc0b6eecdd043fd2f2600386
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ $ cd /opt/pwn
|
|
37
37
|
$ ./install.sh
|
38
38
|
$ ./install.sh ruby-gem
|
39
39
|
$ pwn
|
40
|
-
pwn[v0.5.
|
40
|
+
pwn[v0.5.422]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.4.4@pwn
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
53
53
|
$ gem install --verbose pwn
|
54
54
|
$ pwn
|
55
|
-
pwn[v0.5.
|
55
|
+
pwn[v0.5.422]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
If you're using a multi-user install of RVM do:
|
@@ -62,7 +62,7 @@ $ rvm use ruby-3.4.4@pwn
|
|
62
62
|
$ rvmsudo gem uninstall --all --executables pwn
|
63
63
|
$ rvmsudo gem install --verbose pwn
|
64
64
|
$ pwn
|
65
|
-
pwn[v0.5.
|
65
|
+
pwn[v0.5.422]:001 >>> PWN.help
|
66
66
|
```
|
67
67
|
|
68
68
|
PWN periodically upgrades to the latest version of Ruby which is reflected in `/opt/pwn/.ruby-version`. The easiest way to upgrade to the latest version of Ruby from a previous PWN installation is to run the following script:
|
data/lib/pwn/plugins/repl.rb
CHANGED
@@ -8,96 +8,6 @@ module PWN
|
|
8
8
|
module Plugins
|
9
9
|
# This module contains methods related to the pwn REPL Driver.
|
10
10
|
module REPL
|
11
|
-
# Supported Method Parameters::
|
12
|
-
# PWN::Plugins::REPL.load_config(
|
13
|
-
# pi: 'required - Pry Instance object',
|
14
|
-
# yaml_config_path: 'required - full path to pwn.yaml file',
|
15
|
-
# decryption_file: 'optional - full path to decryption YAML file'
|
16
|
-
# )
|
17
|
-
public_class_method def self.load_config(opts = {})
|
18
|
-
yaml_config_path = opts[:yaml_config_path]
|
19
|
-
|
20
|
-
return false unless yaml_config_path
|
21
|
-
|
22
|
-
pi = opts[:pi] ||= Pry
|
23
|
-
raise "ERROR: #{yaml_config_path} does not exist." unless File.exist?(yaml_config_path)
|
24
|
-
|
25
|
-
is_encrypted = PWN::Plugins::Vault.file_encrypted?(file: yaml_config_path)
|
26
|
-
|
27
|
-
if is_encrypted
|
28
|
-
# TODO: Implement "something you know, something you have, && something you are?"
|
29
|
-
decryption_file = opts[:decryption_file] ||= "#{Dir.home}/pwn.decryptor.yaml"
|
30
|
-
raise "ERROR: #{decryption_file} does not exist." unless File.exist?(decryption_file)
|
31
|
-
|
32
|
-
yaml_decryptor = YAML.load_file(decryption_file, symbolize_names: true)
|
33
|
-
|
34
|
-
key = opts[:key] ||= yaml_decryptor[:key] ||= ENV.fetch('PWN_DECRYPTOR_KEY')
|
35
|
-
key = PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Decryption Key') if key.nil?
|
36
|
-
|
37
|
-
iv = opts[:iv] ||= yaml_decryptor[:iv] ||= ENV.fetch('PWN_DECRYPTOR_IV')
|
38
|
-
iv = PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Decryption IV') if iv.nil?
|
39
|
-
|
40
|
-
yaml_config = PWN::Plugins::Vault.dump(
|
41
|
-
file: yaml_config_path,
|
42
|
-
key: key,
|
43
|
-
iv: iv
|
44
|
-
)
|
45
|
-
else
|
46
|
-
yaml_config = YAML.load_file(yaml_config_path, symbolize_names: true)
|
47
|
-
end
|
48
|
-
pi.config.p = yaml_config
|
49
|
-
Pry.config.p = yaml_config
|
50
|
-
|
51
|
-
valid_ai_engines = %i[
|
52
|
-
grok
|
53
|
-
openai
|
54
|
-
ollama
|
55
|
-
]
|
56
|
-
ai_engine = yaml_config[:ai_engine].to_s.downcase.to_sym
|
57
|
-
|
58
|
-
raise "ERROR: Unsupported AI Engine: #{ai_engine} in #{yaml_config_path}. Supported AI Engines:\n#{valid_ai_engines.inspect}" unless valid_ai_engines.include?(ai_engine)
|
59
|
-
|
60
|
-
pi.config.pwn_ai_engine = ai_engine
|
61
|
-
Pry.config.pwn_ai_engine = ai_engine
|
62
|
-
|
63
|
-
pi.config.pwn_ai_base_uri = pi.config.p[ai_engine][:base_uri]
|
64
|
-
Pry.config.pwn_ai_base_uri = pi.config.pwn_ai_base_uri
|
65
|
-
|
66
|
-
pi.config.pwn_ai_key = pi.config.p[ai_engine][:key]
|
67
|
-
Pry.config.pwn_ai_key = pi.config.pwn_ai_key
|
68
|
-
|
69
|
-
pi.config.pwn_ai_model = pi.config.p[ai_engine][:model]
|
70
|
-
Pry.config.pwn_ai_model = pi.config.pwn_ai_model
|
71
|
-
|
72
|
-
pi.config.pwn_ai_system_role_content = pi.config.p[ai_engine][:system_role_content]
|
73
|
-
Pry.config.pwn_ai_system_role_content = pi.config.pwn_ai_system_role_content
|
74
|
-
|
75
|
-
pi.config.pwn_ai_temp = pi.config.p[ai_engine][:temp]
|
76
|
-
Pry.config.pwn_ai_temp = pi.config.pwn_ai_temp
|
77
|
-
|
78
|
-
pi.config.pwn_asm_arch = pi.config.p[:asm][:arch]
|
79
|
-
Pry.config.pwn_asm_arch = pi.config.pwn_asm_arch
|
80
|
-
|
81
|
-
pi.config.pwn_asm_endian = pi.config.p[:asm][:endian]
|
82
|
-
Pry.config.pwn_asm_endian = pi.config.pwn_asm_endian
|
83
|
-
|
84
|
-
pi.config.pwn_irc = pi.config.p[:irc]
|
85
|
-
Pry.config.pwn_irc = pi.config.pwn_irc
|
86
|
-
|
87
|
-
pi.config.pwn_hunter = pi.config.p[:hunter][:api_key]
|
88
|
-
Pry.config.pwn_hunter = pi.config.pwn_hunter
|
89
|
-
|
90
|
-
pi.config.pwn_shodan = pi.config.p[:shodan][:api_key]
|
91
|
-
Pry.config.pwn_shodan = pi.config.pwn_shodan
|
92
|
-
|
93
|
-
pi.config.reload_config = false
|
94
|
-
Pry.config.reload_config = false
|
95
|
-
|
96
|
-
true
|
97
|
-
rescue StandardError => e
|
98
|
-
raise e
|
99
|
-
end
|
100
|
-
|
101
11
|
# Supported Method Parameters::
|
102
12
|
# PWN::Plugins::REPL.refresh_ps1_proc(
|
103
13
|
# mode: 'required - :splat or nil'
|
@@ -107,7 +17,7 @@ module PWN
|
|
107
17
|
mode = opts[:mode]
|
108
18
|
|
109
19
|
proc do |_target_self, _nest_level, pi|
|
110
|
-
|
20
|
+
PWN::Plugins::Vault.refresh_config_for_repl(opts) if Pry.config.refresh_config
|
111
21
|
|
112
22
|
pi.config.pwn_repl_line += 1
|
113
23
|
line_pad = format(
|
@@ -597,7 +507,7 @@ module PWN
|
|
597
507
|
# Initialize pwn.yaml Configuration using :before_session Hook
|
598
508
|
Pry.config.hooks.add_hook(:before_session, :init_opts) do |_output, _binding, pi|
|
599
509
|
opts[:pi] = pi
|
600
|
-
|
510
|
+
PWN::Plugins::Vault.refresh_config_for_repl(opts)
|
601
511
|
end
|
602
512
|
|
603
513
|
Pry.config.hooks.add_hook(:after_read, :pwn_asm_hook) do |request, pi|
|
data/lib/pwn/plugins/vault.rb
CHANGED
@@ -172,8 +172,8 @@ module PWN
|
|
172
172
|
relative_editor = File.basename(editor)
|
173
173
|
system(relative_editor, file)
|
174
174
|
|
175
|
-
# If the Pry object exists, set
|
176
|
-
Pry.config.
|
175
|
+
# If the Pry object exists, set refresh_config to true
|
176
|
+
Pry.config.refresh_config = true if defined?(Pry)
|
177
177
|
|
178
178
|
encrypt(
|
179
179
|
file: file,
|
@@ -234,6 +234,95 @@ module PWN
|
|
234
234
|
raise e
|
235
235
|
end
|
236
236
|
|
237
|
+
# Supported Method Parameters::
|
238
|
+
# PWN::Plugins::Vault.refresh_config_for_repl(
|
239
|
+
# yaml_config_path: 'required - full path to pwn.yaml file',
|
240
|
+
# pi: 'optional - Pry instance (default: Pry)',
|
241
|
+
# decryption_file: 'optional - full path to decryption YAML file'
|
242
|
+
# )
|
243
|
+
public_class_method def self.refresh_config_for_repl(opts = {})
|
244
|
+
yaml_config_path = opts[:yaml_config_path]
|
245
|
+
|
246
|
+
return false unless yaml_config_path
|
247
|
+
|
248
|
+
pi = opts[:pi] ||= Pry
|
249
|
+
raise "ERROR: #{yaml_config_path} does not exist." unless File.exist?(yaml_config_path)
|
250
|
+
|
251
|
+
is_encrypted = PWN::Plugins::Vault.file_encrypted?(file: yaml_config_path)
|
252
|
+
|
253
|
+
if is_encrypted
|
254
|
+
# TODO: Implement "something you know, something you have, && something you are?"
|
255
|
+
decryption_file = opts[:decryption_file] ||= "#{Dir.home}/pwn.decryptor.yaml"
|
256
|
+
raise "ERROR: #{decryption_file} does not exist." unless File.exist?(decryption_file)
|
257
|
+
|
258
|
+
yaml_decryptor = YAML.load_file(decryption_file, symbolize_names: true)
|
259
|
+
|
260
|
+
key = opts[:key] ||= yaml_decryptor[:key] ||= ENV.fetch('PWN_DECRYPTOR_KEY')
|
261
|
+
key = PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Decryption Key') if key.nil?
|
262
|
+
|
263
|
+
iv = opts[:iv] ||= yaml_decryptor[:iv] ||= ENV.fetch('PWN_DECRYPTOR_IV')
|
264
|
+
iv = PWN::Plugins::AuthenticationHelper.mask_password(prompt: 'Decryption IV') if iv.nil?
|
265
|
+
|
266
|
+
yaml_config = PWN::Plugins::Vault.dump(
|
267
|
+
file: yaml_config_path,
|
268
|
+
key: key,
|
269
|
+
iv: iv
|
270
|
+
)
|
271
|
+
else
|
272
|
+
yaml_config = YAML.load_file(yaml_config_path, symbolize_names: true)
|
273
|
+
end
|
274
|
+
pi.config.p = yaml_config
|
275
|
+
Pry.config.p = yaml_config
|
276
|
+
|
277
|
+
valid_ai_engines = %i[
|
278
|
+
grok
|
279
|
+
openai
|
280
|
+
ollama
|
281
|
+
]
|
282
|
+
ai_engine = yaml_config[:ai_engine].to_s.downcase.to_sym
|
283
|
+
|
284
|
+
raise "ERROR: Unsupported AI Engine: #{ai_engine} in #{yaml_config_path}. Supported AI Engines:\n#{valid_ai_engines.inspect}" unless valid_ai_engines.include?(ai_engine)
|
285
|
+
|
286
|
+
pi.config.pwn_ai_engine = ai_engine
|
287
|
+
Pry.config.pwn_ai_engine = ai_engine
|
288
|
+
|
289
|
+
pi.config.pwn_ai_base_uri = pi.config.p[ai_engine][:base_uri]
|
290
|
+
Pry.config.pwn_ai_base_uri = pi.config.pwn_ai_base_uri
|
291
|
+
|
292
|
+
pi.config.pwn_ai_key = pi.config.p[ai_engine][:key]
|
293
|
+
Pry.config.pwn_ai_key = pi.config.pwn_ai_key
|
294
|
+
|
295
|
+
pi.config.pwn_ai_model = pi.config.p[ai_engine][:model]
|
296
|
+
Pry.config.pwn_ai_model = pi.config.pwn_ai_model
|
297
|
+
|
298
|
+
pi.config.pwn_ai_system_role_content = pi.config.p[ai_engine][:system_role_content]
|
299
|
+
Pry.config.pwn_ai_system_role_content = pi.config.pwn_ai_system_role_content
|
300
|
+
|
301
|
+
pi.config.pwn_ai_temp = pi.config.p[ai_engine][:temp]
|
302
|
+
Pry.config.pwn_ai_temp = pi.config.pwn_ai_temp
|
303
|
+
|
304
|
+
pi.config.pwn_asm_arch = pi.config.p[:asm][:arch]
|
305
|
+
Pry.config.pwn_asm_arch = pi.config.pwn_asm_arch
|
306
|
+
|
307
|
+
pi.config.pwn_asm_endian = pi.config.p[:asm][:endian]
|
308
|
+
Pry.config.pwn_asm_endian = pi.config.pwn_asm_endian
|
309
|
+
|
310
|
+
pi.config.pwn_irc = pi.config.p[:irc]
|
311
|
+
Pry.config.pwn_irc = pi.config.pwn_irc
|
312
|
+
|
313
|
+
pi.config.pwn_hunter = pi.config.p[:hunter][:api_key]
|
314
|
+
Pry.config.pwn_hunter = pi.config.pwn_hunter
|
315
|
+
|
316
|
+
pi.config.pwn_shodan = pi.config.p[:shodan][:api_key]
|
317
|
+
Pry.config.pwn_shodan = pi.config.pwn_shodan
|
318
|
+
|
319
|
+
Pry.config.refresh_config = false
|
320
|
+
|
321
|
+
true
|
322
|
+
rescue StandardError => e
|
323
|
+
raise e
|
324
|
+
end
|
325
|
+
|
237
326
|
# Author(s):: 0day Inc. <support@0dayinc.com>
|
238
327
|
|
239
328
|
public_class_method def self.authors
|
@@ -286,6 +375,12 @@ module PWN
|
|
286
375
|
file: 'required - file to check if encrypted'
|
287
376
|
)
|
288
377
|
|
378
|
+
#{self}.refresh_config_for_repl(
|
379
|
+
yaml_config_path: 'required - full path to pwn.yaml file',
|
380
|
+
pi: 'optional - Pry instance (default: Pry)',
|
381
|
+
decryption_file: 'optional - full path to decryption YAML file'
|
382
|
+
)
|
383
|
+
|
289
384
|
#{self}.authors
|
290
385
|
"
|
291
386
|
end
|
data/lib/pwn/version.rb
CHANGED