tenable-ruby 0.3.1 → 0.3.2
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 +4 -4
- data/lib/tenable-ruby.rb +45 -46
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f2e3e353e286812317bb2f0d1837d1b1ac363ff
|
4
|
+
data.tar.gz: 336caa8a143f5e107c180d4ebc92632c2b037988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d266ca215327a5c9b11fb2ad0d677455813f0e415af909306d5fae9640b4f2d480380b970a01cd309ae47294530df8711cfd2477d7dcd85dd86dee7b46e3618
|
7
|
+
data.tar.gz: 4dbb9564288833ef473988b313130a7cd9466863a9122c47023efe2a0e94d91db3a58c090981e7b25ca4960da9fc51295ab0116a6dd13d09000bb6bb01a8e84d
|
data/lib/tenable-ruby.rb
CHANGED
@@ -109,7 +109,7 @@ module TenableRuby
|
|
109
109
|
# Returns the server version and other properties
|
110
110
|
#
|
111
111
|
# Reference:
|
112
|
-
# https://
|
112
|
+
# https://developer.tenable.com/reference#server-properties
|
113
113
|
def get_server_properties
|
114
114
|
http_get(:uri => "/server/properties", :fields => header)
|
115
115
|
end
|
@@ -117,7 +117,7 @@ module TenableRuby
|
|
117
117
|
# Creates a new user
|
118
118
|
#
|
119
119
|
# Reference:
|
120
|
-
# https://
|
120
|
+
# https://developer.tenable.com/reference#users-create
|
121
121
|
def user_add(username, password, permissions, type)
|
122
122
|
payload = {
|
123
123
|
:username => username,
|
@@ -132,7 +132,7 @@ module TenableRuby
|
|
132
132
|
# Deletes a user
|
133
133
|
#
|
134
134
|
# Reference:
|
135
|
-
# https://
|
135
|
+
# https://developer.tenable.com/reference#users-delete
|
136
136
|
def user_delete(user_id)
|
137
137
|
response = http_delete(:uri => "/users/#{user_id}", :fields => header)
|
138
138
|
response.code
|
@@ -141,7 +141,7 @@ module TenableRuby
|
|
141
141
|
# Changes the password for the given user
|
142
142
|
#
|
143
143
|
# Reference:
|
144
|
-
# https://
|
144
|
+
# https://developer.tenable.com/reference#users-password
|
145
145
|
def user_chpasswd(user_id, password)
|
146
146
|
payload = {
|
147
147
|
:password => password,
|
@@ -154,7 +154,7 @@ module TenableRuby
|
|
154
154
|
# Logs the current user out and destroys the session
|
155
155
|
#
|
156
156
|
# Reference:
|
157
|
-
# https://
|
157
|
+
# https://developer.tenable.com/reference#session-destroy
|
158
158
|
def user_logout
|
159
159
|
response = http_delete(:uri => "/session", :fields => header)
|
160
160
|
response.code
|
@@ -163,7 +163,7 @@ module TenableRuby
|
|
163
163
|
# Returns the policy list
|
164
164
|
#
|
165
165
|
# Reference:
|
166
|
-
# https://
|
166
|
+
# https://developer.tenable.com/reference#policies-list
|
167
167
|
def list_policies
|
168
168
|
http_get(:uri => "/policies", :fields => header)
|
169
169
|
end
|
@@ -171,15 +171,15 @@ module TenableRuby
|
|
171
171
|
# Returns the user list
|
172
172
|
#
|
173
173
|
# Reference:
|
174
|
-
# https://
|
174
|
+
# https://developer.tenable.com/reference#users-list
|
175
175
|
def list_users
|
176
176
|
http_get(:uri => "/users", :fields => header)
|
177
177
|
end
|
178
178
|
|
179
179
|
# Returns the current user's scan folders
|
180
180
|
#
|
181
|
-
# Reference:
|
182
|
-
# https://
|
181
|
+
# Reference: #
|
182
|
+
# https://developer.tenable.com/reference#folders-list
|
183
183
|
def list_folders
|
184
184
|
http_get(:uri => "/folders", :fields => header)
|
185
185
|
end
|
@@ -187,7 +187,7 @@ module TenableRuby
|
|
187
187
|
# Returns the scanner list
|
188
188
|
#
|
189
189
|
# Reference:
|
190
|
-
# https://
|
190
|
+
# https://developer.tenable.com/reference#scanners-list
|
191
191
|
def list_scanners
|
192
192
|
http_get(:uri => "/scanners", :fields => header)
|
193
193
|
end
|
@@ -195,7 +195,7 @@ module TenableRuby
|
|
195
195
|
# Returns the list of plugin families
|
196
196
|
#
|
197
197
|
# Reference:
|
198
|
-
# https://
|
198
|
+
# https://developer.tenable.com/reference#plugins-families
|
199
199
|
def list_families
|
200
200
|
http_get(:uri => "/plugins/families", :fields => header)
|
201
201
|
end
|
@@ -203,7 +203,7 @@ module TenableRuby
|
|
203
203
|
# Returns the list of plugins in a family
|
204
204
|
#
|
205
205
|
# Reference:
|
206
|
-
# https://
|
206
|
+
# https://developer.tenable.com/reference#plugins-family-details
|
207
207
|
def list_plugins(family_id)
|
208
208
|
http_get(:uri => "/plugins/families/#{family_id}", :fields => header)
|
209
209
|
end
|
@@ -211,7 +211,7 @@ module TenableRuby
|
|
211
211
|
# Returns the template list
|
212
212
|
#
|
213
213
|
# Reference:
|
214
|
-
# https://
|
214
|
+
# https://developer.tenable.com/reference#editor-list-templates
|
215
215
|
def list_templates(type)
|
216
216
|
http_get(:uri => "/editor/#{type}/templates", :fields => header)
|
217
217
|
end
|
@@ -219,7 +219,7 @@ module TenableRuby
|
|
219
219
|
# Returns details for the given template
|
220
220
|
#
|
221
221
|
# Reference:
|
222
|
-
# https://
|
222
|
+
# https://developer.tenable.com/reference#editor-template-details
|
223
223
|
def editor_templates (type, uuid)
|
224
224
|
http_get(:uri => "/editor/#{type}/templates/#{uuid}", :fields => header)
|
225
225
|
end
|
@@ -227,7 +227,7 @@ module TenableRuby
|
|
227
227
|
# Returns details for a given plugin
|
228
228
|
#
|
229
229
|
# Reference:
|
230
|
-
# https://
|
230
|
+
# https://developer.tenable.com/reference#plugins-plugin-details
|
231
231
|
def plugin_details(plugin_id)
|
232
232
|
http_get(:uri => "/plugins/plugin/#{plugin_id}", :fields => header)
|
233
233
|
end
|
@@ -235,7 +235,7 @@ module TenableRuby
|
|
235
235
|
# Returns the server status
|
236
236
|
#
|
237
237
|
# Reference:
|
238
|
-
# https://
|
238
|
+
# https://developer.tenable.com/reference#server-status
|
239
239
|
def server_status
|
240
240
|
http_get(:uri => "/server/status", :fields => header)
|
241
241
|
end
|
@@ -288,7 +288,7 @@ module TenableRuby
|
|
288
288
|
# Creates a scan
|
289
289
|
#
|
290
290
|
# Reference:
|
291
|
-
# https://
|
291
|
+
# https://developer.tenable.com/reference#scans-create
|
292
292
|
def scan_create(uuid, settings)
|
293
293
|
payload = {
|
294
294
|
:uuid => uuid,
|
@@ -301,7 +301,7 @@ module TenableRuby
|
|
301
301
|
# Launches a scan
|
302
302
|
#
|
303
303
|
# Reference:
|
304
|
-
# https://
|
304
|
+
# https://developer.tenable.com/reference#scans-launch
|
305
305
|
def scan_launch(scan_id)
|
306
306
|
http_post(:uri => "/scans/#{scan_id}/launch", :fields => header)
|
307
307
|
end
|
@@ -309,7 +309,7 @@ module TenableRuby
|
|
309
309
|
# Get List of Scans
|
310
310
|
#
|
311
311
|
# Reference:
|
312
|
-
# https://
|
312
|
+
# https://developer.tenable.com/reference#scans-list
|
313
313
|
def scan_list
|
314
314
|
http_get(:uri => "/scans", :fields => header)
|
315
315
|
end
|
@@ -317,7 +317,7 @@ module TenableRuby
|
|
317
317
|
# Returns details for the given scan
|
318
318
|
#
|
319
319
|
# Reference:
|
320
|
-
# https://
|
320
|
+
# https://developer.tenable.com/reference#scans-details
|
321
321
|
def scan_details(scan_id)
|
322
322
|
http_get(:uri => "/scans/#{scan_id}", :fields => header)
|
323
323
|
end
|
@@ -325,7 +325,7 @@ module TenableRuby
|
|
325
325
|
# Pauses a scan
|
326
326
|
#
|
327
327
|
# Reference:
|
328
|
-
# https://
|
328
|
+
# https://developer.tenable.com/reference#scans-pause
|
329
329
|
def scan_pause(scan_id)
|
330
330
|
http_post(:uri => "/scans/#{scan_id}/pause", :fields => header)
|
331
331
|
end
|
@@ -333,7 +333,7 @@ module TenableRuby
|
|
333
333
|
# Resumes a scan
|
334
334
|
#
|
335
335
|
# Reference:
|
336
|
-
# https://
|
336
|
+
# https://developer.tenable.com/reference#scans-resume
|
337
337
|
def scan_resume(scan_id)
|
338
338
|
http_post(:uri => "/scans/#{scan_id}/resume", :fields => header)
|
339
339
|
end
|
@@ -341,7 +341,7 @@ module TenableRuby
|
|
341
341
|
# Stops a scan
|
342
342
|
#
|
343
343
|
# Reference:
|
344
|
-
# https://
|
344
|
+
# https://developer.tenable.com/reference#scans-stop
|
345
345
|
def scan_stop(scan_id)
|
346
346
|
http_post(:uri => "/scans/#{scan_id}/stop", :fields => header)
|
347
347
|
end
|
@@ -350,7 +350,7 @@ module TenableRuby
|
|
350
350
|
# upon receiving a "ready" status from the export status method.
|
351
351
|
#
|
352
352
|
# Reference:
|
353
|
-
# https://
|
353
|
+
# https://developer.tenable.com/reference#scans-export-request
|
354
354
|
def scan_export(scan_id, format)
|
355
355
|
payload = {
|
356
356
|
:format => format
|
@@ -363,7 +363,7 @@ module TenableRuby
|
|
363
363
|
# using the export download endpoint.
|
364
364
|
#
|
365
365
|
# Reference:
|
366
|
-
# https://
|
366
|
+
# https://developer.tenable.com/reference#scans-export-status
|
367
367
|
def scan_export_status(scan_id, file_id)
|
368
368
|
http_get(:uri => "/scans/#{scan_id}/export/#{file_id}/status", :fields => header)
|
369
369
|
end
|
@@ -371,16 +371,15 @@ module TenableRuby
|
|
371
371
|
# Deletes a scan. NOTE: Scans in running, paused or stopping states can not be deleted.
|
372
372
|
#
|
373
373
|
# Reference:
|
374
|
-
# https://
|
374
|
+
# https://developer.tenable.com/reference#scans-delete
|
375
375
|
def scan_delete(scan_id)
|
376
|
-
|
377
|
-
return response.code == 200
|
376
|
+
http_delete(:uri => "/scans/#{scan_id}", :fields => header)
|
378
377
|
end
|
379
378
|
|
380
379
|
# Returns details for the given host
|
381
380
|
#
|
382
381
|
# Reference:
|
383
|
-
# https://
|
382
|
+
# https://developer.tenable.com/reference#scans-host-details
|
384
383
|
def host_details(scan_id, host_id, history_id: nil)
|
385
384
|
uri = "/scans/#{scan_id}/hosts/#{host_id}"
|
386
385
|
unless history_id.nil?
|
@@ -392,7 +391,7 @@ module TenableRuby
|
|
392
391
|
# Download an exported scan
|
393
392
|
#
|
394
393
|
# Reference:
|
395
|
-
# https://
|
394
|
+
# https://developer.tenable.com/reference#scans-export-download
|
396
395
|
def report_download(scan_id, file_id)
|
397
396
|
http_get(:uri => "/scans/#{scan_id}/export/#{file_id}/download", :raw_content => true, :fields => header)
|
398
397
|
end
|
@@ -400,7 +399,7 @@ module TenableRuby
|
|
400
399
|
# Returns details for the given policy
|
401
400
|
#
|
402
401
|
# Reference:
|
403
|
-
# https://
|
402
|
+
# https://developer.tenable.com/reference#policies-details
|
404
403
|
def policy_details(policy_id)
|
405
404
|
http_get(:uri => "/policies/#{policy_id}", :fields => header)
|
406
405
|
end
|
@@ -408,7 +407,7 @@ module TenableRuby
|
|
408
407
|
# Creates a policy
|
409
408
|
#
|
410
409
|
# Reference:
|
411
|
-
# https://
|
410
|
+
# https://developer.tenable.com/reference#policies-create
|
412
411
|
def policy_create(template_id, plugins, settings)
|
413
412
|
options = {
|
414
413
|
:uri => "/policies/",
|
@@ -428,7 +427,7 @@ module TenableRuby
|
|
428
427
|
# Copy a policy
|
429
428
|
#
|
430
429
|
# Reference:
|
431
|
-
# https://
|
430
|
+
# https://developer.tenable.com/reference#policies-copy
|
432
431
|
def policy_copy(policy_id)
|
433
432
|
options = {
|
434
433
|
:uri => "/policies/#{policy_id}/copy",
|
@@ -441,7 +440,7 @@ module TenableRuby
|
|
441
440
|
# Changes the parameters of a policy
|
442
441
|
#
|
443
442
|
# Reference:
|
444
|
-
# https://
|
443
|
+
# https://developer.tenable.com/reference#policies-configure
|
445
444
|
def policy_configure(policy_id, template_id, plugins, settings)
|
446
445
|
options = {
|
447
446
|
:uri => "/policies/#{policy_id}",
|
@@ -461,7 +460,7 @@ module TenableRuby
|
|
461
460
|
# Delete a policy
|
462
461
|
#
|
463
462
|
# Reference:
|
464
|
-
# https://
|
463
|
+
# https://developer.tenable.com/reference#policies-delete
|
465
464
|
def policy_delete(policy_id)
|
466
465
|
response = http_delete(:uri => "/policies/#{policy_id}", :fields => header)
|
467
466
|
response.code
|
@@ -592,7 +591,7 @@ module TenableRuby
|
|
592
591
|
# Returns a list of all containers.
|
593
592
|
#
|
594
593
|
# Reference:
|
595
|
-
# https://
|
594
|
+
# https://developer.tenable.com/reference#container-security-containers-list-containers
|
596
595
|
def list_containers()
|
597
596
|
http_get(:uri => "/container-security/api/v1/container/list", :fields => header)
|
598
597
|
end
|
@@ -600,7 +599,7 @@ module TenableRuby
|
|
600
599
|
# Returns an inventory of an image by ID.
|
601
600
|
#
|
602
601
|
# Reference:
|
603
|
-
# https://
|
602
|
+
# https://developer.tenable.com/reference#container-security-containers-image-inventory
|
604
603
|
def image_inventory(image_id)
|
605
604
|
http_get(:uri => "/container-security/api/v1/container/#{policy_id}/status", :fields => header)
|
606
605
|
end
|
@@ -608,7 +607,7 @@ module TenableRuby
|
|
608
607
|
# Returns the status of a job that you specify by ID to determine if the job is still queued, in progress, or has completed.
|
609
608
|
#
|
610
609
|
# Reference:
|
611
|
-
# https://
|
610
|
+
# https://developer.tenable.com/reference#container-security-jobs-job-status
|
612
611
|
def job_status(job_id)
|
613
612
|
http_get(:uri => "/container-security/api/v1/jobs/status?job_id=#{job_id}", :fields => header)
|
614
613
|
end
|
@@ -616,7 +615,7 @@ module TenableRuby
|
|
616
615
|
# Returns the status of a job by specifying an image ID to determine if the job is still queued, in progress, or has completed.
|
617
616
|
#
|
618
617
|
# Reference:
|
619
|
-
# https://
|
618
|
+
# https://developer.tenable.com/reference#container-security-jobs-job-status-by-image-id
|
620
619
|
def image_status(image_id)
|
621
620
|
http_get(:uri => "/container-security/api/v1/jobs/image_status?image_id=#{image_id}", :fields => header)
|
622
621
|
end
|
@@ -624,7 +623,7 @@ module TenableRuby
|
|
624
623
|
# Returns the status of a job by specifying an image digest to determine if the job is still queued, in progress, or has completed.
|
625
624
|
#
|
626
625
|
# Reference:
|
627
|
-
# https://
|
626
|
+
# https://developer.tenable.com/reference#container-security-jobs-job-status-by-image-digest
|
628
627
|
def image_status_digest(image_digest)
|
629
628
|
http_get(:uri => "/container-security/api/v1/jobs/image_status_digest?image_digest=#{image_digest}", :fields => header)
|
630
629
|
end
|
@@ -632,7 +631,7 @@ module TenableRuby
|
|
632
631
|
# Returns a list of active Container Security jobs
|
633
632
|
#
|
634
633
|
# Reference:
|
635
|
-
# https://
|
634
|
+
# https://developer.tenable.com/reference#container-security-jobs-list-jobs
|
636
635
|
def list_jobs()
|
637
636
|
http_get(:uri => "/container-security/api/v1/jobs/list", :fields => header)
|
638
637
|
end
|
@@ -640,7 +639,7 @@ module TenableRuby
|
|
640
639
|
# Checks the compliance of an image that you specify by ID against your policies.
|
641
640
|
#
|
642
641
|
# Reference:
|
643
|
-
# https://
|
642
|
+
# https://developer.tenable.com/reference#container-security-policy-policy-compliance-by-id
|
644
643
|
def policy_compliance_by_id(image_id)
|
645
644
|
http_get(:uri => "/container-security/api/v1/policycompliance?image_id=#{image_id}", :fields => header)
|
646
645
|
end
|
@@ -648,7 +647,7 @@ module TenableRuby
|
|
648
647
|
# Checks the compliance of an image that you specify by name against your policies.
|
649
648
|
#
|
650
649
|
# Reference:
|
651
|
-
# https://
|
650
|
+
# https://developer.tenable.com/reference#container-security-policy-policy-compliance-by-name
|
652
651
|
def policy_compliance_by_name(image)
|
653
652
|
http_get(:uri => "/container-security/api/v1/compliancebyname?image=#{image}", :fields => header)
|
654
653
|
end
|
@@ -656,7 +655,7 @@ module TenableRuby
|
|
656
655
|
# 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.
|
657
656
|
#
|
658
657
|
# Reference:
|
659
|
-
# https://
|
658
|
+
# https://developer.tenable.com/reference#container-security-reports-report-by-container-id
|
660
659
|
def report_by_container_id(container_id)
|
661
660
|
http_get(:uri => "/container-security/api/v1/reports/show?container_id=#{container_id}", :fields => header)
|
662
661
|
end
|
@@ -664,7 +663,7 @@ module TenableRuby
|
|
664
663
|
# 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.
|
665
664
|
#
|
666
665
|
# Reference:
|
667
|
-
# https://
|
666
|
+
# https://developer.tenable.com/reference#container-security-reports-report-by-image-id
|
668
667
|
def report_by_image_id(image_id)
|
669
668
|
http_get(:uri => "/container-security/api/v1/reports/by_image?image_id=#{image_id}", :fields => header)
|
670
669
|
end
|
@@ -672,7 +671,7 @@ module TenableRuby
|
|
672
671
|
# Returns a report in JSON format for an image digest.
|
673
672
|
#
|
674
673
|
# Reference:
|
675
|
-
# https://
|
674
|
+
# https://developer.tenable.com/reference#container-security-reports-report-by-image-digest
|
676
675
|
def report_by_image_digest(image_digest)
|
677
676
|
http_get(:uri => "/container-security/api/v1/reports/by_image_digest?image_digest=#{image_digest}", :fields => header)
|
678
677
|
end
|
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.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Craston
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Ruby library for communicating with the tenable.io API.
|