pwn 0.4.492 → 0.4.495

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: c322dc457a88e28d2bd2b87830653da3e167a7c25c7cea9b5df5d8e8ae7a1ae3
4
- data.tar.gz: 770907db6691c4f639a40d497e6084952c554e1289cad3ba02b2bd37d4136134
3
+ metadata.gz: 3cdb19972dd43562eb0cc0a406e0ec22566412638865a4ec79336735ec787e4f
4
+ data.tar.gz: a12737175fa39a18f21804d8e65cc268b2662e8dea51bd15ef19adbd23e11e82
5
5
  SHA512:
6
- metadata.gz: abfc7d67a3cf2b18c25e771d648fb9c6f7c1ab6483a96958ff45b962b55612c7961f0ab094abbd7b272a2dcd1aa6b3a43dc00ff9ae6b1d33cff9ac3af53a6303
7
- data.tar.gz: b73297289b1cfb8feb41381b66e93c9b22e3027b39cbb502ffc79f20d850fbebff4eb134fea232639e9b93f94cf571143a2fd7454d567ad77689aaeb017620a3
6
+ metadata.gz: 1d7e699569688e3a8150231ef6659cfe730329b7f304cb19d0428492218c271754958e08b28f8e7e3782c2caf7beea500284c2b325114f9f8597460692071899
7
+ data.tar.gz: 758b84b03098b93e97e5a2d8a105330e74892ed269b980e9fa40da37d5cee13e2131087dc9292ccc0f8758217bf7d60bc2db2553e5ac2663e0445f37a30f6658
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.492]:001 >>> PWN.help
40
+ pwn[v0.4.495]: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.492]:001 >>> PWN.help
55
+ pwn[v0.4.495]: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 (Defaults to Time.now.strftime("%Y%m%dT%H%M%S")>') 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 (Defaults to "UTC")>') 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'
@@ -144,13 +141,13 @@ begin
144
141
  scan_time_window ||= 0
145
142
 
146
143
  starttime = opts[:starttime]
147
- starttime ||= Time.now.strftime('%Y%m%dT%H%M%S')
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
- timezone ||= 'UTC'
150
+ # timezone ||= 'UTC'
154
151
 
155
152
  target_groups = opts[:target_groups]
156
153
 
@@ -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
 
@@ -286,6 +283,12 @@ begin
286
283
  )
287
284
  tag_uuid = new_tag[:uuid]
288
285
  tag_uuids_arr.push(tag_uuid)
286
+
287
+ tag_assets = PWN::Plugins::NessusCloud.add_tag_to_assets(
288
+ nessus_obj: nessus_obj,
289
+ targets: text_targets,
290
+ tag_uuids: tag_uuids_arr
291
+ )
289
292
  end
290
293
 
291
294
  settings[:tag_targets] = tag_uuids_arr
@@ -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.492'
4
+ VERSION = '0.4.495'
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.492
4
+ version: 0.4.495
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
@@ -1976,7 +1976,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1976
1976
  - !ruby/object:Gem::Version
1977
1977
  version: '0'
1978
1978
  requirements: []
1979
- rubygems_version: 3.3.15
1979
+ rubygems_version: 3.3.16
1980
1980
  signing_key:
1981
1981
  specification_version: 4
1982
1982
  summary: Automated Security Testing for CI/CD Pipelines & Beyond