pwn 0.4.450 → 0.4.453
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/bin/{pwn_nessus_cloud_create_scan → pwn_nessus_cloud_scan_crud} +37 -15
- data/bin/pwn_nessus_cloud_vulnscan +4 -4
- data/lib/pwn/plugins/nessus_cloud.rb +86 -19
- data/lib/pwn/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d64b12862bb3a18f0c36844a624e8e56811a7d2f6239ed14b6f0565c1022b0cf
|
4
|
+
data.tar.gz: 2a377a1f995b09e45a41c191fd62cfc36ee46beb4ca4cf0d59ee8de1a201fbea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1a0e45b48efe8801fa1d51d2fa023bec8e9a27aa28f84de6b1604a78e9b16cf14bbe8573dd4d7589a04f171fd84ec99feb67646c4e0ad2988715460ae09cec5
|
7
|
+
data.tar.gz: 0c74c65d52765c544ee0c79c2a89c7154f969e91799eba1363a2e04d94871b7b5bd13ab27443f7fc0135011b11b72ddcf8ed147bc8cc644c5e06e976595a05f2
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ $ rvm use ruby-3.1.2@pwn
|
|
37
37
|
$ rvm list gemsets
|
38
38
|
$ gem install --verbose pwn
|
39
39
|
$ pwn
|
40
|
-
pwn[v0.4.
|
40
|
+
pwn[v0.4.453]: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.1.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.453]:001 >>> PWN.help
|
56
56
|
```
|
57
57
|
|
58
58
|
|
@@ -32,7 +32,7 @@ OptionParser.new do |options|
|
|
32
32
|
end
|
33
33
|
|
34
34
|
options.on('-tVALUE', '--scan-template=VALUE', '<Optional - Canned Scan Template to Use for Scan Creation (Defaults to "Basic Network Scan">') do |t|
|
35
|
-
opts[:
|
35
|
+
opts[:scan_template_name] = t
|
36
36
|
end
|
37
37
|
|
38
38
|
options.on('-pPOLICY', '--policy-name=POLICY', '<Optional - Policy to Use to Create the Scan>') do |p|
|
@@ -116,8 +116,8 @@ begin
|
|
116
116
|
# Optional Arguments
|
117
117
|
scan_desc = opts[:scan_desc]
|
118
118
|
|
119
|
-
|
120
|
-
|
119
|
+
scan_template_name = opts[:scan_template_name]
|
120
|
+
scan_template_name ||= 'Basic Network Scan'
|
121
121
|
|
122
122
|
policy_name = opts[:policy_name]
|
123
123
|
policy_name ||= ''
|
@@ -204,17 +204,18 @@ begin
|
|
204
204
|
secret_key: secret_key
|
205
205
|
)
|
206
206
|
|
207
|
-
# Requirements to create a scan:
|
207
|
+
# Requirements to update / create a scan:
|
208
208
|
# Part 1: Populate uuid
|
209
209
|
# Part 2: Populate settings object from options passed to driver
|
210
210
|
# Part 3: Populate credentials object from YAML config (optional)
|
211
211
|
# Part 4: Populate plugins object from YAML config (optional)
|
212
|
+
# Part 5: Update Scan if it exists, or create it.
|
212
213
|
|
213
214
|
# Part 1: Populate uuid
|
214
215
|
# TODO: add --list-canned-scan-templates option
|
215
216
|
scan_template = PWN::Plugins::NessusCloud.get_canned_scan_templates(
|
216
217
|
nessus_obj: nessus_obj,
|
217
|
-
name:
|
218
|
+
name: scan_template_name
|
218
219
|
)
|
219
220
|
scan_template_uuid = scan_template[:uuid]
|
220
221
|
puts scan_template_uuid
|
@@ -275,15 +276,17 @@ begin
|
|
275
276
|
nessus_obj: nessus_obj,
|
276
277
|
name: tag_name
|
277
278
|
)
|
279
|
+
tag_uuid = tag[:uuid] if tag.any?
|
280
|
+
tag_uuids_arr.push(tag_uuid) if tag.any?
|
278
281
|
next if tag.any?
|
279
282
|
|
280
|
-
|
281
|
-
tag_uuids_arr.push(tag_uuid)
|
282
|
-
PWN::Plugins::NessusCloud.create_tag(
|
283
|
+
new_tag = PWN::Plugins::NessusCloud.create_tag(
|
283
284
|
nessus_obj: nessus_obj,
|
284
285
|
category: tag_category_name,
|
285
286
|
value: tag_name
|
286
287
|
)
|
288
|
+
tag_uuid = new_tag[:uuid]
|
289
|
+
tag_uuids_arr.push(tag_uuid)
|
287
290
|
end
|
288
291
|
|
289
292
|
settings[:tag_targets] = tag_uuids_arr
|
@@ -305,15 +308,34 @@ begin
|
|
305
308
|
# Part 4: Populate plugins object from YAML config (optional)
|
306
309
|
plugins = yaml[:plugins] if yaml[:plugins]
|
307
310
|
|
308
|
-
|
311
|
+
# Part 5: Update Scan if it exists, or create it.
|
312
|
+
scan = PWN::Plugins::NessusCloud.get_scans(
|
309
313
|
nessus_obj: nessus_obj,
|
310
|
-
|
311
|
-
settings: settings,
|
312
|
-
credentials: credentials,
|
313
|
-
plugins: plugins
|
314
|
+
name: scan_name
|
314
315
|
)
|
315
|
-
|
316
|
-
|
316
|
+
if scan.any?
|
317
|
+
scan_uuid = scan[:uuid]
|
318
|
+
update_scan_resp = PWN::Plugins::NessusCloud.update_scan(
|
319
|
+
nessus_obj: nessus_obj,
|
320
|
+
scan_uuid: scan_uuid,
|
321
|
+
scan_template_uuid: scan_template_uuid,
|
322
|
+
settings: settings,
|
323
|
+
credentials: credentials,
|
324
|
+
plugins: plugins
|
325
|
+
)
|
326
|
+
|
327
|
+
puts update_scan_resp.inspect
|
328
|
+
else
|
329
|
+
create_scan_resp = PWN::Plugins::NessusCloud.create_scan(
|
330
|
+
nessus_obj: nessus_obj,
|
331
|
+
scan_template_uuid: scan_template_uuid,
|
332
|
+
settings: settings,
|
333
|
+
credentials: credentials,
|
334
|
+
plugins: plugins
|
335
|
+
)
|
336
|
+
|
337
|
+
puts create_scan_resp.inspect
|
338
|
+
end
|
317
339
|
rescue Interrupt
|
318
340
|
puts 'CTRL+C detected...goodbye.'
|
319
341
|
rescue StandardError => e
|
@@ -58,11 +58,11 @@ begin
|
|
58
58
|
nessus_obj: nessus_obj,
|
59
59
|
name: scan_name
|
60
60
|
)
|
61
|
-
|
61
|
+
scan_uuid = scan[:uuid]
|
62
62
|
|
63
63
|
PWN::Plugins::NessusCloud.launch_scan(
|
64
64
|
nessus_obj: nessus_obj,
|
65
|
-
|
65
|
+
scan_uuid: scan_uuid
|
66
66
|
)
|
67
67
|
|
68
68
|
scan_status = 'initializing'
|
@@ -73,7 +73,7 @@ begin
|
|
73
73
|
|
74
74
|
scan_status_resp = PWN::Plugins::NessusCloud.get_scan_status(
|
75
75
|
nessus_obj: nessus_obj,
|
76
|
-
|
76
|
+
scan_uuid: scan_uuid
|
77
77
|
)
|
78
78
|
|
79
79
|
scan_status = scan_status_resp[:status]
|
@@ -87,7 +87,7 @@ begin
|
|
87
87
|
print "Exporting results to #{path_to_export}..."
|
88
88
|
PWN::Plugins::NessusCloud.export_scan_results(
|
89
89
|
nessus_obj: nessus_obj,
|
90
|
-
|
90
|
+
scan_uuid: scan_uuid,
|
91
91
|
path_to_export: path_to_export,
|
92
92
|
format: format
|
93
93
|
)
|
@@ -46,6 +46,19 @@ module PWN
|
|
46
46
|
verify_ssl: false
|
47
47
|
)
|
48
48
|
|
49
|
+
when :put
|
50
|
+
response = rest_client.execute(
|
51
|
+
method: :put,
|
52
|
+
url: "#{base_nessus_cloud_api_uri}/#{rest_call}",
|
53
|
+
headers: {
|
54
|
+
x_apikeys: "accessKey=#{access_key}; secretKey=#{secret_key}",
|
55
|
+
accept: 'application/json',
|
56
|
+
content_type: 'application/json; charset=UTF-8'
|
57
|
+
},
|
58
|
+
payload: http_body,
|
59
|
+
verify_ssl: false
|
60
|
+
)
|
61
|
+
|
49
62
|
when :post
|
50
63
|
response = rest_client.execute(
|
51
64
|
method: :post,
|
@@ -442,20 +455,57 @@ module PWN
|
|
442
455
|
raise e
|
443
456
|
end
|
444
457
|
|
458
|
+
# Supported Method Parameters::
|
459
|
+
# PWN::Plugins::NessusCloud.update_scan(
|
460
|
+
# nessus_obj: 'required - nessus_obj returned from #login method',
|
461
|
+
# scan_uuid: 'required - the scan UUID to update. Run #get_scans for a list of UUIDs',
|
462
|
+
# scan_template_uuid: 'required - the UUID for the Tenable-provided scan template to use. Run #get_canned_scan_templates for a list of UUIDs',
|
463
|
+
# settings: 'required - settings object as defined by https://developer.tenable.com/reference/scans-create',
|
464
|
+
# credentials: 'required - credentials object as defined by https://developer.tenable.com/reference/scans-create',
|
465
|
+
# plugins: 'optional - plugins object as defined by https://developer.tenable.com/reference/scans-create (Defaults to {})'
|
466
|
+
# )
|
467
|
+
|
468
|
+
public_class_method def self.update_scan(opts = {})
|
469
|
+
nessus_obj = opts[:nessus_obj]
|
470
|
+
scan_uuid = opts[:scan_uuid]
|
471
|
+
scan_template_uuid = opts[:scan_template_uuid]
|
472
|
+
settings = opts[:settings]
|
473
|
+
credentials = opts[:credentials]
|
474
|
+
plugins = opts[:plugins]
|
475
|
+
|
476
|
+
http_body = {
|
477
|
+
uuid: scan_template_uuid,
|
478
|
+
settings: settings,
|
479
|
+
credentials: credentials,
|
480
|
+
plugins: plugins
|
481
|
+
}.to_json
|
482
|
+
|
483
|
+
update_scan_resp = nessus_cloud_rest_call(
|
484
|
+
http_method: :put,
|
485
|
+
nessus_obj: nessus_obj,
|
486
|
+
rest_call: "scans/#{scan_uuid}",
|
487
|
+
http_body: http_body
|
488
|
+
).body
|
489
|
+
|
490
|
+
JSON.parse(update_scan_resp, symbolize_names: true)
|
491
|
+
rescue StandardError, SystemExit, Interrupt => e
|
492
|
+
raise e
|
493
|
+
end
|
494
|
+
|
445
495
|
# Supported Method Parameters::
|
446
496
|
# PWN::Plugins::NessusCloud.launch_scan(
|
447
497
|
# nessus_obj: 'required - nessus_obj returned from #login method',
|
448
|
-
#
|
498
|
+
# scan_uuid: 'required - scan uuid to launch'
|
449
499
|
# )
|
450
500
|
|
451
501
|
public_class_method def self.launch_scan(opts = {})
|
452
502
|
nessus_obj = opts[:nessus_obj]
|
453
|
-
|
503
|
+
scan_uuid = opts[:scan_uuid]
|
454
504
|
|
455
505
|
launch_scan_resp = nessus_cloud_rest_call(
|
456
506
|
http_method: :post,
|
457
507
|
nessus_obj: nessus_obj,
|
458
|
-
rest_call: "scans/#{
|
508
|
+
rest_call: "scans/#{scan_uuid}/launch"
|
459
509
|
).body
|
460
510
|
|
461
511
|
JSON.parse(launch_scan_resp, symbolize_names: true)
|
@@ -466,16 +516,16 @@ module PWN
|
|
466
516
|
# Supported Method Parameters::
|
467
517
|
# PWN::Plugins::NessusCloud.get_scan_status(
|
468
518
|
# nessus_obj: 'required - nessus_obj returned from #login method',
|
469
|
-
#
|
519
|
+
# scan_uuid: 'required - scan uuid to retrieve status'
|
470
520
|
# )
|
471
521
|
|
472
522
|
public_class_method def self.get_scan_status(opts = {})
|
473
523
|
nessus_obj = opts[:nessus_obj]
|
474
|
-
|
524
|
+
scan_uuid = opts[:scan_uuid]
|
475
525
|
|
476
526
|
scan_status_resp = nessus_cloud_rest_call(
|
477
527
|
nessus_obj: nessus_obj,
|
478
|
-
rest_call: "scans/#{
|
528
|
+
rest_call: "scans/#{scan_uuid}/latest-status"
|
479
529
|
).body
|
480
530
|
|
481
531
|
JSON.parse(scan_status_resp, symbolize_names: true)
|
@@ -518,16 +568,16 @@ module PWN
|
|
518
568
|
# Supported Method Parameters::
|
519
569
|
# PWN::Plugins::NessusCloud.get_scan_history(
|
520
570
|
# nessus_obj: 'required - nessus_obj returned from #login method'
|
521
|
-
#
|
571
|
+
# scan_uuid: 'required - scan uuid to launch'
|
522
572
|
# )
|
523
573
|
|
524
574
|
public_class_method def self.get_scan_history(opts = {})
|
525
575
|
nessus_obj = opts[:nessus_obj]
|
526
|
-
|
576
|
+
scan_uuid = opts[:scan_uuid]
|
527
577
|
|
528
578
|
scan_hist_resp = nessus_cloud_rest_call(
|
529
579
|
nessus_obj: nessus_obj,
|
530
|
-
rest_call: "scans/#{
|
580
|
+
rest_call: "scans/#{scan_uuid}/history"
|
531
581
|
).body
|
532
582
|
|
533
583
|
JSON.parse(scan_hist_resp, symbolize_names: true)
|
@@ -538,7 +588,7 @@ module PWN
|
|
538
588
|
# Supported Method Parameters::
|
539
589
|
# PWN::Plugins::NessusCloud.export_scan_results(
|
540
590
|
# nessus_obj: 'required - nessus_obj returned from #login method',
|
541
|
-
#
|
591
|
+
# scan_uuid: 'required - scan uuid to export',
|
542
592
|
# path_to_export: 'required - filename to export results',
|
543
593
|
# history_id: 'optional - defaults to last scan',
|
544
594
|
# format: 'optional - :csv|:db|:html|:nessus|:pdf (defaults to :csv')
|
@@ -546,14 +596,14 @@ module PWN
|
|
546
596
|
|
547
597
|
public_class_method def self.export_scan_results(opts = {})
|
548
598
|
nessus_obj = opts[:nessus_obj]
|
549
|
-
|
599
|
+
scan_uuid = opts[:scan_uuid]
|
550
600
|
path_to_export = opts[:path_to_export]
|
551
601
|
if opts[:history_id]
|
552
602
|
history_id = opts[:history_id]
|
553
603
|
else
|
554
604
|
scan_history_resp = get_scan_history(
|
555
605
|
nessus_obj: nessus_obj,
|
556
|
-
|
606
|
+
scan_uuid: scan_uuid
|
557
607
|
)
|
558
608
|
|
559
609
|
if scan_history_resp[:history].empty?
|
@@ -568,7 +618,7 @@ module PWN
|
|
568
618
|
format = opts[:format].to_s.to_sym if opts[:format]
|
569
619
|
|
570
620
|
http_body = {
|
571
|
-
|
621
|
+
scan_uuid: scan_uuid,
|
572
622
|
history_id: history_id,
|
573
623
|
format: format
|
574
624
|
}.to_json
|
@@ -576,7 +626,7 @@ module PWN
|
|
576
626
|
export_scan_resp = nessus_cloud_rest_call(
|
577
627
|
http_method: :post,
|
578
628
|
nessus_obj: nessus_obj,
|
579
|
-
rest_call: "scans/#{
|
629
|
+
rest_call: "scans/#{scan_uuid}/export",
|
580
630
|
http_body: http_body
|
581
631
|
).body
|
582
632
|
|
@@ -587,7 +637,7 @@ module PWN
|
|
587
637
|
|
588
638
|
download_export_resp = nessus_cloud_rest_call(
|
589
639
|
nessus_obj: nessus_obj,
|
590
|
-
rest_call: "scans/#{
|
640
|
+
rest_call: "scans/#{scan_uuid}/export/#{file_id}/download"
|
591
641
|
).body
|
592
642
|
|
593
643
|
File.open(path_to_export, 'wb') do |f|
|
@@ -660,14 +710,31 @@ module PWN
|
|
660
710
|
nessus_obj: 'required - nessus_obj returned from #login method'
|
661
711
|
)
|
662
712
|
|
713
|
+
#{self}.create_scan(
|
714
|
+
nessus_obj: 'required - nessus_obj returned from #login method',
|
715
|
+
scan_template_uuid: 'required - the UUID for the Tenable-provided scan template to use. Run #get_canned_scan_templates for a list of UUIDs',
|
716
|
+
settings: 'required - settings object as defined by https://developer.tenable.com/reference/scans-create',
|
717
|
+
credentials: 'required - credentials object as defined by https://developer.tenable.com/reference/scans-create',
|
718
|
+
plugins: 'optional - plugins object as defined by https://developer.tenable.com/reference/scans-create (Defaults to {})'
|
719
|
+
)
|
720
|
+
|
721
|
+
#{self}.update_scan(
|
722
|
+
nessus_obj: 'required - nessus_obj returned from #login method',
|
723
|
+
scan_uuid: 'required - the scan UUID to update. Run #get_scans for a list of UUIDs',
|
724
|
+
scan_template_uuid: 'required - the UUID for the Tenable-provided scan template to use. Run #get_canned_scan_templates for a list of UUIDs',
|
725
|
+
settings: 'required - settings object as defined by https://developer.tenable.com/reference/scans-create',
|
726
|
+
credentials: 'required - credentials object as defined by https://developer.tenable.com/reference/scans-create',
|
727
|
+
plugins: 'optional - plugins object as defined by https://developer.tenable.com/reference/scans-create (Defaults to {})'
|
728
|
+
)
|
729
|
+
|
663
730
|
#{self}.launch_scan(
|
664
731
|
nessus_obj: 'required - nessus_obj returned from #login method',
|
665
|
-
|
732
|
+
scan_uuid: 'required - scan uuid to launch'
|
666
733
|
)
|
667
734
|
|
668
735
|
#{self}.get_scan_status(
|
669
736
|
nessus_obj: 'required - nessus_obj returned from #login method',
|
670
|
-
|
737
|
+
scan_uuid: 'required - scan uuid to retrieve status'
|
671
738
|
)
|
672
739
|
|
673
740
|
#{self}.create_tag(
|
@@ -679,12 +746,12 @@ module PWN
|
|
679
746
|
|
680
747
|
#{self}.get_scan_history(
|
681
748
|
nessus_obj: 'required - nessus_obj returned from #login method'
|
682
|
-
|
749
|
+
scan_uuid: 'required - scan uuid to launch'
|
683
750
|
)
|
684
751
|
|
685
752
|
#{self}.export_scan_results(
|
686
753
|
nessus_obj: 'required - nessus_obj returned from #login method',
|
687
|
-
|
754
|
+
scan_uuid: 'required - scan uuid to export',
|
688
755
|
path_to_export: 'required - filename to export results',
|
689
756
|
history_id: 'optional - defaults to last scan',
|
690
757
|
format: 'optional - :csv|:db|:html|:nessus|:pdf (defaults to :csv')
|
data/lib/pwn/version.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.453
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 0day Inc.
|
@@ -1007,7 +1007,7 @@ executables:
|
|
1007
1007
|
- pwn_jenkins_useradd
|
1008
1008
|
- pwn_mail_agent
|
1009
1009
|
- pwn_msf_postgres_login
|
1010
|
-
-
|
1010
|
+
- pwn_nessus_cloud_scan_crud
|
1011
1011
|
- pwn_nessus_cloud_vulnscan
|
1012
1012
|
- pwn_nexpose
|
1013
1013
|
- pwn_openvas_vulnscan
|
@@ -1066,7 +1066,7 @@ files:
|
|
1066
1066
|
- bin/pwn_jenkins_useradd
|
1067
1067
|
- bin/pwn_mail_agent
|
1068
1068
|
- bin/pwn_msf_postgres_login
|
1069
|
-
- bin/
|
1069
|
+
- bin/pwn_nessus_cloud_scan_crud
|
1070
1070
|
- bin/pwn_nessus_cloud_vulnscan
|
1071
1071
|
- bin/pwn_nexpose
|
1072
1072
|
- bin/pwn_openvas_vulnscan
|