pwn 0.5.405 → 0.5.407
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_todo.yml +14 -59
- data/README.md +3 -3
- data/lib/pwn/plugins/burp_suite.rb +31 -1
- data/lib/pwn/plugins/zaproxy.rb +111 -138
- 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: 6cdcedb953c971c8feccabd99bb44f1e229254d4adbaf8f5d06c53416da1d3c7
|
4
|
+
data.tar.gz: 2642aa96456651ef17d042794f21ad69754335e8d3b8d7e3415e311adb1dbd05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8041d87f4162ebb4fb28c9b6acc5cfae7394fb4e082cd8a4a99e6ac22f1181701a0e32d28e97593d7e169cadc80ca71c76d0144d7e313e16c8c9b1ee799bd20a
|
7
|
+
data.tar.gz: 0a654b39bf9c3f63b24accc464fd7b8222f060dfd5748118e99771d8ef9897e6551c95e63b40fdd4b0eabfe21694241a448c3a00607e21306b7e64683b871500
|
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-
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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.
|
40
|
+
pwn[v0.5.407]: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.407]: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.407]: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',
|
@@ -450,7 +475,7 @@ module PWN
|
|
450
475
|
raise 'ERROR: burp_obj parameter is required' unless burp_obj.is_a?(Hash)
|
451
476
|
|
452
477
|
openapi_spec = opts[:openapi_spec]
|
453
|
-
raise 'ERROR: openapi_spec parameter
|
478
|
+
raise 'ERROR: openapi_spec parameter is required' if openapi_spec.nil?
|
454
479
|
|
455
480
|
additional_http_headers = opts[:additional_http_headers] ||= {}
|
456
481
|
raise 'ERROR: additional_http_headers must be a Hash' unless additional_http_headers.is_a?(Hash)
|
@@ -1370,6 +1395,11 @@ module PWN
|
|
1370
1395
|
}
|
1371
1396
|
)
|
1372
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
|
+
|
1373
1403
|
json_sitemap = #{self}.import_openapi_to_sitemap(
|
1374
1404
|
burp_obj: 'required - burp_obj returned by #start method',
|
1375
1405
|
openapi_spec: 'required - path to OpenAPI JSON or YAML specification file',
|
data/lib/pwn/plugins/zaproxy.rb
CHANGED
@@ -171,147 +171,16 @@ module PWN
|
|
171
171
|
raise e
|
172
172
|
end
|
173
173
|
|
174
|
-
# Supported Method Parameters::
|
175
|
-
# PWN::Plugins::Zaproxy.add_to_scope(
|
176
|
-
# zap_obj: 'required - zap_obj returned from #open method',
|
177
|
-
# target_regex: 'required - url regex to add to scope (e.g. https://test.domain.local.*)',
|
178
|
-
# context_name: 'optional - context name to add target_regex to (defaults to Default Context)'
|
179
|
-
# )
|
180
|
-
|
181
|
-
public_class_method def self.add_to_scope(opts = {})
|
182
|
-
zap_obj = opts[:zap_obj]
|
183
|
-
api_key = zap_obj[:api_key].to_s.scrub
|
184
|
-
target_regex = opts[:target_regex]
|
185
|
-
raise 'ERROR: target_url must be provided' if target_regex.nil?
|
186
|
-
|
187
|
-
context_name = opts[:context_name] ||= 'Default Context'
|
188
|
-
|
189
|
-
params = {
|
190
|
-
apikey: api_key,
|
191
|
-
contextName: context_name,
|
192
|
-
regex: target_regex
|
193
|
-
}
|
194
|
-
|
195
|
-
response = zap_rest_call(
|
196
|
-
zap_obj: zap_obj,
|
197
|
-
rest_call: 'JSON/context/action/includeInContext/',
|
198
|
-
params: params
|
199
|
-
)
|
200
|
-
|
201
|
-
JSON.parse(response.body, symbolize_names: true)
|
202
|
-
rescue StandardError, SystemExit, Interrupt => e
|
203
|
-
stop(zap_obj: zap_obj) unless zap_obj.nil?
|
204
|
-
raise e
|
205
|
-
end
|
206
|
-
|
207
|
-
# Supported Method Parameters::
|
208
|
-
# PWN::Plugins::Zaproxy.add_requester_tab(
|
209
|
-
# zap_obj: 'required - zap_obj returned from #open method',
|
210
|
-
# request: 'required - base64 encoded HTTP request (e.g. from #get_sitemap method)'
|
211
|
-
# )
|
212
|
-
|
213
|
-
public_class_method def self.add_requester_tab(opts = {})
|
214
|
-
zap_obj = opts[:zap_obj]
|
215
|
-
api_key = zap_obj[:api_key].to_s.scrub
|
216
|
-
request = opts[:request]
|
217
|
-
|
218
|
-
dec_request = Base64.strict_decode64(request).force_encoding('ASCII-8BIT')
|
219
|
-
|
220
|
-
# Parse the full request string
|
221
|
-
parts = dec_request.split("\r\n\r\n", 2)
|
222
|
-
headers_part = parts[0]
|
223
|
-
body = parts[1] || ''
|
224
|
-
|
225
|
-
header_lines = headers_part.split("\r\n")
|
226
|
-
first_line = header_lines.shift
|
227
|
-
method, full_url, http_version = first_line.split
|
228
|
-
|
229
|
-
headers = []
|
230
|
-
header_lines.each do |line|
|
231
|
-
name, value = line.split(': ', 2)
|
232
|
-
headers << { name: name, value: value }
|
233
|
-
end
|
234
|
-
|
235
|
-
# Parse URL for queryString and adjust url
|
236
|
-
uri = URI.parse(full_url)
|
237
|
-
query_string = []
|
238
|
-
if uri.query
|
239
|
-
URI.decode_www_form(uri.query).each do |name, value|
|
240
|
-
query_string << { name: name, value: value }
|
241
|
-
end
|
242
|
-
end
|
243
|
-
url = "#{uri.scheme}://#{uri.host}"
|
244
|
-
url += ":#{uri.port}" if uri.port && uri.port != (uri.scheme == 'https' ? 443 : 80)
|
245
|
-
url += uri.path
|
246
|
-
|
247
|
-
# Determine content-type
|
248
|
-
content_type_header = headers.find { |h| h[:name].downcase == 'content-type' }
|
249
|
-
mime_type = content_type_header ? content_type_header[:value] : 'application/octet-stream'
|
250
|
-
|
251
|
-
# Handle postData
|
252
|
-
post_data = nil
|
253
|
-
methods_with_body = %w[POST PUT PATCH]
|
254
|
-
if methods_with_body.include?(method) && !body.empty?
|
255
|
-
post_data = {
|
256
|
-
mimeType: mime_type,
|
257
|
-
params: [],
|
258
|
-
text: body
|
259
|
-
}
|
260
|
-
|
261
|
-
temp_body = body.dup.force_encoding('UTF-8')
|
262
|
-
if temp_body.valid_encoding?
|
263
|
-
if mime_type.include?('application/x-www-form-urlencoded')
|
264
|
-
URI.decode_www_form(temp_body).each do |name, value|
|
265
|
-
post_data[:params] << { name: name, value: value }
|
266
|
-
end
|
267
|
-
end
|
268
|
-
else
|
269
|
-
post_data[:text] = Base64.encode64(body)
|
270
|
-
post_data[:encoding] = 'base64'
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
|
-
# Construct HAR request
|
275
|
-
har_request = {
|
276
|
-
method: method,
|
277
|
-
url: url,
|
278
|
-
httpVersion: http_version,
|
279
|
-
cookies: [],
|
280
|
-
headers: headers,
|
281
|
-
queryString: query_string,
|
282
|
-
headersSize: -1,
|
283
|
-
bodySize: -1
|
284
|
-
}
|
285
|
-
har_request[:postData] = post_data if post_data
|
286
|
-
|
287
|
-
har_json = JSON.generate(har_request)
|
288
|
-
|
289
|
-
params = {
|
290
|
-
apikey: api_key,
|
291
|
-
request: har_json,
|
292
|
-
followRedirects: 'true'
|
293
|
-
}
|
294
|
-
|
295
|
-
response = zap_rest_call(
|
296
|
-
zap_obj: zap_obj,
|
297
|
-
rest_call: 'OTHER/core/other/sendHarRequest/',
|
298
|
-
params: params
|
299
|
-
)
|
300
|
-
|
301
|
-
JSON.parse(response.body, symbolize_names: true)
|
302
|
-
rescue StandardError, SystemExit, Interrupt => e
|
303
|
-
stop(zap_obj: zap_obj) unless zap_obj.nil?
|
304
|
-
raise e
|
305
|
-
end
|
306
|
-
|
307
174
|
# Supported Method Parameters::
|
308
175
|
# json_sitemap = PWN::Plugins::Zaproxy.get_sitemap(
|
309
|
-
# zap_obj: 'required - zap_obj returned from #open method'
|
176
|
+
# zap_obj: 'required - zap_obj returned from #open method',
|
177
|
+
# return_as: 'optional - :base64 or :har (defaults to :base64)'
|
310
178
|
# )
|
311
179
|
|
312
180
|
public_class_method def self.get_sitemap(opts = {})
|
313
181
|
zap_obj = opts[:zap_obj]
|
314
182
|
api_key = zap_obj[:api_key].to_s.scrub
|
183
|
+
return_as = opts[:return_as] ||= :base64
|
315
184
|
|
316
185
|
entries = []
|
317
186
|
start = 0
|
@@ -333,6 +202,7 @@ module PWN
|
|
333
202
|
entries += new_entries
|
334
203
|
start += count
|
335
204
|
end
|
205
|
+
return entries if return_as == :har
|
336
206
|
|
337
207
|
# Deduplicate entries based on method + url
|
338
208
|
seen = Set.new
|
@@ -390,6 +260,102 @@ module PWN
|
|
390
260
|
raise e
|
391
261
|
end
|
392
262
|
|
263
|
+
# Supported Method Parameters::
|
264
|
+
# PWN::Plugins::Zaproxy.add_to_scope(
|
265
|
+
# zap_obj: 'required - zap_obj returned from #open method',
|
266
|
+
# target_regex: 'required - url regex to add to scope (e.g. https://test.domain.local.*)',
|
267
|
+
# context_name: 'optional - context name to add target_regex to (defaults to Default Context)'
|
268
|
+
# )
|
269
|
+
|
270
|
+
public_class_method def self.add_to_scope(opts = {})
|
271
|
+
zap_obj = opts[:zap_obj]
|
272
|
+
api_key = zap_obj[:api_key].to_s.scrub
|
273
|
+
target_regex = opts[:target_regex]
|
274
|
+
raise 'ERROR: target_url must be provided' if target_regex.nil?
|
275
|
+
|
276
|
+
context_name = opts[:context_name] ||= 'Default Context'
|
277
|
+
|
278
|
+
params = {
|
279
|
+
apikey: api_key,
|
280
|
+
contextName: context_name,
|
281
|
+
regex: target_regex
|
282
|
+
}
|
283
|
+
|
284
|
+
response = zap_rest_call(
|
285
|
+
zap_obj: zap_obj,
|
286
|
+
rest_call: 'JSON/context/action/includeInContext/',
|
287
|
+
params: params
|
288
|
+
)
|
289
|
+
|
290
|
+
JSON.parse(response.body, symbolize_names: true)
|
291
|
+
rescue StandardError, SystemExit, Interrupt => e
|
292
|
+
stop(zap_obj: zap_obj) unless zap_obj.nil?
|
293
|
+
raise e
|
294
|
+
end
|
295
|
+
|
296
|
+
# Supported Method Parameters::
|
297
|
+
# PWN::Plugins::Zaproxy.find_har_entries(
|
298
|
+
# zap_obj: 'required - zap_obj returned from #open method',
|
299
|
+
# search_string: 'required - string to search for in the sitemap entries'
|
300
|
+
# )
|
301
|
+
|
302
|
+
public_class_method def self.find_har_entries(opts = {})
|
303
|
+
zap_obj = opts[:zap_obj]
|
304
|
+
api_key = zap_obj[:api_key].to_s.scrub
|
305
|
+
search_string = opts[:search_string]
|
306
|
+
raise 'ERROR: search_string must be provided' if search_string.nil?
|
307
|
+
|
308
|
+
har_sitemap = get_sitemap(
|
309
|
+
zap_obj: zap_obj,
|
310
|
+
return_as: :har
|
311
|
+
)
|
312
|
+
|
313
|
+
har_entries = har_sitemap.select do |entry|
|
314
|
+
json_request = entry[:request].to_json
|
315
|
+
json_request.include?(search_string)
|
316
|
+
end
|
317
|
+
|
318
|
+
har_entries
|
319
|
+
rescue StandardError, SystemExit, Interrupt => e
|
320
|
+
stop(zap_obj: zap_obj) unless zap_obj.nil?
|
321
|
+
raise e
|
322
|
+
end
|
323
|
+
|
324
|
+
# Supported Method Parameters::
|
325
|
+
# PWN::Plugins::Zaproxy.requester(
|
326
|
+
# zap_obj: 'required - zap_obj returned from #open method',
|
327
|
+
# har_entry: 'required - har entry (e.g. from #get_sitemap method or #find_har_entries method)',
|
328
|
+
# redirect: 'optional - follow redirects if set to true (defaults to false)'
|
329
|
+
# )
|
330
|
+
|
331
|
+
public_class_method def self.requester(opts = {})
|
332
|
+
zap_obj = opts[:zap_obj]
|
333
|
+
api_key = zap_obj[:api_key].to_s.scrub
|
334
|
+
har_entry = opts[:har_entry]
|
335
|
+
raise 'ERROR: har_entry must be provided and be a valid HAR entry' unless har_entry.is_a?(Hash) && har_entry.key?(:request) && har_entry.key?(:response)
|
336
|
+
|
337
|
+
redirect = opts[:redirect] || false
|
338
|
+
raise 'ERROR: redirect must be a boolean' unless redirect.is_a?(TrueClass) || redirect.is_a?(FalseClass)
|
339
|
+
|
340
|
+
har_json = har_entry.to_json
|
341
|
+
params = {
|
342
|
+
apikey: api_key,
|
343
|
+
request: har_json,
|
344
|
+
followRedirects: redirect.to_s
|
345
|
+
}
|
346
|
+
|
347
|
+
response = zap_rest_call(
|
348
|
+
zap_obj: zap_obj,
|
349
|
+
rest_call: 'OTHER/exim/other/sendHarRequest/',
|
350
|
+
params: params
|
351
|
+
)
|
352
|
+
|
353
|
+
JSON.parse(response.body, symbolize_names: true)
|
354
|
+
rescue StandardError, SystemExit, Interrupt => e
|
355
|
+
stop(zap_obj: zap_obj) unless zap_obj.nil?
|
356
|
+
raise e
|
357
|
+
end
|
358
|
+
|
393
359
|
# Supported Method Parameters::
|
394
360
|
# PWN::Plugins::Zaproxy.spider(
|
395
361
|
# zap_obj: 'required - zap_obj returned from #open method',
|
@@ -785,19 +751,26 @@ module PWN
|
|
785
751
|
openapi_spec: 'required - path to OpenAPI JSON or YAML spec file'
|
786
752
|
)
|
787
753
|
|
754
|
+
#{self}.get_sitemap(
|
755
|
+
zap_obj: 'required - zap_obj returned from #open method',
|
756
|
+
return_as: 'optional - :base64 or :har (defaults to :base64)'
|
757
|
+
)
|
758
|
+
|
788
759
|
#{self}.add_to_scope(
|
789
760
|
zap_obj: 'required - zap_obj returned from #open method',
|
790
761
|
target_regex: 'required - url regex to add to scope (e.g. https://test.domain.local.*)',
|
791
762
|
context_name: 'optional - context name to add target_regex to (defaults to Default Context)'
|
792
763
|
)
|
793
764
|
|
794
|
-
#{self}.
|
765
|
+
#{self}.find_har_entries(
|
795
766
|
zap_obj: 'required - zap_obj returned from #open method',
|
796
|
-
|
767
|
+
search_string: 'required - string to search for in the sitemap entries'
|
797
768
|
)
|
798
769
|
|
799
|
-
#{self}.
|
800
|
-
zap_obj: 'required - zap_obj returned from #open method'
|
770
|
+
#{self}.requester(
|
771
|
+
zap_obj: 'required - zap_obj returned from #open method',
|
772
|
+
har_entry: 'required - har entry (e.g. from #get_sitemap method or #find_har_entries method)',
|
773
|
+
redirect: 'optional - follow redirects if set to true (defaults to true)'
|
801
774
|
)
|
802
775
|
|
803
776
|
json_sitemap = #{self}.spider(
|
data/lib/pwn/version.rb
CHANGED