tenable-ruby 0.3.8 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tenable-ruby.rb +66 -25
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46cb931a0ca61f9b60d512054fffded5d3791c1287e288f3ffa8bb5aebc25143
4
- data.tar.gz: f72de87553f9ab44629d6d76bd7bbca867243dbb21c45630f1b4555111ccb596
3
+ metadata.gz: ddc71aa2ebeed0c75267eef28edbbe2170a81af29c7ce9cc8be9bcc41d22790e
4
+ data.tar.gz: 40e8d3c8a4dff5f9b89d88a439753ec1fcd6d92c50a2d0d8c3c77ce1244e6a7d
5
5
  SHA512:
6
- metadata.gz: caade70ce004f071bcedc8c320b0ecd8182bcfdda4bbd4676fdc5c1903778b23f27a7a708cc99b44ac3e325b4b339d82a8a15ffded47bf1d4b00edc1723785cf
7
- data.tar.gz: b6cbe3afe512e25da38fb042f7ddf7ad81382feaeaab8b4e5baed3799f3edfa42c5b21c1da0e85871be8ea4db8aee2cc26de6eccd28506b5e5c58dcc5fdcb7da
6
+ metadata.gz: b36308298ed4a9a4708699da058c481545c25bc9f95333bbb3ed444777efcecf3108cd3484a4da6892cee8c62181acb4fa10a55e9713f36d7abd7c5dfbadab63
7
+ data.tar.gz: 82ff9c6ece45a2052532363cc194cdbe8c2af7637e40b5e1d9c2f21f3679ee8461d5b0ae5c7305b6d7917c246a71a1b83b12aa546aa0250d3f1d6243df6fe786
@@ -307,6 +307,14 @@ module TenableRuby
307
307
  http_put(options)
308
308
  end
309
309
 
310
+ # Returns details of the specified asset.
311
+ #
312
+ # Reference:
313
+ # https://developer.tenable.com/reference#assets-asset-info
314
+ def asset_info(asset_uuid)
315
+ http_get(:uri => "/assets/#{asset_uuid}", :fields => header)
316
+ end
317
+
310
318
  # Creates a scan
311
319
  #
312
320
  # Reference:
@@ -410,6 +418,15 @@ module TenableRuby
410
418
  http_get(:uri => uri, :fields => header)
411
419
  end
412
420
 
421
+ # Returns the output for a specified plugin.
422
+ #
423
+ # Reference:
424
+ # https://developer.tenable.com/reference#scans-plugin-output
425
+ def scans_plugin_output(scan_id, host_id, plugin_id)
426
+ uri = "/scans/#{scan_id}/hosts/#{host_id}/plugins/#{plugin_id}"
427
+ http_get(:uri => uri, :fields => header)
428
+ end
429
+
413
430
  # Download an exported scan
414
431
  #
415
432
  # Reference:
@@ -549,33 +566,15 @@ module TenableRuby
549
566
  scan_create(template_uuid, settings)
550
567
  end
551
568
 
552
- # Returns scan status by performing a 'scan_details' API call
569
+ # Returns the latest status for a scan.
570
+ #
571
+ # Reference: https://developer.tenable.com/reference#scans-get-latest-status
553
572
  def scan_status(scan_id)
554
- details = scan_details(scan_id)
555
- if details.nil?
556
- raise TenableRuby::Error::TenableError, "Get scan_details returned nil"
557
- end
558
- if not details['error'].nil?
559
- raise TenableRuby::Error::TenableError, "Get scan_details returned the following error: #{details['error']}"
560
- end
561
- details['info']['status']
562
- end
563
-
564
- # Returns the status of the latest history object of a scan by performing a 'scan_details' API call.
565
- # Note this is currently updated more frequently than the scan status in the tenable.io API
566
- def scan_latest_history_status(scan_id)
567
- details = scan_details(scan_id)
568
- if details.nil?
569
- raise TenableRuby::Error::TenableError, "Get scan_details returned nil"
570
- end
571
- if not details['error'].nil?
572
- raise TenableRuby::Error::TenableError, "Get scan_details returned the following error: #{details['error']}"
573
- end
574
- history = details['history']
575
- if history.nil? or history.length == 0
576
- raise TenableRuby::Error::TenableError, "Get scan_details returned empty history object"
573
+ response = http_get(:uri => "/scans/#{scan_id}/latest-status", :fields => header)
574
+ if response.is_a?(Hash) and response.has_key?('status')
575
+ response['status']
577
576
  else
578
- details['history'].last['status']
577
+ raise TenableRuby::Error::TenableError, "Tenable.io did not return a valid status response"
579
578
  end
580
579
  end
581
580
 
@@ -698,6 +697,48 @@ module TenableRuby
698
697
  http_get(:uri => "/container-security/api/v1/reports/by_image_digest?image_digest=#{image_digest}", :fields => header)
699
698
  end
700
699
 
700
+ # Creates a new target group for the current user.
701
+ #
702
+ # Reference:
703
+ # https://developer.tenable.com/reference#target-groups-create
704
+ def create_target_group(name, members, acls: nil)
705
+ http_post(:uri => "/target-groups", :fields => header,
706
+ :data => {:name => name, :members => members, :acls => acls})
707
+ end
708
+
709
+ # Returns the current target groups.
710
+ #
711
+ # Reference:
712
+ # https://developer.tenable.com/reference#target-groups-list
713
+ def list_target_groups
714
+ http_get(:uri => "/target-groups", :fields => header)
715
+ end
716
+
717
+ # Returns details for the specified target group.
718
+ #
719
+ # Reference:
720
+ # https://developer.tenable.com/reference#target-groups-details
721
+ def get_target_group(group_id)
722
+ http_get(:uri => "/target-groups/#{group_id}", :fields => header)
723
+ end
724
+
725
+ # Updates a target group.
726
+ #
727
+ # Reference:
728
+ # https://developer.tenable.com/reference#target-groups-edit
729
+ def update_target_group(group_id, name, members, acls: nil)
730
+ http_put(:uri => "/target-groups/#{group_id}", :fields => header,
731
+ :data => {:name => name, :members => members, :acls => acls})
732
+ end
733
+
734
+ # Deletes a target group.
735
+ #
736
+ # Reference:
737
+ # https://developer.tenable.com/reference#target-groups-delete
738
+ def delete_target_group(group_id)
739
+ http_delete(:uri => "/target-groups/#{group_id}", :fields => header)
740
+ end
741
+
701
742
  private
702
743
 
703
744
  # Perform HTTP put method with uri, data and fields
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenable-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Craston
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-27 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Ruby library for communicating with the tenable.io API.
@@ -25,7 +25,7 @@ homepage: https://gitlab.com/intruder/tenable-ruby
25
25
  licenses:
26
26
  - MIT
27
27
  metadata: {}
28
- post_install_message:
28
+ post_install_message:
29
29
  rdoc_options: []
30
30
  require_paths:
31
31
  - lib
@@ -40,8 +40,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  requirements: []
43
- rubygems_version: 3.0.4
44
- signing_key:
43
+ rubygems_version: 3.0.3
44
+ signing_key:
45
45
  specification_version: 4
46
46
  summary: Ruby library for communicating with the tenable.io API
47
47
  test_files: []