pwn 0.4.728 → 0.4.730
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 +2 -2
- data/lib/pwn/plugins/black_duck_binary_analysis.rb +414 -68
- data/lib/pwn/plugins/open_ai.rb +4 -16
- data/lib/pwn/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7ccbfda03fe5f76d3a1c43c7bd628330c0e9c4d757ab402beb87aa1f6237c95
|
4
|
+
data.tar.gz: 07762b592179600911181ba24343235292eb879cd6b0690b77cc22d75e27c9e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 999906828628de7f537713a86a33a182897e1850762619c013d34cbda799af3eba0b14d27c257dbf8d13b10796431ea1afe78bc72ac385164c124ff12bc9ce78
|
7
|
+
data.tar.gz: 4f64da54f1a20cffb3c1fa2af71bb1c79c85a47073a7cdd0d6a49be7ae79bdc19fc8deb7aaab90ce9ac6b4986fe15df3dfff5f5bc6fce2a1d3eed01599cf609d
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.2.2@pwn
|
|
37
37
|
$ rvm list gemsets
|
38
38
|
$ gem install --verbose pwn
|
39
39
|
$ pwn
|
40
|
-
pwn[v0.4.
|
40
|
+
pwn[v0.4.730]:001 >>> PWN.help
|
41
41
|
```
|
42
42
|
|
43
43
|
[](https://youtu.be/G7iLUY4FzsI)
|
@@ -52,7 +52,7 @@ $ rvm use ruby-3.2.2@pwn
|
|
52
52
|
$ gem uninstall --all --executables pwn
|
53
53
|
$ gem install --verbose pwn
|
54
54
|
$ pwn
|
55
|
-
pwn[v0.4.
|
55
|
+
pwn[v0.4.730]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
|
@@ -17,6 +17,7 @@ module PWN
|
|
17
17
|
# http_method: 'optional HTTP method (defaults to GET)
|
18
18
|
# rest_call: 'required rest call to make per the schema',
|
19
19
|
# params: 'optional params passed in the URI or HTTP Headers',
|
20
|
+
# http_headers: 'optional HTTP headers sent in HTTP methods that support it e.g. POST'
|
20
21
|
# http_body: 'optional HTTP body sent in HTTP methods that support it e.g. POST'
|
21
22
|
# )
|
22
23
|
|
@@ -42,78 +43,46 @@ module PWN
|
|
42
43
|
spinner.auto_spin
|
43
44
|
|
44
45
|
case http_method
|
45
|
-
when :delete
|
46
|
+
when :delete, :get
|
47
|
+
headers = opts[:http_headers]
|
48
|
+
headers ||= {
|
49
|
+
content_type: content_type,
|
50
|
+
authorization: "Bearer #{token}",
|
51
|
+
params: params
|
52
|
+
}
|
46
53
|
response = rest_client.execute(
|
47
|
-
method:
|
54
|
+
method: http_method,
|
48
55
|
url: "#{base_bd_bin_analysis_api_uri}/#{rest_call}",
|
49
|
-
headers:
|
50
|
-
content_type: content_type,
|
51
|
-
authorization: "Bearer #{token}",
|
52
|
-
params: params
|
53
|
-
},
|
54
|
-
verify_ssl: false
|
55
|
-
)
|
56
|
-
|
57
|
-
when :get
|
58
|
-
response = rest_client.execute(
|
59
|
-
method: :get,
|
60
|
-
url: "#{base_bd_bin_analysis_api_uri}/#{rest_call}",
|
61
|
-
headers: {
|
62
|
-
content_type: content_type,
|
63
|
-
authorization: "Bearer #{token}",
|
64
|
-
params: params
|
65
|
-
},
|
56
|
+
headers: headers,
|
66
57
|
verify_ssl: false
|
67
58
|
)
|
68
59
|
|
69
|
-
when :post
|
60
|
+
when :post, :put
|
61
|
+
headers = opts[:http_headers]
|
70
62
|
if http_body.key?(:multipart)
|
63
|
+
headers ||= {
|
64
|
+
authorization: "Bearer #{token}"
|
65
|
+
}
|
71
66
|
response = rest_client.execute(
|
72
67
|
method: :post,
|
73
68
|
url: "#{base_bd_bin_analysis_api_uri}/#{rest_call}",
|
74
|
-
headers:
|
75
|
-
authorization: "Bearer #{token}"
|
76
|
-
},
|
77
|
-
payload: http_body,
|
78
|
-
verify_ssl: false
|
79
|
-
)
|
80
|
-
else
|
81
|
-
response = rest_client.execute(
|
82
|
-
method: :post,
|
83
|
-
url: "#{base_bd_bin_analysis_api_uri}/#{rest_call}",
|
84
|
-
headers: {
|
85
|
-
content_type: content_type,
|
86
|
-
authorization: "Bearer #{token}"
|
87
|
-
},
|
88
|
-
payload: http_body.to_json,
|
89
|
-
verify_ssl: false
|
90
|
-
)
|
91
|
-
end
|
92
|
-
|
93
|
-
when :put
|
94
|
-
if http_body.key?(:multipart)
|
95
|
-
response = rest_client.execute(
|
96
|
-
method: :put,
|
97
|
-
url: "#{base_bd_bin_analysis_api_uri}/#{rest_call}",
|
98
|
-
headers: {
|
99
|
-
authorization: "Bearer #{token}"
|
100
|
-
},
|
69
|
+
headers: headers,
|
101
70
|
payload: http_body,
|
102
71
|
verify_ssl: false
|
103
72
|
)
|
104
73
|
else
|
74
|
+
headers ||= {
|
75
|
+
content_type: content_type,
|
76
|
+
authorization: "Bearer #{token}"
|
77
|
+
}
|
105
78
|
response = rest_client.execute(
|
106
|
-
method:
|
79
|
+
method: http2_method,
|
107
80
|
url: "#{base_bd_bin_analysis_api_uri}/#{rest_call}",
|
108
|
-
headers:
|
109
|
-
content_type: content_type,
|
110
|
-
authorization: "Bearer #{token}"
|
111
|
-
},
|
81
|
+
headers: headers,
|
112
82
|
payload: http_body.to_json,
|
113
83
|
verify_ssl: false
|
114
84
|
)
|
115
85
|
end
|
116
|
-
|
117
86
|
else
|
118
87
|
raise @@logger.error("Unsupported HTTP Method #{http_method} for #{self} Plugin")
|
119
88
|
end
|
@@ -130,16 +99,16 @@ module PWN
|
|
130
99
|
end
|
131
100
|
|
132
101
|
# Supported Method Parameters::
|
133
|
-
# response = PWN::Plugins::BlackDuckBinaryAnalysis.
|
102
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_apps(
|
134
103
|
# token: 'required - Bearer token'
|
135
104
|
# )
|
136
105
|
|
137
|
-
public_class_method def self.
|
106
|
+
public_class_method def self.get_apps(opts = {})
|
138
107
|
token = opts[:token]
|
139
108
|
|
140
109
|
response = bd_bin_analysis_rest_call(
|
141
110
|
token: token,
|
142
|
-
rest_call: '
|
111
|
+
rest_call: 'apps'
|
143
112
|
)
|
144
113
|
|
145
114
|
JSON.parse(response, symbolize_names: true)
|
@@ -148,18 +117,18 @@ module PWN
|
|
148
117
|
end
|
149
118
|
|
150
119
|
# Supported Method Parameters::
|
151
|
-
# response = PWN::Plugins::BlackDuckBinaryAnalysis.
|
120
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_apps_by_group(
|
152
121
|
# token: 'required - Bearer token',
|
153
122
|
# group_id: 'required - group id'
|
154
123
|
# )
|
155
124
|
|
156
|
-
public_class_method def self.
|
125
|
+
public_class_method def self.get_apps_by_group(opts = {})
|
157
126
|
token = opts[:token]
|
158
127
|
group_id = opts[:group_id]
|
159
128
|
|
160
129
|
response = bd_bin_analysis_rest_call(
|
161
130
|
token: token,
|
162
|
-
rest_call: "
|
131
|
+
rest_call: "apps/#{group_id}"
|
163
132
|
)
|
164
133
|
|
165
134
|
JSON.parse(response, symbolize_names: true)
|
@@ -170,8 +139,7 @@ module PWN
|
|
170
139
|
# Supported Method Parameters::
|
171
140
|
# response = PWN::Plugins::BlackDuckBinaryAnalysis.upload_file(
|
172
141
|
# token: 'required - Bearer token',
|
173
|
-
# file: 'required - file to upload'
|
174
|
-
# purpose: 'optional - intended purpose of the uploaded documents (defaults to fine-tune'
|
142
|
+
# file: 'required - file to upload'
|
175
143
|
# )
|
176
144
|
|
177
145
|
public_class_method def self.upload_file(opts = {})
|
@@ -179,19 +147,20 @@ module PWN
|
|
179
147
|
file = opts[:file]
|
180
148
|
raise "ERROR: #{file} not found." unless File.exist?(file)
|
181
149
|
|
182
|
-
|
183
|
-
|
150
|
+
http_headers = {
|
151
|
+
authorization: "Bearer #{token}"
|
152
|
+
}
|
184
153
|
|
185
154
|
http_body = {
|
186
155
|
multipart: true,
|
187
|
-
file: File.new(file, 'rb')
|
188
|
-
purpose: purpose
|
156
|
+
file: File.new(file, 'rb')
|
189
157
|
}
|
190
158
|
|
191
159
|
response = bd_bin_analysis_rest_call(
|
192
160
|
http_method: :post,
|
193
161
|
token: token,
|
194
162
|
rest_call: 'files',
|
163
|
+
http_headers: http_headers,
|
195
164
|
http_body: http_body
|
196
165
|
)
|
197
166
|
|
@@ -200,6 +169,311 @@ module PWN
|
|
200
169
|
raise e
|
201
170
|
end
|
202
171
|
|
172
|
+
# Supported Method Parameters::
|
173
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_tasks(
|
174
|
+
# token: 'required - Bearer token'
|
175
|
+
# )
|
176
|
+
|
177
|
+
public_class_method def self.get_tasks(opts = {})
|
178
|
+
token = opts[:token]
|
179
|
+
|
180
|
+
response = bd_bin_analysis_rest_call(
|
181
|
+
token: token,
|
182
|
+
rest_call: 'tasks'
|
183
|
+
)
|
184
|
+
|
185
|
+
JSON.parse(response, symbolize_names: true)
|
186
|
+
rescue StandardError => e
|
187
|
+
raise e
|
188
|
+
end
|
189
|
+
|
190
|
+
# Supported Method Parameters::
|
191
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_groups(
|
192
|
+
# token: 'required - Bearer token'
|
193
|
+
# )
|
194
|
+
|
195
|
+
public_class_method def self.get_groups(opts = {})
|
196
|
+
token = opts[:token]
|
197
|
+
|
198
|
+
response = bd_bin_analysis_rest_call(
|
199
|
+
token: token,
|
200
|
+
rest_call: 'groups'
|
201
|
+
)
|
202
|
+
|
203
|
+
JSON.parse(response, symbolize_names: true)
|
204
|
+
rescue StandardError => e
|
205
|
+
raise e
|
206
|
+
end
|
207
|
+
|
208
|
+
# Supported Method Parameters::
|
209
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.create_group(
|
210
|
+
# token: 'required - Bearer token',
|
211
|
+
# name: 'required - group name',
|
212
|
+
# desc: 'optional - group description',
|
213
|
+
# parent: 'optional - parent group id',
|
214
|
+
# delete_binary: 'optional - delete binary after analysis C|Y|N (Default: C== company default)',
|
215
|
+
# binary_cleanup_age: 'optional - after how long the binary will be deleted in seconds (Default: 604_800 / 1 week)',
|
216
|
+
# product_cleanup_age: 'optional - after how long the product will be deleted in seconds (Default: 604_800 / 1 week)',
|
217
|
+
# file_download_enabled: 'optional - allow download of uploaded binaries from group (Default: false),
|
218
|
+
# low_risk_tolerance: 'optional - low risk tolerance nil|true|false (Default: nil == company default)',
|
219
|
+
# include_historical_vulns: 'optional - include historical vulns nil|true|false (Default: nil == company default)',
|
220
|
+
# cvss3_fallback: 'optional - cvss3 fallback nil|true|false (Default: nil == company default)',
|
221
|
+
# assume_unknown_version_as_latest: 'optional - assume unknown version as latest nil|true|false (Default: nil == company default)',
|
222
|
+
# custom_data: 'optional - custom data hash (see group metadata for details)',
|
223
|
+
# scan_infoleak: 'optional - scan infoleak nil|true|false (Default: nil == company default)',
|
224
|
+
# code_analysis: 'optional - code analysis nil|true|false (Default: nil == company default)',
|
225
|
+
# scan_code_similarity: 'optional - scan code similarity nil|true|false (Default: nil == company default)'
|
226
|
+
# )
|
227
|
+
|
228
|
+
public_class_method def self.create_group(opts = {})
|
229
|
+
token = opts[:token]
|
230
|
+
name = opts[:name]
|
231
|
+
desc = opts[:desc]
|
232
|
+
parent = opts[:parent]
|
233
|
+
delete_binary = opts[:delete_binary] ||= 'C'
|
234
|
+
binary_cleanup_age = opts[:binary_cleanup_age] ||= 604_800
|
235
|
+
product_cleanup_age = opts[:product_cleanup_age] ||= 604_800
|
236
|
+
file_download_enabled = opts[:file_download_enabled] ||= false
|
237
|
+
low_risk_tolerance = opts[:low_risk_tolerance]
|
238
|
+
include_historical_vulns = opts[:include_historical_vulns]
|
239
|
+
cvss3_fallback = opts[:cvss3_fallback]
|
240
|
+
assume_unknown_version_as_latest = opts[:assume_unknown_version_as_latest]
|
241
|
+
custom_data = opts[:custom_data]
|
242
|
+
scan_infoleak = opts[:scan_infoleak]
|
243
|
+
code_analysis = opts[:code_analysis]
|
244
|
+
scan_code_similarity = opts[:scan_code_similarity]
|
245
|
+
|
246
|
+
http_headers = {
|
247
|
+
authorization: "Bearer #{token}",
|
248
|
+
name: name,
|
249
|
+
description: desc,
|
250
|
+
parent: parent,
|
251
|
+
delete_binary_after_scan: delete_binary,
|
252
|
+
binary_cleanup_age: binary_cleanup_age,
|
253
|
+
product_cleanup_age: product_cleanup_age,
|
254
|
+
file_download_enabled: file_download_enabled,
|
255
|
+
low_risk_tolerance: low_risk_tolerance,
|
256
|
+
include_historical_vulnerabilities: include_historical_vulns,
|
257
|
+
cvss3_fallback: cvss3_fallback,
|
258
|
+
assume_unknown_version_as_latest: assume_unknown_version_as_latest,
|
259
|
+
custom_data: custom_data,
|
260
|
+
scan_infoleak: scan_infoleak,
|
261
|
+
code_analysis: code_analysis,
|
262
|
+
scan_code_similarity: scan_code_similarity
|
263
|
+
}
|
264
|
+
|
265
|
+
response = bd_bin_analysis_rest_call(
|
266
|
+
http_method: :post,
|
267
|
+
token: token,
|
268
|
+
rest_call: 'groups',
|
269
|
+
http_headers: http_headers
|
270
|
+
)
|
271
|
+
|
272
|
+
JSON.parse(response, symbolize_names: true)
|
273
|
+
rescue StandardError => e
|
274
|
+
raise e
|
275
|
+
end
|
276
|
+
|
277
|
+
# Supported Method Parameters::
|
278
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_group_details(
|
279
|
+
# token: 'required - Bearer token',
|
280
|
+
# group_id: 'required - group id'
|
281
|
+
# )
|
282
|
+
|
283
|
+
public_class_method def self.get_group_details(opts = {})
|
284
|
+
token = opts[:token]
|
285
|
+
group_id = opts[:group_id]
|
286
|
+
|
287
|
+
response = bd_bin_analysis_rest_call(
|
288
|
+
token: token,
|
289
|
+
rest_call: "groups/#{group_id}"
|
290
|
+
)
|
291
|
+
|
292
|
+
JSON.parse(response, symbolize_names: true)
|
293
|
+
rescue StandardError => e
|
294
|
+
raise e
|
295
|
+
end
|
296
|
+
|
297
|
+
# Supported Method Parameters::
|
298
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_licenses(
|
299
|
+
# token: 'required - Bearer token'
|
300
|
+
# )
|
301
|
+
|
302
|
+
public_class_method def self.get_licenses(opts = {})
|
303
|
+
token = opts[:token]
|
304
|
+
|
305
|
+
response = bd_bin_analysis_rest_call(
|
306
|
+
token: token,
|
307
|
+
rest_call: 'licenses'
|
308
|
+
)
|
309
|
+
|
310
|
+
JSON.parse(response, symbolize_names: true)
|
311
|
+
rescue StandardError => e
|
312
|
+
raise e
|
313
|
+
end
|
314
|
+
|
315
|
+
# Supported Method Parameters::
|
316
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_component_licenses(
|
317
|
+
# token: 'required - Bearer token'
|
318
|
+
# )
|
319
|
+
|
320
|
+
public_class_method def self.get_component_licenses(opts = {})
|
321
|
+
token = opts[:token]
|
322
|
+
|
323
|
+
response = bd_bin_analysis_rest_call(
|
324
|
+
token: token,
|
325
|
+
rest_call: 'component-licenses'
|
326
|
+
)
|
327
|
+
|
328
|
+
JSON.parse(response, symbolize_names: true)
|
329
|
+
rescue StandardError => e
|
330
|
+
raise e
|
331
|
+
end
|
332
|
+
|
333
|
+
# Supported Method Parameters::
|
334
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_tags(
|
335
|
+
# token: 'required - Bearer token'
|
336
|
+
# )
|
337
|
+
|
338
|
+
public_class_method def self.get_tags(opts = {})
|
339
|
+
token = opts[:token]
|
340
|
+
|
341
|
+
response = bd_bin_analysis_rest_call(
|
342
|
+
token: token,
|
343
|
+
rest_call: 'tags'
|
344
|
+
)
|
345
|
+
|
346
|
+
JSON.parse(response, symbolize_names: true)
|
347
|
+
rescue StandardError => e
|
348
|
+
raise e
|
349
|
+
end
|
350
|
+
|
351
|
+
# Supported Method Parameters::
|
352
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_vulnerabilities(
|
353
|
+
# token: 'required - Bearer token'
|
354
|
+
# )
|
355
|
+
|
356
|
+
public_class_method def self.get_vulnerabilities(opts = {})
|
357
|
+
token = opts[:token]
|
358
|
+
|
359
|
+
response = bd_bin_analysis_rest_call(
|
360
|
+
token: token,
|
361
|
+
rest_call: 'vulnerabilities'
|
362
|
+
)
|
363
|
+
|
364
|
+
JSON.parse(response, symbolize_names: true)
|
365
|
+
rescue StandardError => e
|
366
|
+
raise e
|
367
|
+
end
|
368
|
+
|
369
|
+
# Supported Method Parameters::
|
370
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_components(
|
371
|
+
# token: 'required - Bearer token'
|
372
|
+
# )
|
373
|
+
|
374
|
+
public_class_method def self.get_components(opts = {})
|
375
|
+
token = opts[:token]
|
376
|
+
|
377
|
+
response = bd_bin_analysis_rest_call(
|
378
|
+
token: token,
|
379
|
+
rest_call: 'components'
|
380
|
+
)
|
381
|
+
|
382
|
+
JSON.parse(response, symbolize_names: true)
|
383
|
+
rescue StandardError => e
|
384
|
+
raise e
|
385
|
+
end
|
386
|
+
|
387
|
+
# Supported Method Parameters::
|
388
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_vendor_vulns(
|
389
|
+
# token: 'required - Bearer token'
|
390
|
+
# )
|
391
|
+
|
392
|
+
public_class_method def self.get_vendor_vulns(opts = {})
|
393
|
+
token = opts[:token]
|
394
|
+
|
395
|
+
response = bd_bin_analysis_rest_call(
|
396
|
+
token: token,
|
397
|
+
rest_call: 'teacher/api/vulns'
|
398
|
+
)
|
399
|
+
|
400
|
+
JSON.parse(response, symbolize_names: true)
|
401
|
+
rescue StandardError => e
|
402
|
+
raise e
|
403
|
+
end
|
404
|
+
|
405
|
+
# Supported Method Parameters::
|
406
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_audit_trail(
|
407
|
+
# token: 'required - Bearer token'
|
408
|
+
# )
|
409
|
+
|
410
|
+
public_class_method def self.get_audit_trail(opts = {})
|
411
|
+
token = opts[:token]
|
412
|
+
|
413
|
+
response = bd_bin_analysis_rest_call(
|
414
|
+
token: token,
|
415
|
+
rest_call: 'audit-trail'
|
416
|
+
)
|
417
|
+
|
418
|
+
JSON.parse(response, symbolize_names: true)
|
419
|
+
rescue StandardError => e
|
420
|
+
raise e
|
421
|
+
end
|
422
|
+
|
423
|
+
# Supported Method Parameters::
|
424
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_status(
|
425
|
+
# token: 'required - Bearer token'
|
426
|
+
# )
|
427
|
+
|
428
|
+
public_class_method def self.get_status(opts = {})
|
429
|
+
token = opts[:token]
|
430
|
+
|
431
|
+
response = bd_bin_analysis_rest_call(
|
432
|
+
token: token,
|
433
|
+
rest_call: 'status'
|
434
|
+
)
|
435
|
+
|
436
|
+
JSON.parse(response, symbolize_names: true)
|
437
|
+
rescue StandardError => e
|
438
|
+
raise e
|
439
|
+
end
|
440
|
+
|
441
|
+
# Supported Method Parameters::
|
442
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_service_info(
|
443
|
+
# token: 'required - Bearer token'
|
444
|
+
# )
|
445
|
+
|
446
|
+
public_class_method def self.get_service_info(opts = {})
|
447
|
+
token = opts[:token]
|
448
|
+
|
449
|
+
response = bd_bin_analysis_rest_call(
|
450
|
+
token: token,
|
451
|
+
rest_call: 'service/info'
|
452
|
+
)
|
453
|
+
|
454
|
+
JSON.parse(response, symbolize_names: true)
|
455
|
+
rescue StandardError => e
|
456
|
+
raise e
|
457
|
+
end
|
458
|
+
|
459
|
+
# Supported Method Parameters::
|
460
|
+
# response = PWN::Plugins::BlackDuckBinaryAnalysis.get_service_version(
|
461
|
+
# token: 'required - Bearer token'
|
462
|
+
# )
|
463
|
+
|
464
|
+
public_class_method def self.get_service_version(opts = {})
|
465
|
+
token = opts[:token]
|
466
|
+
|
467
|
+
response = bd_bin_analysis_rest_call(
|
468
|
+
token: token,
|
469
|
+
rest_call: 'service/version'
|
470
|
+
)
|
471
|
+
|
472
|
+
JSON.parse(response, symbolize_names: true)
|
473
|
+
rescue StandardError => e
|
474
|
+
raise e
|
475
|
+
end
|
476
|
+
|
203
477
|
# Author(s):: 0day Inc. <request.pentest@0dayinc.com>
|
204
478
|
|
205
479
|
public_class_method def self.authors
|
@@ -212,18 +486,90 @@ module PWN
|
|
212
486
|
|
213
487
|
public_class_method def self.help
|
214
488
|
puts "USAGE:
|
489
|
+
response = #{self}.get_apps(
|
490
|
+
token: 'required - Bearer token'
|
491
|
+
)
|
492
|
+
|
493
|
+
response = #{self}.upload_file(
|
494
|
+
token: 'required - Black Duck Binary Analysis API token',
|
495
|
+
file: 'required - file to upload'
|
496
|
+
)
|
497
|
+
|
498
|
+
response = #{self}.get_tasks(
|
499
|
+
token: 'required - Bearer token'
|
500
|
+
)
|
501
|
+
|
502
|
+
response = #{self}.get_apps_by_group(
|
503
|
+
token: 'required - Bearer token',
|
504
|
+
group_id: 'required - group id'
|
505
|
+
)
|
506
|
+
|
215
507
|
response = #{self}.get_groups(
|
216
508
|
token: 'required - Bearer token'
|
217
509
|
)
|
218
510
|
|
511
|
+
response = #{self}.create_group(
|
512
|
+
token: 'required - Bearer token',
|
513
|
+
name: 'required - group name',
|
514
|
+
desc: 'optional - group description',
|
515
|
+
parent: 'optional - parent group id',
|
516
|
+
delete_binary: 'optional - delete binary after analysis C|Y|N (Default: C== company default)',
|
517
|
+
binary_cleanup_age: 'optional - after how long the binary will be deleted in seconds (Default: 604_800 / 1 week)',
|
518
|
+
product_cleanup_age: 'optional - after how long the product will be deleted in seconds (Default: 604_800 / 1 week)',
|
519
|
+
file_download_enabled: 'optional - allow download of uploaded binaries from group (Default: false),
|
520
|
+
low_risk_tolerance: 'optional - low risk tolerance nil|true|false (Default: nil == company default)',
|
521
|
+
include_historical_vulns: 'optional - include historical vulns nil|true|false (Default: nil == company default)',
|
522
|
+
cvss3_fallback: 'optional - cvss3 fallback nil|true|false (Default: nil == company default)',
|
523
|
+
assume_unknown_version_as_latest: 'optional - assume unknown version as latest nil|true|false (Default: nil == company default)',
|
524
|
+
custom_data: 'optional - custom data hash (see group metadata for details)',
|
525
|
+
scan_infoleak: 'optional - scan infoleak nil|true|false (Default: nil == company default)',
|
526
|
+
code_analysis: 'optional - code analysis nil|true|false (Default: nil == company default)',
|
527
|
+
scan_code_similarity: 'optional - scan code similarity nil|true|false (Default: nil == company default)'
|
528
|
+
)
|
529
|
+
|
219
530
|
response = #{self}.get_group_details(
|
220
531
|
token: 'required - Bearer token',
|
221
532
|
group_id: 'required - group id'
|
222
533
|
)
|
223
534
|
|
224
|
-
response = #{self}.
|
225
|
-
token: 'required -
|
226
|
-
|
535
|
+
response = #{self}.get_licenses(
|
536
|
+
token: 'required - Bearer token'
|
537
|
+
)
|
538
|
+
|
539
|
+
response = #{self}.get_component_licenses(
|
540
|
+
token: 'required - Bearer token'
|
541
|
+
)
|
542
|
+
|
543
|
+
response = #{self}.get_tags(
|
544
|
+
token: 'required - Bearer token'
|
545
|
+
)
|
546
|
+
|
547
|
+
response = #{self}.get_vulnerabilities(
|
548
|
+
token: 'required - Bearer token'
|
549
|
+
)
|
550
|
+
|
551
|
+
response = #{self}.get_components(
|
552
|
+
token: 'required - Bearer token'
|
553
|
+
)
|
554
|
+
|
555
|
+
response = #{self}.get_vendor_vulns(
|
556
|
+
token: 'required - Bearer token'
|
557
|
+
)
|
558
|
+
|
559
|
+
response = #{self}.get_audit_trail(
|
560
|
+
token: 'required - Bearer token'
|
561
|
+
)
|
562
|
+
|
563
|
+
response = #{self}.get_status(
|
564
|
+
token: 'required - Bearer token'
|
565
|
+
)
|
566
|
+
|
567
|
+
response = #{self}.get_service_info(
|
568
|
+
token: 'required - Bearer token'
|
569
|
+
)
|
570
|
+
|
571
|
+
response = #{self}.get_service_version(
|
572
|
+
token: 'required - Bearer token'
|
227
573
|
)
|
228
574
|
|
229
575
|
#{self}.authors
|
data/lib/pwn/plugins/open_ai.rb
CHANGED
@@ -42,21 +42,9 @@ module PWN
|
|
42
42
|
spinner.auto_spin
|
43
43
|
|
44
44
|
case http_method
|
45
|
-
when :delete
|
45
|
+
when :delete, :get
|
46
46
|
response = rest_client.execute(
|
47
|
-
method:
|
48
|
-
url: "#{base_open_ai_api_uri}/#{rest_call}",
|
49
|
-
headers: {
|
50
|
-
content_type: content_type,
|
51
|
-
authorization: "Bearer #{token}",
|
52
|
-
params: params
|
53
|
-
},
|
54
|
-
verify_ssl: false
|
55
|
-
)
|
56
|
-
|
57
|
-
when :get
|
58
|
-
response = rest_client.execute(
|
59
|
-
method: :get,
|
47
|
+
method: http2_method,
|
60
48
|
url: "#{base_open_ai_api_uri}/#{rest_call}",
|
61
49
|
headers: {
|
62
50
|
content_type: content_type,
|
@@ -69,7 +57,7 @@ module PWN
|
|
69
57
|
when :post
|
70
58
|
if http_body.key?(:multipart)
|
71
59
|
response = rest_client.execute(
|
72
|
-
method:
|
60
|
+
method: http_method,
|
73
61
|
url: "#{base_open_ai_api_uri}/#{rest_call}",
|
74
62
|
headers: {
|
75
63
|
authorization: "Bearer #{token}"
|
@@ -79,7 +67,7 @@ module PWN
|
|
79
67
|
)
|
80
68
|
else
|
81
69
|
response = rest_client.execute(
|
82
|
-
method:
|
70
|
+
method: http_method,
|
83
71
|
url: "#{base_open_ai_api_uri}/#{rest_call}",
|
84
72
|
headers: {
|
85
73
|
content_type: content_type,
|
data/lib/pwn/version.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.730
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|