pwn 0.4.494 → 0.4.497

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: 8768ccdc969bae1bc9fa8f7504adb172c9093901736d825e61137e0565069b43
4
- data.tar.gz: 024d680c7f6f619cf849cdb9617632bcac74c3cdbe40fd698e0eafcb5d4032d1
3
+ metadata.gz: 80382483558c9e463a6a29a49d40276cf4f97d4a03923f2699aae40e6a88d3aa
4
+ data.tar.gz: a8701dc4cd968599973015e8688687d0aeee6c37590adb9cd13c0d589acaef4b
5
5
  SHA512:
6
- metadata.gz: 4e1f54a0b6bab1f2e52c2269ca190cc78ebd1f36d837cc2dfb16c3d7b9f56221ae351e23b48f2b6811ab09d1e37bd5ea857719ad03f32f533e921378792ccc5a
7
- data.tar.gz: fc9018fa4623f621cf9b8c09995c11e4eef8d3013d2aaea89d671e5a7c20ab6b3d9015689f247da5461189f130f6d8c521d47300f2f5aebbeefb1dcded45f811
6
+ metadata.gz: c99e60a9083c7554c9ab61e8dd4aff75456aea49d01a8b342233e77238ff3d14c1e562a0d8930e835ae942eca126c9f036d176d692f6c5935c419c4bd4557bf0
7
+ data.tar.gz: f4b9fb5470bf10cc21c4bdc5bdbcf3f51e146432ada11bb37901f6c66021d3de0348afbb52a7f57a93ecbaa7a0211af9df4f1a66cf888f836d540bf4c3d3109c
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.497]: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.497]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -285,6 +285,12 @@ begin
285
285
  tag_uuids_arr.push(tag_uuid)
286
286
  end
287
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
+
288
294
  settings[:tag_targets] = tag_uuids_arr
289
295
  end
290
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.494'
4
+ VERSION = '0.4.497'
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.497
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.