tenable-ruby 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tenable-ruby.rb +96 -9
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e7f7d3f313d0e1025fb6542b1bfc78aaca7ac22
|
4
|
+
data.tar.gz: 61e4725f204991d399ef950785506193f9c213b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 587367f6991108a0fb14e8b91f156bc080d2a18288f8baadb068c9283ec68af934b0781936aaed13f01968e6621bd65b5f92b7af5e216a9d85effa4c7030d2a3
|
7
|
+
data.tar.gz: ec6665e7e0b64bccffa1cac5b3b4c7f72cfbf0f2df1e36c2e34eb12926abc8c549e3bb3c5e7c1ff3b5136a72e46b7005b2890b90c341695262831b2842e0d44d
|
data/lib/tenable-ruby.rb
CHANGED
@@ -478,11 +478,11 @@ module TenableRuby
|
|
478
478
|
# Returns scan status by performing a 'scan_details' API call
|
479
479
|
def scan_status(scan_id)
|
480
480
|
details = scan_details(scan_id)
|
481
|
-
unless details['error'].nil?
|
482
|
-
return 'error'
|
483
|
-
end
|
484
481
|
if details.nil?
|
485
|
-
|
482
|
+
raise TenableRuby::Error::TenableError, "Get scan_details returned nil"
|
483
|
+
end
|
484
|
+
if not details['error'].nil?
|
485
|
+
raise TenableRuby::Error::TenableError, "Get scan_details returned the following error: #{details['error']}"
|
486
486
|
end
|
487
487
|
details['info']['status']
|
488
488
|
end
|
@@ -491,15 +491,15 @@ module TenableRuby
|
|
491
491
|
# Note this is currently updated more frequently than the scan status in the tenable.io API
|
492
492
|
def scan_latest_history_status(scan_id)
|
493
493
|
details = scan_details(scan_id)
|
494
|
-
unless details['error'].nil?
|
495
|
-
return 'error'
|
496
|
-
end
|
497
494
|
if details.nil?
|
498
|
-
|
495
|
+
raise TenableRuby::Error::TenableError, "Get scan_details returned nil"
|
496
|
+
end
|
497
|
+
if not details['error'].nil?
|
498
|
+
raise TenableRuby::Error::TenableError, "Get scan_details returned the following error: #{details['error']}"
|
499
499
|
end
|
500
500
|
history = details['history']
|
501
501
|
if history.nil? or history.length == 0
|
502
|
-
|
502
|
+
raise TenableRuby::Error::TenableError, "Get scan_details returned empty history object"
|
503
503
|
else
|
504
504
|
details['history'].last['status']
|
505
505
|
end
|
@@ -536,6 +536,93 @@ module TenableRuby
|
|
536
536
|
end
|
537
537
|
end
|
538
538
|
|
539
|
+
# Returns a list of all containers.
|
540
|
+
#
|
541
|
+
# Reference:
|
542
|
+
# https://cloud.tenable.com/api#/resources/container-security-containers/list-containers
|
543
|
+
def list_containers()
|
544
|
+
http_get(:uri => "/container-security/api/v1/container/list", :fields => header)
|
545
|
+
end
|
546
|
+
|
547
|
+
# Returns an inventory of an image by ID.
|
548
|
+
#
|
549
|
+
# Reference:
|
550
|
+
# https://cloud.tenable.com/api#/resources/container-security-containers/image-inventory
|
551
|
+
def image_inventory(image_id)
|
552
|
+
http_get(:uri => "/container-security/api/v1/container/#{policy_id}/status", :fields => header)
|
553
|
+
end
|
554
|
+
|
555
|
+
# Returns the status of a job that you specify by ID to determine if the job is still queued, in progress, or has completed.
|
556
|
+
#
|
557
|
+
# Reference:
|
558
|
+
# https://cloud.tenable.com/api#/resources/container-security-jobs/job-status
|
559
|
+
def job_status(job_id)
|
560
|
+
http_get(:uri => "/container-security/api/v1/jobs/status?job_id=#{job_id}", :fields => header)
|
561
|
+
end
|
562
|
+
|
563
|
+
# Returns the status of a job by specifying an image ID to determine if the job is still queued, in progress, or has completed.
|
564
|
+
#
|
565
|
+
# Reference:
|
566
|
+
# https://cloud.tenable.com/api#/resources/container-security-jobs/job-status-by-image-id
|
567
|
+
def image_status(image_id)
|
568
|
+
http_get(:uri => "/container-security/api/v1/jobs/image_status?image_id=#{image_id}", :fields => header)
|
569
|
+
end
|
570
|
+
|
571
|
+
# Returns the status of a job by specifying an image digest to determine if the job is still queued, in progress, or has completed.
|
572
|
+
#
|
573
|
+
# Reference:
|
574
|
+
# https://cloud.tenable.com/api#/resources/container-security-jobs/job-status-by-image-digest
|
575
|
+
def image_status_digest(image_digest)
|
576
|
+
http_get(:uri => "/container-security/api/v1/jobs/image_status_digest?image_digest=#{image_digest}", :fields => header)
|
577
|
+
end
|
578
|
+
|
579
|
+
# Returns a list of active Container Security jobs
|
580
|
+
#
|
581
|
+
# Reference:
|
582
|
+
# https://cloud.tenable.com/api#/resources/container-security-jobs/list-jobs
|
583
|
+
def list_jobs()
|
584
|
+
http_get(:uri => "/container-security/api/v1/jobs/list", :fields => header)
|
585
|
+
end
|
586
|
+
|
587
|
+
# Checks the compliance of an image that you specify by ID against your policies.
|
588
|
+
#
|
589
|
+
# Reference:
|
590
|
+
# https://cloud.tenable.com/api#/resources/container-security-policy/policy-compliance-by-id
|
591
|
+
def policy_compliance_by_id(image_id)
|
592
|
+
http_get(:uri => "/container-security/api/v1/policycompliance?image_id=#{image_id}", :fields => header)
|
593
|
+
end
|
594
|
+
|
595
|
+
# Checks the compliance of an image that you specify by name against your policies.
|
596
|
+
#
|
597
|
+
# Reference:
|
598
|
+
# https://cloud.tenable.com/api#/resources/container-security-policy/policy-compliance-by-name
|
599
|
+
def policy_compliance_by_name(image)
|
600
|
+
http_get(:uri => "/container-security/api/v1/compliancebyname?image=#{image}", :fields => header)
|
601
|
+
end
|
602
|
+
|
603
|
+
# Returns a report in JSON format for a container that you specify by ID. Note: If you do not have the container_id, you can call the list-containers endpoint.
|
604
|
+
#
|
605
|
+
# Reference:
|
606
|
+
# https://cloud.tenable.com/api#/resources/container-security-reports/report-by-container-id
|
607
|
+
def report_by_container_id(container_id)
|
608
|
+
http_get(:uri => "/container-security/api/v1/reports/show?container_id=#{container_id}", :fields => header)
|
609
|
+
end
|
610
|
+
|
611
|
+
# Returns a report in JSON format for an image that you specify by ID. Note: If you do not have the image_id, you can call the list-images endpoint.
|
612
|
+
#
|
613
|
+
# Reference:
|
614
|
+
# https://cloud.tenable.com/api#/resources/container-security-reports/report-by-image-id
|
615
|
+
def report_by_image_id(image_id)
|
616
|
+
http_get(:uri => "/container-security/api/v1/reports/by_image?image_id=#{image_id}", :fields => header)
|
617
|
+
end
|
618
|
+
|
619
|
+
# Returns a report in JSON format for an image digest.
|
620
|
+
#
|
621
|
+
# Reference:
|
622
|
+
# https://cloud.tenable.com/api#/resources/container-security-reports/report-by-image-digest
|
623
|
+
def report_by_image_digest(image_digest)
|
624
|
+
http_get(:uri => "/container-security/api/v1/reports/by_image_digest?image_digest=#{image_digest}", :fields => header)
|
625
|
+
end
|
539
626
|
|
540
627
|
private
|
541
628
|
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tenable-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Vlatko Kosturjak
|
8
7
|
- Patrick Craston
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-19 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: |-
|
15
14
|
Ruby library for communicating with the tenable.io API.
|