pwn 0.5.164 → 0.5.165

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/README.md +3 -3
  4. data/bin/pwn +1 -1
  5. data/bin/pwn_android_war_dialer +2 -2
  6. data/bin/pwn_aws_describe_resources +2 -2
  7. data/bin/pwn_bdba_groups +2 -2
  8. data/bin/pwn_bdba_scan +2 -2
  9. data/bin/pwn_burp_suite_pro_active_scan +2 -2
  10. data/bin/pwn_char_base64_encoding +2 -2
  11. data/bin/pwn_char_dec_encoding +2 -2
  12. data/bin/pwn_char_hex_escaped_encoding +2 -2
  13. data/bin/pwn_char_html_entity_encoding +2 -2
  14. data/bin/pwn_char_unicode_escaped_encoding +2 -2
  15. data/bin/pwn_char_url_encoding +2 -2
  16. data/bin/pwn_crt_sh +82 -0
  17. data/bin/pwn_defectdojo_engagement_create +2 -2
  18. data/bin/pwn_defectdojo_importscan +2 -2
  19. data/bin/pwn_defectdojo_reimportscan +2 -2
  20. data/bin/pwn_diff_csv_files_w_column_exclude +4 -4
  21. data/bin/pwn_domain_reversewhois +2 -2
  22. data/bin/pwn_fuzz_net_app_proto +3 -3
  23. data/bin/pwn_gqrx_scanner +2 -2
  24. data/bin/pwn_jenkins_create_job +2 -2
  25. data/bin/pwn_jenkins_create_view +2 -2
  26. data/bin/pwn_jenkins_install_plugin +2 -2
  27. data/bin/pwn_jenkins_thinBackup_aws_s3 +2 -2
  28. data/bin/pwn_jenkins_update_plugins +2 -2
  29. data/bin/pwn_jenkins_useradd +2 -2
  30. data/bin/pwn_mail_agent +2 -2
  31. data/bin/pwn_nessus_cloud_scan_crud +2 -2
  32. data/bin/pwn_nessus_cloud_vulnscan +2 -2
  33. data/bin/pwn_nexpose +2 -2
  34. data/bin/pwn_nmap_discover_tcp_udp +2 -2
  35. data/bin/pwn_openvas_vulnscan +2 -2
  36. data/bin/pwn_owasp_zap_active_scan +2 -2
  37. data/bin/pwn_pastebin_sample_filter +2 -2
  38. data/bin/pwn_phone +3 -3
  39. data/bin/pwn_sast +3 -3
  40. data/bin/pwn_serial_check_voicemail +2 -2
  41. data/bin/pwn_serial_msr206 +2 -2
  42. data/bin/pwn_serial_son_micro_sm132_rfid +2 -2
  43. data/bin/pwn_shodan_graphql_introspection +1 -1
  44. data/bin/pwn_shodan_search +2 -2
  45. data/bin/pwn_simple_http_server +1 -1
  46. data/bin/pwn_web_cache_deception +4 -4
  47. data/bin/pwn_www_checkip +3 -1
  48. data/bin/pwn_www_uri_buster +141 -57
  49. data/bin/pwn_xss_dom_vectors +2 -2
  50. data/lib/pwn/plugins/authentication_helper.rb +2 -2
  51. data/lib/pwn/plugins/ip_info.rb +2 -0
  52. data/lib/pwn/plugins/log.rb +3 -1
  53. data/lib/pwn/plugins/repl.rb +3 -1
  54. data/lib/pwn/plugins/thread_pool.rb +12 -42
  55. data/lib/pwn/plugins/tor.rb +51 -12
  56. data/lib/pwn/plugins/transparent_browser.rb +3 -0
  57. data/lib/pwn/plugins/voice.rb +3 -3
  58. data/lib/pwn/reports/uri_buster.rb +18 -6
  59. data/lib/pwn/version.rb +1 -1
  60. metadata +8 -6
@@ -44,6 +44,8 @@ module PWN
44
44
  end
45
45
  rescue StandardError => e
46
46
  raise e
47
+ ensure
48
+ PWN::Plugins::TransparentBrowser.close(browser_obj: browser_obj) if browser_obj
47
49
  end
48
50
 
49
51
  # Supported Method Parameters::
@@ -93,7 +93,9 @@ module PWN
93
93
  end
94
94
 
95
95
  logger.add(logger.level, log_event, which_self)
96
- rescue Interrupt, StandardError => e
96
+ rescue Interrupt
97
+ puts "\n#{self}.#{__method__} => Goodbye."
98
+ rescue StandardError => e
97
99
  raise e
98
100
  end
99
101
 
@@ -488,8 +488,10 @@ module PWN
488
488
 
489
489
  # Initialize pwn.yaml Configuration using :before_session Hook
490
490
  Pry.config.hooks.add_hook(:before_session, :init_opts) do |_output, _binding, pi|
491
- if opts[:yaml_config_path] && File.exist?(opts[:yaml_config_path])
491
+ if opts[:yaml_config_path]
492
492
  yaml_config_path = opts[:yaml_config_path]
493
+ raise "ERROR: #{yaml_config_path} does not exist." unless File.exist?(yaml_config_path)
494
+
493
495
  is_encrypted = PWN::Plugins::Vault.file_encrypted?(file: yaml_config_path)
494
496
 
495
497
  if is_encrypted
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # require 'concurrent-ruby'
3
+ require 'concurrent-ruby'
4
4
 
5
5
  module PWN
6
6
  module Plugins
@@ -22,31 +22,6 @@ module PWN
22
22
  # end
23
23
  # end
24
24
 
25
- # public_class_method def self.fill(opts = {})
26
- # enumerable_array = opts[:enumerable_array]
27
- # max_threads = opts[:max_threads].to_i
28
- # max_threads = 9 if max_threads.zero?
29
- # detach = opts[:detach] ||= false
30
-
31
- # puts "Initiating Thread Pool of #{max_threads} Worker Threads...."
32
- # pool = Concurrent::FixedThreadPool.new(max_threads)
33
-
34
- # enumerable_array.each do |this_thread|
35
- # pool.post do
36
- # yield this_thread
37
- # end
38
- # end
39
-
40
- # pool.shutdown
41
- # pool.wait_for_termination unless detach
42
- # rescue Interrupt
43
- # puts "\nGoodbye."
44
- # rescue StandardError => e
45
- # puts e.backtrace
46
- # raise e
47
- # end
48
- # METHOD ABOVE IS SLOWER THAN THE ONE BELOW
49
-
50
25
  public_class_method def self.fill(opts = {})
51
26
  enumerable_array = opts[:enumerable_array]
52
27
  max_threads = opts[:max_threads].to_i
@@ -54,28 +29,23 @@ module PWN
54
29
  detach = opts[:detach] ||= false
55
30
 
56
31
  puts "Initiating Thread Pool of #{max_threads} Worker Threads...."
57
- queue = SizedQueue.new(max_threads)
58
- threads = Array.new(max_threads) do
59
- Thread.new do
60
- until (this_thread = queue.pop) == :POOL_EXHAUSTED
61
- yield this_thread
62
- end
63
- end
64
- end
32
+ pool = Concurrent::FixedThreadPool.new(max_threads)
65
33
 
66
- enumerable_array.uniq.each do |this_thread|
67
- queue << this_thread
68
- end
69
-
70
- max_threads.times do
71
- queue << :POOL_EXHAUSTED
34
+ enumerable_array.each do |this_thread|
35
+ pool.post do
36
+ yield this_thread
37
+ end
72
38
  end
73
39
 
74
- threads.each(&:join) unless detach
40
+ pool.shutdown
41
+ pool.wait_for_termination unless detach
75
42
  rescue Interrupt
76
- puts "\nGoodbye."
43
+ puts "\n#{self}.#{__method__} => Goodbye."
77
44
  rescue StandardError => e
45
+ puts e.backtrace
78
46
  raise e
47
+ ensure
48
+ pool.kill if pool.running?
79
49
  end
80
50
 
81
51
  # Author(s):: 0day Inc. <support@0dayinc.com>
@@ -111,6 +111,7 @@ module PWN
111
111
  session_log = File.new(session_log_path, 'w')
112
112
  session_log.sync = true
113
113
  session_log.fsync
114
+ tor_obj = nil
114
115
 
115
116
  fork_pid = Process.fork do
116
117
  pty = PTY.spawn(
@@ -132,33 +133,52 @@ module PWN
132
133
  stdout.each do |line|
133
134
  session_log.puts line
134
135
  end
136
+ rescue Interrupt,
137
+ Errno::EIO => e
138
+ puts "\n#{self}.#{__method__}#spawn => Goodbye." if e.is_a?(Interrupt)
139
+ tor_obj = {
140
+ parent_pid: fork_pid,
141
+ child_pid: pid,
142
+ data_dir: data_dir
143
+ }
144
+ stop(tor_obj: tor_obj)
135
145
  end
136
- rescue StandardError => e
137
- puts 'Tor exiting with errors...'
138
- FileUtils.rm_rf(data_dir)
139
- raise e
146
+ rescue Interrupt,
147
+ Errno::EIO => e
148
+ puts "\n#{self}.#{__method__}#fork => Goodbye." if e.is_a?(Interrupt)
149
+ tor_obj = {
150
+ parent_pid: fork_pid,
151
+ data_dir: data_dir
152
+ }
153
+ stop(tor_obj: tor_obj)
140
154
  end
155
+
141
156
  Process.detach(fork_pid)
142
157
 
143
158
  loop do
144
159
  pid_ready = File.exist?(pid_file)
145
160
  cookie_authn_ready = File.exist?(cookie_authn_file)
146
- sleep 0.1
147
161
  break if pid_ready && cookie_authn_ready
148
162
  end
149
163
 
164
+ child_pid = File.read(pid_file).to_i
150
165
  cookie_authn = `hexdump -e '32/1 "%02x"' #{cookie_authn_file}`
166
+
151
167
  tor_obj = {
152
168
  parent_pid: fork_pid,
153
- child_pid: File.read(pid_file).to_i,
169
+ child_pid: child_pid,
154
170
  ip: ip,
155
171
  port: port,
156
172
  ctrl_port: ctrl_port,
157
173
  data_dir: data_dir,
158
174
  cookie_authn: cookie_authn
159
175
  }
160
- rescue StandardError, SystemExit => e
161
- stop(tor_obj) unless tor_obj.nil?
176
+ rescue Interrupt, SystemExit
177
+ puts "\n#{self}.#{__method__} => Goodbye."
178
+ stop(tor_obj: tor_obj) unless tor_obj.nil?
179
+ rescue StandardError => e
180
+ puts "\n#{self}.#{__method__} => Goodbye."
181
+ stop(tor_obj: tor_obj) unless tor_obj.nil?
162
182
  raise e
163
183
  end
164
184
 
@@ -187,11 +207,30 @@ module PWN
187
207
 
188
208
  public_class_method def self.stop(opts = {})
189
209
  tor_obj = opts[:tor_obj]
190
- unless tor_obj.nil?
191
- FileUtils.rm_rf(tor_obj[:data_dir])
192
- Process.kill('TERM', tor_obj[:child_pid])
193
- Process.kill('TERM', tor_obj[:parent_pid])
210
+
211
+ return nil unless tor_obj.is_a?(Hash)
212
+
213
+ child_pid = tor_obj[:child_pid]
214
+ parent_pid = tor_obj[:parent_pid]
215
+ data_dir = tor_obj[:data_dir]
216
+ if child_pid || parent_pid || data_dir
217
+ proc_list = PWN::Plugins::PS.list
218
+ find_child_pid = proc_list.find { |arr| arr[2] == child_pid.to_s }
219
+ find_parent_pid = proc_list.find { |arr| arr[2] == parent_pid.to_s }
220
+
221
+ # puts "Killing Tor child PID: #{child_pid}..."
222
+ Process.kill('SIGKILL', child_pid) if find_child_pid
223
+
224
+ # puts "Killing Tor parent PID: #{parent_pid}..."
225
+ Process.kill('SIGKILL', parent_pid) if find_parent_pid
226
+
227
+ # puts "Removing Tor data directory: #{data_dir}..."
228
+ FileUtils.rm_rf(data_dir)
194
229
  end
230
+
231
+ nil
232
+ rescue Errno::ESRCH, Errno::ENOENT => e
233
+ puts e
195
234
  rescue StandardError => e
196
235
  raise e
197
236
  end
@@ -335,6 +335,9 @@ module PWN
335
335
 
336
336
  public_class_method def self.close(opts = {})
337
337
  browser_obj = opts[:browser_obj]
338
+
339
+ return nil unless browser_obj.is_a?(Hash)
340
+
338
341
  browser = browser_obj[:browser]
339
342
  tor_obj = browser_obj[:tor_obj]
340
343
 
@@ -37,7 +37,7 @@ module PWN
37
37
 
38
38
  puts "\nGoodbye."
39
39
  rescue Interrupt
40
- puts "\nGoodbye."
40
+ puts "\n#{self}.#{__method__} => Goodbye."
41
41
  rescue StandardError => e
42
42
  raise e
43
43
  end
@@ -70,7 +70,7 @@ module PWN
70
70
  output_dir
71
71
  )
72
72
  rescue Interrupt
73
- puts "\nGoodbye."
73
+ puts "\n#{self}.#{__method__} => Goodbye."
74
74
  rescue StandardError => e
75
75
  raise e
76
76
  end
@@ -102,7 +102,7 @@ module PWN
102
102
  "(SayText \"#{text_to_say}\")"
103
103
  )
104
104
  rescue Interrupt
105
- puts "\nGoodbye."
105
+ puts "\n#{self}.#{__method__} => Goodbye."
106
106
  rescue StandardError => e
107
107
  raise e
108
108
  end
@@ -96,12 +96,14 @@ module PWN
96
96
  <div>
97
97
  <b>Toggle Column(s):</b>&nbsp;
98
98
  <a class="toggle-vis" data-column="1" href="#">Request Time</a>&nbsp;|&nbsp;
99
- <a class="toggle-vis" data-column="2" href="#">URI</a>&nbsp;|&nbsp;
100
- <a class="toggle-vis" data-column="3" href="#">HTTP Method</a>&nbsp;|&nbsp;
101
- <a class="toggle-vis" data-column="4" href="#">HTTP Response Code</a>&nbsp;|&nbsp;
102
- <a class="toggle-vis" data-column="5" href="#">HTTP Response Length</a>&nbsp;|&nbsp;
103
- <a class="toggle-vis" data-column="6" href="#">HTTP Response Headers</a>&nbsp;|&nbsp;
104
- <a class="toggle-vis" data-column="7" href="#">HTTP Response Body</a>&nbsp;|&nbsp;
99
+ <a class="toggle-vis" data-column="2" href="#">Response Time</a>&nbsp;|&nbsp;
100
+ <a class="toggle-vis" data-column="3" href="#">Duration</a>&nbsp;|&nbsp;
101
+ <a class="toggle-vis" data-column="4" href="#">URI</a>&nbsp;|&nbsp;
102
+ <a class="toggle-vis" data-column="5" href="#">HTTP Method</a>&nbsp;|&nbsp;
103
+ <a class="toggle-vis" data-column="6" href="#">HTTP Response Code</a>&nbsp;|&nbsp;
104
+ <a class="toggle-vis" data-column="7" href="#">HTTP Response Length</a>&nbsp;|&nbsp;
105
+ <a class="toggle-vis" data-column="8" href="#">HTTP Response Headers</a>&nbsp;|&nbsp;
106
+ <a class="toggle-vis" data-column="9" href="#">HTTP Response Body</a>&nbsp;|&nbsp;
105
107
  </div>
106
108
  <br /><br />
107
109
 
@@ -111,6 +113,8 @@ module PWN
111
113
  <tr>
112
114
  <th>#</th>
113
115
  <th>Request Time</th>
116
+ <th>Response Time</th>
117
+ <th>Duration</th>
114
118
  <th>URI</th>
115
119
  <th>HTTP Method</th>
116
120
  <th>HTTP Response Code</th>
@@ -166,6 +170,14 @@ module PWN
166
170
  "data": "request_timestamp",
167
171
  "render": $.fn.dataTable.render.text()
168
172
  },
173
+ {
174
+ "data": "response_timestamp",
175
+ "render": $.fn.dataTable.render.text()
176
+ },
177
+ {
178
+ "data": "duration",
179
+ "render": $.fn.dataTable.render.text()
180
+ },
169
181
  {
170
182
  "data": "http_uri",
171
183
  "render": function (data, type, row, meta) {
data/lib/pwn/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PWN
4
- VERSION = '0.5.164'
4
+ VERSION = '0.5.165'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.164
4
+ version: 0.5.165
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-06 00:00:00.000000000 Z
11
+ date: 2024-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -478,14 +478,14 @@ dependencies:
478
478
  requirements:
479
479
  - - '='
480
480
  - !ruby/object:Gem::Version
481
- version: 0.0.68
481
+ version: 0.0.69
482
482
  type: :runtime
483
483
  prerelease: false
484
484
  version_requirements: !ruby/object:Gem::Requirement
485
485
  requirements:
486
486
  - - '='
487
487
  - !ruby/object:Gem::Version
488
- version: 0.0.68
488
+ version: 0.0.69
489
489
  - !ruby/object:Gem::Dependency
490
490
  name: metasm
491
491
  requirement: !ruby/object:Gem::Requirement
@@ -926,14 +926,14 @@ dependencies:
926
926
  requirements:
927
927
  - - '='
928
928
  - !ruby/object:Gem::Version
929
- version: 2.30.0
929
+ version: 2.31.0
930
930
  type: :runtime
931
931
  prerelease: false
932
932
  version_requirements: !ruby/object:Gem::Requirement
933
933
  requirements:
934
934
  - - '='
935
935
  - !ruby/object:Gem::Version
936
- version: 2.30.0
936
+ version: 2.31.0
937
937
  - !ruby/object:Gem::Dependency
938
938
  name: ruby-audio
939
939
  requirement: !ruby/object:Gem::Requirement
@@ -1245,6 +1245,7 @@ executables:
1245
1245
  - pwn_char_html_entity_encoding
1246
1246
  - pwn_char_unicode_escaped_encoding
1247
1247
  - pwn_char_url_encoding
1248
+ - pwn_crt_sh
1248
1249
  - pwn_defectdojo_engagement_create
1249
1250
  - pwn_defectdojo_importscan
1250
1251
  - pwn_defectdojo_reimportscan
@@ -1312,6 +1313,7 @@ files:
1312
1313
  - bin/pwn_char_html_entity_encoding
1313
1314
  - bin/pwn_char_unicode_escaped_encoding
1314
1315
  - bin/pwn_char_url_encoding
1316
+ - bin/pwn_crt_sh
1315
1317
  - bin/pwn_defectdojo_engagement_create
1316
1318
  - bin/pwn_defectdojo_importscan
1317
1319
  - bin/pwn_defectdojo_reimportscan