pwn 0.4.494 → 0.4.495

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8768ccdc969bae1bc9fa8f7504adb172c9093901736d825e61137e0565069b43
4
- data.tar.gz: 024d680c7f6f619cf849cdb9617632bcac74c3cdbe40fd698e0eafcb5d4032d1
3
+ metadata.gz: 3cdb19972dd43562eb0cc0a406e0ec22566412638865a4ec79336735ec787e4f
4
+ data.tar.gz: a12737175fa39a18f21804d8e65cc268b2662e8dea51bd15ef19adbd23e11e82
5
5
  SHA512:
6
- metadata.gz: 4e1f54a0b6bab1f2e52c2269ca190cc78ebd1f36d837cc2dfb16c3d7b9f56221ae351e23b48f2b6811ab09d1e37bd5ea857719ad03f32f533e921378792ccc5a
7
- data.tar.gz: fc9018fa4623f621cf9b8c09995c11e4eef8d3013d2aaea89d671e5a7c20ab6b3d9015689f247da5461189f130f6d8c521d47300f2f5aebbeefb1dcded45f811
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.494]: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.494]:001 >>> PWN.help
55
+ pwn[v0.4.495]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -283,6 +283,12 @@ begin
283
283
  )
284
284
  tag_uuid = new_tag[:uuid]
285
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
+ )
286
292
  end
287
293
 
288
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.494'
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.494
4
+ version: 0.4.495
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.