pwn 0.4.493 → 0.4.496

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca875035f78d9cde4a61de1e0e89512474fced9934988411aa58f14237f1c6e9
4
- data.tar.gz: 14cd3c5cb46ca810c7fa30db4af280f05e1c1e0ba389e71c8e8c1ffb24b09241
3
+ metadata.gz: 9a616acd502b984f546b0ab44705a102f9c6f54e4db9947e660351f47e310f77
4
+ data.tar.gz: 66cfa98e19408bbd09c81c99042006ea9b4ee63bbb2027ea9cffdbf54094ebdf
5
5
  SHA512:
6
- metadata.gz: de05863476f114617fef1ee3133b78648199ac295cf23e953ace0ec44fb4a5d16847ff05239e335d74ada06618dfdb7cd28aad351780eebd1e6e0a56ffc8c0ba
7
- data.tar.gz: bffdd5def65dd8d7417fe1781aca00fd3d1d1fdf1475551d1e04f2aea72f2b24a40fc714c6d19470c547b3e4c5992853ce76f5966a020a0b634762e6795ef36f
6
+ metadata.gz: a902740bc9f716635eb82eaa32fcddae58be0ad6478c72e7c60be8c9fffc85e2450b7e0987fe107ff24b17d65331632a545e75624ef98b3f0aa62f30e729b863
7
+ data.tar.gz: 12abb33a42e8681e6e45b279633e490302391e5a32c6a53eff27a8901786beab5835251b37e22975e55a0b0c26bf23bb8737516c8a3858483c729258c8eb724b
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.493]:001 >>> PWN.help
40
+ pwn[v0.4.496]: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.493]:001 >>> PWN.help
55
+ pwn[v0.4.496]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -47,8 +47,8 @@ OptionParser.new do |options|
47
47
  opts[:scanner_name] = s
48
48
  end
49
49
 
50
- options.on('-D', '--disable-scan', '<Optional - If true, the schedule for the scan is disabled (Defaults to false)>') do |d|
51
- opts[:disabled] = d
50
+ options.on('-E', '--enable-schedule', '<Optional - If true, the schedule for the scan is enabled (Defaults to false)>') do |e|
51
+ opts[:enable_schedule] = e
52
52
  end
53
53
 
54
54
  options.on('-NTARGET', '--target-network-name=TARGET', '<Optional - If --scanner other than AUTO-ROUTED, Otherwise Required - Network to Scan (Defaults to "Default")>') do |n|
@@ -63,11 +63,11 @@ OptionParser.new do |options|
63
63
  opts[:scan_time_window] = t
64
64
  end
65
65
 
66
- options.on('-STIME', '--start-time=TIME', '<Optional - For One-Time Scans, the Starting Time and Date for the Scan>') do |t|
66
+ options.on('-STIME', '--start-time=TIME', '<Optional - For One-Time Scans, the Starting Time and Date for the Scan (e.g. "2777-07-07T00:00:00")>') do |t|
67
67
  opts[:starttime] = t
68
68
  end
69
69
 
70
- options.on('-rRRULES', '--rrules=RRULES', '<Optional - For One-Time Scans, the Starting Time and Date for the Scan (Defaults to "FREQ=null;INTERVAL=0;BYDAY=null")>') do |r|
70
+ options.on('-rRRULES', '--rrules=RRULES', '<Optional - For One-Time Scans, the Starting Time and Date for the Scan (e.g. "FREQ=WEEKLY;INTERVAL=3;BYDAY=MO,WE,FR")>') do |r|
71
71
  opts[:rrules] = r
72
72
  end
73
73
 
@@ -79,12 +79,12 @@ OptionParser.new do |options|
79
79
  opts[:tag_category_name] = y
80
80
  end
81
81
 
82
- options.on('-zTIMEZONE', '--timezone=TIMEZONE', '<Optional - Timezone of the scheduled start time for the scan>') do |t|
82
+ options.on('-zTIMEZONE', '--timezone=TIMEZONE', '<Optional - Timezone of the scheduled start time for the scan (e.g. "US/Eastern")>') do |t|
83
83
  opts[:timezone] = t
84
84
  end
85
85
 
86
- options.on('-gGROUPS', '--target-groups=GROUPS', '<Optional - Comma-delimited list of target group IDs to scan>') do |t|
87
- opts[:timezone] = t
86
+ options.on('-gGROUPS', '--target-groups=GROUPS', '<Optional - Comma-delimited list of target group IDs to scan>') do |g|
87
+ opts[:target_groups] = g
88
88
  end
89
89
  end.parse!
90
90
 
@@ -131,11 +131,8 @@ begin
131
131
  target_network_name = opts[:target_network_name]
132
132
  target_network_name ||= 'Default'
133
133
 
134
- disabled = true if opts[:disabled]
135
- disabled ||= false
136
-
137
- enabled = true
138
- enabled = false if disabled
134
+ enable_schedule = true if opts[:enable_schedule]
135
+ enable_schedule ||= false
139
136
 
140
137
  launch = opts[:launch]
141
138
  launch ||= 'ON_DEMAND'
@@ -147,7 +144,7 @@ begin
147
144
  # starttime ||= Time.now.strftime('%Y%m%dT%H%M%S')
148
145
 
149
146
  rrules = opts[:rrules]
150
- rrules ||= 'FREQ=null;INTERVAL=0;BYDAY=null'
147
+ # rrules ||= 'FREQ=null;INTERVAL=0;BYDAY=null'
151
148
 
152
149
  timezone = opts[:timezone]
153
150
  # timezone ||= 'UTC'
@@ -248,7 +245,7 @@ begin
248
245
  )
249
246
  settings[:target_network_uuid] = target_network[:uuid]
250
247
 
251
- settings[:enabled] = enabled
248
+ settings[:enabled] = enable_schedule
252
249
 
253
250
  settings[:launch] = launch
254
251
 
@@ -288,6 +285,12 @@ begin
288
285
  tag_uuids_arr.push(tag_uuid)
289
286
  end
290
287
 
288
+ tag_assets = PWN::Plugins::NessusCloud.add_tag_to_assets(
289
+ nessus_obj: nessus_obj,
290
+ targets: text_targets,
291
+ tag_uuids: tag_uuids_arr
292
+ )
293
+
291
294
  settings[:tag_targets] = tag_uuids_arr
292
295
  end
293
296
 
@@ -347,6 +347,81 @@ module PWN
347
347
  raise e
348
348
  end
349
349
 
350
+ # Supported Method Parameters::
351
+ # PWN::Plugins::NessusCloud.get_assets(
352
+ # nessus_obj: 'required - nessus_obj returned from #login method',
353
+ # name: 'optional - name of asset'
354
+ # )
355
+ # )
356
+
357
+ public_class_method def self.get_assets(opts = {})
358
+ nessus_obj = opts[:nessus_obj]
359
+ name = opts[:name]
360
+
361
+ assets_resp = nessus_cloud_rest_call(
362
+ nessus_obj: nessus_obj,
363
+ rest_call: 'assets'
364
+ ).body
365
+
366
+ assets = JSON.parse(assets_resp, symbolize_names: true)
367
+
368
+ if name
369
+ selected_asset = assets[:assets].select do |asset|
370
+ asset[:fqdn] == name
371
+ end
372
+ assets = selected_asset.first
373
+ assets ||= {}
374
+ end
375
+
376
+ assets
377
+ rescue StandardError, SystemExit, Interrupt => e
378
+ raise e
379
+ end
380
+
381
+ # Supported Method Parameters::
382
+ # PWN::Plugins::NessusCloud.add_tag_to_assets(
383
+ # nessus_obj: 'required - nessus_obj returned from #login method',
384
+ # targets: 'required - comma-delimited list of targets to tag',
385
+ # tag_uuids: 'required - array of tag UUIDS to tag against targets'
386
+ # )
387
+ # )
388
+
389
+ public_class_method def self.add_tag_to_assets(opts = {})
390
+ nessus_obj = opts[:nessus_obj]
391
+ targets = opts[:targets].to_s.split(',')
392
+ tag_uuids = opts[:tag_uuids]
393
+
394
+ all_assets = get_assets(nessus_obj: nessus_obj)
395
+
396
+ asset_uuids_arr = []
397
+ targets.each do |target|
398
+ selected_asset = all_assets[:assets].select do |asset|
399
+ asset[:fqdn] == target
400
+ end
401
+ this_asset = selected_asset.first
402
+ target_uuid = this_asset[:uuid]
403
+
404
+ asset_uuids_arr.push(target_uuid)
405
+ end
406
+
407
+ http_body = {
408
+ action: 'add',
409
+ assets: asset_uuids_arr,
410
+ tags: tag_uuids
411
+ }.to_json
412
+
413
+ tag_assets_resp = nessus_cloud_rest_call(
414
+ http_method: :post,
415
+ nessus_obj: nessus_obj,
416
+ rest_call: 'tags/assets/assignments',
417
+ http_body: http_body
418
+ ).body
419
+
420
+ JSON.parse(tag_assets_resp, symbolize_names: true)
421
+ rescue StandardError, SystemExit, Interrupt => e
422
+ raise e
423
+ end
424
+
350
425
  # Supported Method Parameters::
351
426
  # PWN::Plugins::NessusCloud.get_credential_types(
352
427
  # nessus_obj: 'required - nessus_obj returned from #login method',
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.4.493'
4
+ VERSION = '0.4.496'
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.4.493
4
+ version: 0.4.496
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.