pwn 0.5.406 → 0.5.408

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a4875ea87dd3f0605bc2ac889621fc124d43016086b2ef914a71dd8104879ff
4
- data.tar.gz: 68addc891a15eea06b39b9e575fd98ce3b9e5a4d3e490c20bdfbe138699b8f2e
3
+ metadata.gz: 8d06c6b5e12a9f4cf4234fac12f6ab411827e323c3e9e0a47619f0dbef244c48
4
+ data.tar.gz: 3add4e6e3d8aa13f210500668182dafccc85c212e1d4b13cabda9d932ccaf668
5
5
  SHA512:
6
- metadata.gz: 6b9211d610152046dec2ddcb6c96687085ae3004d104713064831c511e7ce1aa490c5f4e69c12066bc6d11e4f81b47dd90e6b289d5df88a6a5d65abb67d24dd7
7
- data.tar.gz: e43570d37f21c2a3dc4008da1b42ee0aa379f4aebe5880dd47bb1b4c881a767db74a85b4121a125fbcdb67a4fc7526e239dfb595fd2327dbc0742c67e76027c7
6
+ metadata.gz: 715b74eaecca58b65bfabe0b9e025eb807068ce7774ab04d3ed21ba29c52b597a7e730c45fff58a6a97d95566dd9d987fb29f2f63b212f28e0d9869c21822374
7
+ data.tar.gz: 7d93377be56f0f32aa29f4e8321d789fb63b100b0a6b212f2857286045035706afcee3138998c7f15428f919a195457449e9945feba15678838c85a724cf44e4
data/.rubocop_todo.yml CHANGED
@@ -1,31 +1,11 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-05-30 23:04:07 UTC using RuboCop version 1.75.8.
3
+ # on 2025-09-11 18:09:38 UTC using RuboCop version 1.80.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 24
10
- # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
12
- # URISchemes: http, https
13
- Layout/LineLength:
14
- Exclude:
15
- - 'Vagrantfile'
16
- - 'bin/pwn_diff_csv_files_w_column_exclude'
17
- - 'lib/pwn/banner/jmp_esp.rb'
18
- - 'lib/pwn/banner/radare2_ai.rb'
19
- - 'lib/pwn/plugins/mail_agent.rb'
20
- - 'lib/pwn/plugins/ollama.rb'
21
- - 'lib/pwn/plugins/open_ai.rb'
22
- - 'lib/pwn/reports/fuzz.rb'
23
- - 'lib/pwn/reports/phone.rb'
24
- - 'lib/pwn/reports/sast.rb'
25
- - 'lib/pwn/reports/uri_buster.rb'
26
- - 'lib/pwn/sast/banned_function_calls_c.rb'
27
- - 'packer/provisioners/aliases.rb'
28
-
29
9
  # Offense count: 1
30
10
  # This cop supports safe autocorrection (--autocorrect).
31
11
  # Configuration parameters: AllowInHeredoc.
@@ -50,37 +30,18 @@ Lint/RedundantTypeConversion:
50
30
  - 'lib/pwn/plugins/jenkins.rb'
51
31
  - 'lib/pwn/plugins/repl.rb'
52
32
 
53
- # Offense count: 307
33
+ # Offense count: 320
54
34
  # This cop supports safe autocorrection (--autocorrect).
55
- # Configuration parameters: AutoCorrect.
56
35
  Lint/UselessAssignment:
57
36
  Enabled: false
58
37
 
59
38
  # Offense count: 1
60
39
  # This cop supports safe autocorrection (--autocorrect).
61
- # Configuration parameters: AutoCorrect, CheckForMethodsWithNoSideEffects.
40
+ # Configuration parameters: CheckForMethodsWithNoSideEffects.
62
41
  Lint/Void:
63
42
  Exclude:
64
43
  - 'bin/pwn_web_cache_deception'
65
44
 
66
- # Offense count: 5
67
- # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
68
- # AllowedMethods: refine
69
- Metrics/BlockLength:
70
- Exclude:
71
- - '**/*.gemspec'
72
- - 'lib/pwn/plugins/android.rb'
73
- - 'lib/pwn/plugins/msr206.rb'
74
- - 'lib/pwn/plugins/repl.rb'
75
- - 'lib/pwn/sast/banned_function_calls_c.rb'
76
-
77
- # Offense count: 2
78
- # Configuration parameters: CountBlocks, CountModifierForms, Max.
79
- Metrics/BlockNesting:
80
- Exclude:
81
- - 'lib/pwn/plugins/son_micro_rfid.rb'
82
- - 'lib/pwn/plugins/tor.rb'
83
-
84
45
  # Offense count: 1
85
46
  # Configuration parameters: LengthThreshold.
86
47
  Metrics/CollectionLiteralLength:
@@ -99,22 +60,13 @@ Metrics/MethodLength:
99
60
  Exclude:
100
61
  - 'lib/pwn/banner/code_cave.rb'
101
62
 
102
- # Offense count: 12
63
+ # Offense count: 3
103
64
  # Configuration parameters: CountComments, Max, CountAsOne.
104
65
  Metrics/ModuleLength:
105
66
  Exclude:
106
67
  - 'lib/pwn/banner/code_cave.rb'
107
68
  - 'lib/pwn/plugins/android.rb'
108
- - 'lib/pwn/plugins/black_duck_binary_analysis.rb'
109
- - 'lib/pwn/plugins/defect_dojo.rb'
110
- - 'lib/pwn/plugins/gqrx.rb'
111
69
  - 'lib/pwn/plugins/msr206.rb'
112
- - 'lib/pwn/plugins/nessus_cloud.rb'
113
- - 'lib/pwn/plugins/open_ai.rb'
114
- - 'lib/pwn/plugins/packet.rb'
115
- - 'lib/pwn/plugins/repl.rb'
116
- - 'lib/pwn/plugins/son_micro_rfid.rb'
117
- - 'lib/pwn/plugins/transparent_browser.rb'
118
70
 
119
71
  # Offense count: 2
120
72
  Naming/AccessorMethodName:
@@ -133,7 +85,7 @@ Style/Alias:
133
85
  Style/ClassVars:
134
86
  Enabled: false
135
87
 
136
- # Offense count: 280
88
+ # Offense count: 274
137
89
  # This cop supports safe autocorrection (--autocorrect).
138
90
  # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
139
91
  # SupportedStyles: assign_to_condition, assign_inside_condition
@@ -146,12 +98,11 @@ Style/ExplicitBlockArgument:
146
98
  Exclude:
147
99
  - 'lib/pwn/plugins/nmap_it.rb'
148
100
 
149
- # Offense count: 2
101
+ # Offense count: 1
150
102
  # This cop supports safe autocorrection (--autocorrect).
151
103
  Style/IfUnlessModifier:
152
104
  Exclude:
153
105
  - 'lib/pwn/plugins/baresip.rb'
154
- - 'lib/pwn/plugins/mail_agent.rb'
155
106
 
156
107
  # Offense count: 9
157
108
  # This cop supports unsafe autocorrection (--autocorrect-all).
@@ -165,7 +116,7 @@ Style/MapIntoArray:
165
116
  - 'lib/pwn/plugins/char.rb'
166
117
  - 'lib/pwn/plugins/nexpose_vuln_scan.rb'
167
118
 
168
- # Offense count: 9
119
+ # Offense count: 7
169
120
  # This cop supports safe autocorrection (--autocorrect).
170
121
  # Configuration parameters: AllowMethodComparison, ComparisonsThreshold.
171
122
  Style/MultipleComparison:
@@ -175,11 +126,15 @@ Style/MultipleComparison:
175
126
  - 'lib/pwn/sast/cmd_execution_ruby.rb'
176
127
  - 'lib/pwn/sast/deserial_java.rb'
177
128
  - 'lib/pwn/sast/factory.rb'
178
- - 'lib/pwn/sast/logger.rb'
179
- - 'lib/pwn/sast/throw_errors.rb'
180
129
  - 'lib/pwn/www/duckduckgo.rb'
181
130
  - 'lib/pwn/www/twitter.rb'
182
131
 
132
+ # Offense count: 1
133
+ # This cop supports safe autocorrection (--autocorrect).
134
+ Style/RedundantAssignment:
135
+ Exclude:
136
+ - 'lib/pwn/plugins/zaproxy.rb'
137
+
183
138
  # Offense count: 1
184
139
  # This cop supports safe autocorrection (--autocorrect).
185
140
  Style/RedundantBegin:
@@ -222,7 +177,7 @@ Style/RedundantStringEscape:
222
177
  - 'lib/pwn/sast/redos.rb'
223
178
  - 'vagrant/provisioners/kali_customize.rb'
224
179
 
225
- # Offense count: 58
180
+ # Offense count: 62
226
181
  # This cop supports unsafe autocorrection (--autocorrect-all).
227
182
  Style/SlicingWithRange:
228
183
  Enabled: false
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.406]:001 >>> PWN.help
40
+ pwn[v0.5.408]:001 >>> PWN.help
41
41
  ```
42
42
 
43
43
  [![Installing the pwn Security Automation Framework](https://raw.githubusercontent.com/0dayInc/pwn/master/documentation/pwn_install.png)](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.406]:001 >>> PWN.help
55
+ pwn[v0.5.408]: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.406]:001 >>> PWN.help
65
+ pwn[v0.5.408]: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:
@@ -436,6 +436,31 @@ module PWN
436
436
  raise e
437
437
  end
438
438
 
439
+ # Supported Method Parameters::
440
+ # repeater_id = PWN::Plugins::BurpSuite.find_sitemap_entries(
441
+ # burp_obj: 'required - burp_obj returned by #start method',
442
+ # search_string: 'required - string to search for in the sitemap entries'
443
+ # )
444
+
445
+ public_class_method def self.find_sitemap_entries(opts = {})
446
+ burp_obj = opts[:burp_obj]
447
+ raise 'ERROR: burp_obj parameter is required' unless burp_obj.is_a?(Hash)
448
+
449
+ search_string = opts[:search_string]
450
+ raise 'ERROR: search_string parameter is required' if search_string.nil?
451
+
452
+ rest_browser = burp_obj[:rest_browser]
453
+ mitm_rest_api = burp_obj[:mitm_rest_api]
454
+
455
+ json_sitemap = get_sitemap(burp_obj: burp_obj)
456
+ matching_entries = json_sitemap.select do |entry|
457
+ decoded_request = Base64.strict_decode64(entry[:request])
458
+ decoded_request.include?(search_string)
459
+ end
460
+ rescue StandardError => e
461
+ raise e
462
+ end
463
+
439
464
  # Supported Method Parameters:
440
465
  # json_sitemap = PWN::Plugins::BurpSuite.import_openapi_to_sitemap(
441
466
  # burp_obj: 'required - burp_obj returned by #start method',
@@ -1013,31 +1038,6 @@ module PWN
1013
1038
  raise e
1014
1039
  end
1015
1040
 
1016
- # Supported Method Parameters::
1017
- # repeater_id = PWN::Plugins::BurpSuite.find_sitemap_entries(
1018
- # burp_obj: 'required - burp_obj returned by #start method',
1019
- # search_string: 'required - string to search for in the sitemap entries'
1020
- # )
1021
-
1022
- public_class_method def self.find_sitemap_entries(opts = {})
1023
- burp_obj = opts[:burp_obj]
1024
- raise 'ERROR: burp_obj parameter is required' unless burp_obj.is_a?(Hash)
1025
-
1026
- search_string = opts[:search_string]
1027
- raise 'ERROR: search_string parameter is required' if search_string.nil?
1028
-
1029
- rest_browser = burp_obj[:rest_browser]
1030
- mitm_rest_api = burp_obj[:mitm_rest_api]
1031
-
1032
- json_sitemap = get_sitemap(burp_obj: burp_obj)
1033
- matching_entries = json_sitemap.select do |entry|
1034
- decoded_request = Base64.strict_decode64(entry[:request])
1035
- decoded_request.include?(search_string)
1036
- end
1037
- rescue StandardError => e
1038
- raise e
1039
- end
1040
-
1041
1041
  # Supported Method Parameters::
1042
1042
  # repeater_id = PWN::Plugins::BurpSuite.add_repeater_tab(
1043
1043
  # burp_obj: 'required - burp_obj returned by #start method',
@@ -1395,6 +1395,11 @@ module PWN
1395
1395
  }
1396
1396
  )
1397
1397
 
1398
+ #{self}.find_sitemap_entry(
1399
+ burp_obj: 'required - burp_obj returned by #start method',
1400
+ search_string: 'required - string to search for in the sitemap entries'
1401
+ )
1402
+
1398
1403
  json_sitemap = #{self}.import_openapi_to_sitemap(
1399
1404
  burp_obj: 'required - burp_obj returned by #start method',
1400
1405
  openapi_spec: 'required - path to OpenAPI JSON or YAML specification file',
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'cgi'
4
+ require 'fileutils'
4
5
  require 'pty'
5
6
  require 'securerandom'
6
7
  require 'json'
@@ -113,10 +114,15 @@ module PWN
113
114
 
114
115
  zap_obj[:mitm_browser] = browser_obj2
115
116
 
117
+ timestamp = Time.now.strftime('%Y-%m-%d_%H-%M-%S%z')
118
+ session_path = "/tmp/zaproxy-#{timestamp}.session"
119
+ zap_obj[:session_path] = session_path
120
+
116
121
  if headless
117
- zaproxy_cmd = "cd #{zap_root} && ./#{zap_bin} -daemon"
122
+ # TODO: Ensure Default Context still exists and is default context
123
+ zaproxy_cmd = "cd #{zap_root} && ./#{zap_bin} -daemon -newsession #{session_path}"
118
124
  else
119
- zaproxy_cmd = "cd #{zap_root} && ./#{zap_bin}"
125
+ zaproxy_cmd = "cd #{zap_root} && ./#{zap_bin} -newsession #{session_path}"
120
126
  end
121
127
 
122
128
  zaproxy_cmd = "#{zaproxy_cmd} -host #{zap_ip} -port #{zap_port}"
@@ -296,40 +302,23 @@ module PWN
296
302
  # Supported Method Parameters::
297
303
  # PWN::Plugins::Zaproxy.find_har_entries(
298
304
  # zap_obj: 'required - zap_obj returned from #open method',
299
- # request: 'required - base64 encoded request or HAR entry :request (e.g. from #get_sitemap method)'
305
+ # search_string: 'required - string to search for in the sitemap entries'
300
306
  # )
301
307
 
302
308
  public_class_method def self.find_har_entries(opts = {})
303
309
  zap_obj = opts[:zap_obj]
304
310
  api_key = zap_obj[:api_key].to_s.scrub
305
- request = opts[:request]
306
- raise 'ERROR: request must be provided' if request.nil?
311
+ search_string = opts[:search_string]
312
+ raise 'ERROR: search_string must be provided' if search_string.nil?
307
313
 
308
314
  har_sitemap = get_sitemap(
309
315
  zap_obj: zap_obj,
310
316
  return_as: :har
311
317
  )
312
318
 
313
- # HAR entry
314
- if request.is_a?(Hash) && request.key?(:method) && request.key?(:url) && request.key?(:httpVersion)
315
- har_entries = har_sitemap.select { |entry| entry[:request] == request }
316
- else
317
- # Base64 encoded string
318
- dec_request = Base64.strict_decode64(request).force_encoding('ASCII-8BIT') unless dec_request.is_a?(Hash)
319
-
320
- # Find the har request for the given base64 decoded dec_request value
321
- har_entries = har_sitemap.select do |entry|
322
- req = entry[:request]
323
- req_line = "#{req[:method]} #{req[:url]} #{req[:httpVersion]}\r\n"
324
- req_headers = req[:headers].map { |h| "#{h[:name]}: #{h[:value]}\r\n" }.join
325
- req_body = ''
326
- if req[:postData] && req[:postData][:text]
327
- req_body = req[:postData][:text]
328
- req_body = Base64.decode64(req_body) if req[:postData][:encoding] == 'base64'
329
- end
330
- full_req = "#{req_line}#{req_headers}\r\n#{req_body}".force_encoding('ASCII-8BIT')
331
- full_req == dec_request
332
- end
319
+ har_entries = har_sitemap.select do |entry|
320
+ json_request = entry[:request].to_json
321
+ json_request.include?(search_string)
333
322
  end
334
323
 
335
324
  har_entries
@@ -518,6 +507,8 @@ module PWN
518
507
  scan_policy = opts[:scan_policy] ||= 'Default Policy'
519
508
 
520
509
  exclude_paths.each do |exclude_path|
510
+ # Remove trailing .* from target_url if it exists
511
+ target_url = target_url.delete_suffix('.*') if target_url.end_with?('.*')
521
512
  exclude_path_regex = "#{target_url}#{exclude_path}.*"
522
513
  params = {
523
514
  apikey: api_key,
@@ -734,6 +725,11 @@ module PWN
734
725
  params: params
735
726
  )
736
727
 
728
+ session_path = zap_obj[:session_path]
729
+ session_path_files = Dir.glob("#{session_path}*")
730
+ # Remove session files - need to add a slight delay between each unlink to work around file locks
731
+ session_path_files.each { |f| FileUtils.rm_f(f); sleep 0.3 }
732
+
737
733
  zap_obj = nil
738
734
  rescue StandardError, SystemExit, Interrupt => e
739
735
  raise e
@@ -781,7 +777,7 @@ module PWN
781
777
 
782
778
  #{self}.find_har_entries(
783
779
  zap_obj: 'required - zap_obj returned from #open method',
784
- request: 'required - base64 encoded request or HAR entry :request (e.g. from #get_sitemap method)'
780
+ search_string: 'required - string to search for in the sitemap entries'
785
781
  )
786
782
 
787
783
  #{self}.requester(
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.406'
4
+ VERSION = '0.5.408'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.406
4
+ version: 0.5.408
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.