tenable-ruby 0.2.10 → 0.3.0
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 +49 -4
- 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: 9d538ef4f3b182110dd5b74ab03dfa56bf346d95
|
4
|
+
data.tar.gz: a8f4361484a9c5d1fc0b2a3c0f3f504f62425d2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc335f3866393aa2f7aaffd3232f6d9d1c044a9732ed3cb425545547ed9ee4edc5883f4707e6dc93cd3525f0c096e517240a0735231255f687ba8149af675911
|
7
|
+
data.tar.gz: 6176793f900e4ae25ab631f286ea6d1ac2b0fe7aec8a02f830f750172bf6ba8872445bcf148cb070fa2d3562a797d540564e460e24adafd284f620564ea52420
|
data/lib/tenable-ruby.rb
CHANGED
@@ -240,6 +240,51 @@ module TenableRuby
|
|
240
240
|
http_get(:uri => "/server/status", :fields => header)
|
241
241
|
end
|
242
242
|
|
243
|
+
# Returns a list of agents for the specified scanner
|
244
|
+
#
|
245
|
+
# Reference
|
246
|
+
# https://developer.tenable.com/reference#agents-list
|
247
|
+
def agent_list
|
248
|
+
http_get(:uri => "/scanners/scanner_list/agents", :fields => header)
|
249
|
+
end
|
250
|
+
|
251
|
+
# Creates an agent group on the scanner
|
252
|
+
#
|
253
|
+
# Reference
|
254
|
+
# https://developer.tenable.com/reference#agent-groups-create
|
255
|
+
def agent_group_create(scanner_id, name)
|
256
|
+
payload = {
|
257
|
+
:scanner_id => scanner_id,
|
258
|
+
:name => name,
|
259
|
+
}.to_json
|
260
|
+
options = {
|
261
|
+
:uri => "/scanners/#{scanner_id}/agent-groups",
|
262
|
+
:body => payload,
|
263
|
+
:fields => header,
|
264
|
+
:ctype => 'application/json',
|
265
|
+
}
|
266
|
+
http_post(options)
|
267
|
+
end
|
268
|
+
|
269
|
+
# Adds an agent to the agent group
|
270
|
+
#
|
271
|
+
# Reference
|
272
|
+
# https://developer.tenable.com/reference#agent-groups-add-agent
|
273
|
+
def agent_group_add_agent(scanner_id, group_id, agent_id)
|
274
|
+
payload = {
|
275
|
+
:scanner_id => scanner_id,
|
276
|
+
:group_id => group_id,
|
277
|
+
:agent_id => agent_id,
|
278
|
+
}.to_json
|
279
|
+
options = {
|
280
|
+
:uri => "/scanners/#{scanner_id}/agent-groups/#{group_id}/agents/#{agent_id}",
|
281
|
+
:body => payload,
|
282
|
+
:fields => header,
|
283
|
+
:ctype => 'application/json',
|
284
|
+
}
|
285
|
+
http_put(options)
|
286
|
+
end
|
287
|
+
|
243
288
|
# Creates a scan
|
244
289
|
#
|
245
290
|
# Reference:
|
@@ -426,7 +471,7 @@ module TenableRuby
|
|
426
471
|
# Name is your scan name and targets are targets for scan
|
427
472
|
#
|
428
473
|
# returns: JSON parsed object with scan info
|
429
|
-
def scan_quick_template
|
474
|
+
def scan_quick_template(templatename, name, targets)
|
430
475
|
templates = list_templates('scan')['templates'].select do |temp|
|
431
476
|
temp['uuid'] == templatename or temp['name'] == templatename or temp['title'] == templatename
|
432
477
|
end
|
@@ -442,12 +487,12 @@ module TenableRuby
|
|
442
487
|
end
|
443
488
|
|
444
489
|
# Performs scan with scan policy provided (uuid of policy or policy name).
|
445
|
-
# Name is your scan name and
|
490
|
+
# Name is your scan name and opts is your scan configuration hash
|
446
491
|
# (foldername is optional - folder where to save the scan (if that folder exists))
|
447
492
|
# (scanner_id is optional - ID of the scanner/cloud scanner you want to run this scan on)
|
448
493
|
#
|
449
494
|
# returns: JSON parsed object with scan info
|
450
|
-
def scan_quick_policy
|
495
|
+
def scan_quick_policy(policyname, name, opts = {}, foldername = nil, scanner_id = nil)
|
451
496
|
policies = list_policies['policies'].select do |pol|
|
452
497
|
pol['id'] == policyname or pol['name'] == policyname
|
453
498
|
end
|
@@ -458,9 +503,9 @@ module TenableRuby
|
|
458
503
|
template_uuid = policy['template_uuid']
|
459
504
|
settings = Hash.new
|
460
505
|
settings.merge!(@quick_defaults)
|
506
|
+
settings.merge!(opts)
|
461
507
|
settings['name'] = name
|
462
508
|
settings['policy_id'] = policy['id']
|
463
|
-
settings['text_targets'] = targets
|
464
509
|
unless foldername.nil?
|
465
510
|
folders = list_folders['folders'].select do |folder|
|
466
511
|
folder['name'] == foldername
|
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.
|
4
|
+
version: 0.3.0
|
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-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Ruby library for communicating with the tenable.io API.
|