pwn 0.4.439 → 0.4.442

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: 0facd8a4831c0b12f3260083f60f42ffa10443a8aeb0d2b6d18e641f720ed237
4
- data.tar.gz: 630a49786d7e1e9a46a86de3d6d3e2c5a5b9651e274bda12ac0c97bc5e8b0396
3
+ metadata.gz: e159e4f445d461ad4579253bdd383a09436babcae06642a3ba78f37ee6e96594
4
+ data.tar.gz: e6ddf405829f06f74dd3482173b239eb8e643931178f9f66c5722a4c977cdae7
5
5
  SHA512:
6
- metadata.gz: 3508e260eec62e7b95ef6beb940446498d8bb48f17ca6a9e2bab5e106650121095ef9f1655ef882ecda06a27bdcf851c258ba8b8fde73f86f6f72b8ec88d1727
7
- data.tar.gz: f7e3e804ce8def94d5da144f72ae0557ca107a8506254f2a8c175418f4a635c6bc92b2b677803d675880e653c9633b8844b40498377d92f0e9b19bbf921c5a7f
6
+ metadata.gz: 23ce00314518920429bcb560ed7d4b04206542f6bbd32d0f466b1d81b4b6c82fcecef8bfb6a20db5c3bb22547286657c6e3fe77d45062482c3ecb25d0fb91419
7
+ data.tar.gz: c3e25ad52b328d5f160ed107c998d4b69f1c9d352fa8e995ad08e4d38c6549d9a463989bdb2b0b05c5dbad64b83306645dad1ee1015e877cad278eac3385b840
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.439]:001 >>> PWN.help
40
+ pwn[v0.4.442]: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.439]:001 >>> PWN.help
55
+ pwn[v0.4.442]:001 >>> PWN.help
56
56
  ```
57
57
 
58
58
 
@@ -71,6 +71,10 @@ OptionParser.new do |options|
71
71
  opts[:tag_targets] = x
72
72
  end
73
73
 
74
+ options.on('-yCATEGORY', '--tag-category-name=CATEGORY', '<Optional - Tag Category Name to Associate with --tag-targets flag>') do |y|
75
+ opts[:tag_category_name] = y
76
+ end
77
+
74
78
  options.on('-zTIMEZONE', '--timezone=TIMEZONE', '<Optional - Timezone of the scheduled start time for the scan (Defaults to "UTC")>') do |t|
75
79
  opts[:timezone] = t
76
80
  end
@@ -152,6 +156,9 @@ begin
152
156
  tag_targets_arr = []
153
157
  tag_targets_arr = tag_targets.split(',') if tag_targets
154
158
 
159
+ tag_category_name = opts[:tag_category_name]
160
+ raise 'ERROR: --tag-category-name Required as --tag-targets is Populated' if tag_targets && !tag_category_name
161
+
155
162
  agent_group_name = opts[:agent_group_name]
156
163
  agent_group_id_arr = []
157
164
 
@@ -256,7 +263,25 @@ begin
256
263
 
257
264
  settings[:file_targets] = file_targets if file_targets
258
265
 
259
- settings[:tag_targets] = tag_targets_arr if tag_targets_arr.any?
266
+ if tag_targets_arr.any?
267
+ tag_targets_arr.each do |tag_name|
268
+ # TODO: Lookup tag and create if does not exist
269
+ tag = PWN::Plugins::NessusCloud.get_tags(
270
+ nessus_obj: nessus_obj,
271
+ name: tag_name
272
+ )
273
+
274
+ next if tag.any?
275
+
276
+ PWN::Plugins::NessusCloud.create_tag(
277
+ nessus_obj: nessus_obj,
278
+ category: tag_category_name,
279
+ value: tag_name
280
+ )
281
+ end
282
+
283
+ settings[:tag_targets] = tag_targets_arr
284
+ end
260
285
 
261
286
  settings[:agent_group_id] = agent_group_id_arr if agent_group_id_arr.any?
262
287
 
@@ -275,7 +275,7 @@ module PWN
275
275
  # Supported Method Parameters::
276
276
  # PWN::Plugins::NessusCloud.get_target_groups(
277
277
  # nessus_obj: 'required - nessus_obj returned from #login method',
278
- # name: 'optional - name of timezone'
278
+ # name: 'optional - name of target group'
279
279
  # )
280
280
  # )
281
281
 
@@ -288,17 +288,48 @@ module PWN
288
288
  rest_call: 'target-groups'
289
289
  ).body
290
290
 
291
- timezones = JSON.parse(target_groups_resp, symbolize_names: true)
291
+ target_groups = JSON.parse(target_groups_resp, symbolize_names: true)
292
292
 
293
293
  if name
294
- selected_timezone = timezones[:networks].select do |tz|
295
- tz[:name] == name
294
+ selected_target_group = target_groups[:target_groups].select do |tg|
295
+ tg[:name] == name
296
296
  end
297
- timezones = selected_timezone.first if selected_timezone.any?
298
- timezones ||= {}
297
+ target_groups = selected_target_group.first if selected_target_group.any?
298
+ target_groups ||= {}
299
299
  end
300
300
 
301
- timezones
301
+ target_groups
302
+ rescue StandardError, SystemExit, Interrupt => e
303
+ raise e
304
+ end
305
+
306
+ # Supported Method Parameters::
307
+ # PWN::Plugins::NessusCloud.get_tags(
308
+ # nessus_obj: 'required - nessus_obj returned from #login method',
309
+ # name: 'optional - name of tag'
310
+ # )
311
+ # )
312
+
313
+ public_class_method def self.get_tags(opts = {})
314
+ nessus_obj = opts[:nessus_obj]
315
+ name = opts[:name]
316
+
317
+ tags_resp = nessus_cloud_rest_call(
318
+ nessus_obj: nessus_obj,
319
+ rest_call: 'target-groups'
320
+ ).body
321
+
322
+ tags = JSON.parse(target_groups_resp, symbolize_names: true)
323
+
324
+ if name
325
+ selected_tag = tags[:tags].select do |tag|
326
+ tag[:name] == name
327
+ end
328
+ tags = selected_tag.first if selected_tag.any?
329
+ tags ||= {}
330
+ end
331
+
332
+ tags
302
333
  rescue StandardError, SystemExit, Interrupt => e
303
334
  raise e
304
335
  end
@@ -347,6 +378,35 @@ module PWN
347
378
  raise e
348
379
  end
349
380
 
381
+ # Supported Method Parameters::
382
+ # PWN::Plugins::NessusCloud.get_scans(
383
+ # nessus_obj: 'required - nessus_obj returned from #login method'
384
+ # )
385
+
386
+ public_class_method def self.get_scans(opts = {})
387
+ nessus_obj = opts[:nessus_obj]
388
+ name = opts[:name]
389
+
390
+ scans_resp = nessus_cloud_rest_call(
391
+ nessus_obj: nessus_obj,
392
+ rest_call: 'scans'
393
+ ).body
394
+
395
+ scans = JSON.parse(scans_resp, symbolize_names: true)
396
+
397
+ if name
398
+ selected_scan = scans[:scans].select do |s|
399
+ s[:name] == name
400
+ end
401
+ scans = selected_scan.first if selected_scan.any?
402
+ scans ||= {}
403
+ end
404
+
405
+ scans
406
+ rescue StandardError, SystemExit, Interrupt => e
407
+ raise e
408
+ end
409
+
350
410
  # Supported Method Parameters::
351
411
  # PWN::Plugins::NessusCloud.create_scan(
352
412
  # nessus_obj: 'required - nessus_obj returned from #login method',
@@ -382,35 +442,6 @@ module PWN
382
442
  raise e
383
443
  end
384
444
 
385
- # Supported Method Parameters::
386
- # PWN::Plugins::NessusCloud.get_scans(
387
- # nessus_obj: 'required - nessus_obj returned from #login method'
388
- # )
389
-
390
- public_class_method def self.get_scans(opts = {})
391
- nessus_obj = opts[:nessus_obj]
392
- name = opts[:name]
393
-
394
- scans_resp = nessus_cloud_rest_call(
395
- nessus_obj: nessus_obj,
396
- rest_call: 'scans'
397
- ).body
398
-
399
- scans = JSON.parse(scans_resp, symbolize_names: true)
400
-
401
- if name
402
- selected_scan = scans[:scans].select do |s|
403
- s[:name] == name
404
- end
405
- scans = selected_scan.first if selected_scan.any?
406
- scans ||= {}
407
- end
408
-
409
- scans
410
- rescue StandardError, SystemExit, Interrupt => e
411
- raise e
412
- end
413
-
414
445
  # Supported Method Parameters::
415
446
  # PWN::Plugins::NessusCloud.launch_scan(
416
447
  # nessus_obj: 'required - nessus_obj returned from #login method',
@@ -453,14 +484,14 @@ module PWN
453
484
  end
454
485
 
455
486
  # Supported Method Parameters::
456
- # PWN::Plugins::NessusCloud.tag(
487
+ # PWN::Plugins::NessusCloud.create_tag(
457
488
  # nessus_obj: 'required - nessus_obj returned from #login method',
458
489
  # category: 'required - category name to create or use',
459
490
  # value: 'required - value name to create or use',
460
491
  # desc: 'optional - _value_ description'
461
492
  # )
462
493
 
463
- public_class_method def self.tag(opts = {})
494
+ public_class_method def self.create_tag(opts = {})
464
495
  nessus_obj = opts[:nessus_obj]
465
496
  category = opts[:category]
466
497
  value = opts[:value]
@@ -468,7 +499,8 @@ module PWN
468
499
 
469
500
  http_body = {
470
501
  category_name: category,
471
- value: value
502
+ value: value,
503
+ description: desc
472
504
  }.to_json
473
505
 
474
506
  tag_resp = nessus_cloud_rest_call(
@@ -614,6 +646,16 @@ module PWN
614
646
  name: 'optional - name of timezone'
615
647
  )
616
648
 
649
+ #{self}.get_target_groups(
650
+ nessus_obj: 'required - nessus_obj returned from #login method',
651
+ name: 'optional - name of target group'
652
+ )
653
+
654
+ #{self}.get_tags(
655
+ nessus_obj: 'required - nessus_obj returned from #login method',
656
+ name: 'optional - name of tag'
657
+ )
658
+
617
659
  #{self}.get_scans(
618
660
  nessus_obj: 'required - nessus_obj returned from #login method'
619
661
  )
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.439'
4
+ VERSION = '0.4.442'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.439
4
+ version: 0.4.442
5
5
  platform: ruby
6
6
  authors:
7
7
  - 0day Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-23 00:00:00.000000000 Z
11
+ date: 2022-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport