Nessus6 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Nessus6.gemspec +11 -11
- data/lib/Nessus6/editor.rb +0 -8
- data/lib/Nessus6/file.rb +0 -5
- data/lib/Nessus6/folder.rb +0 -7
- data/lib/Nessus6/group.rb +0 -7
- data/lib/Nessus6/permission.rb +0 -5
- data/lib/Nessus6/plugin.rb +53 -0
- data/lib/Nessus6/plugin_rules.rb +92 -0
- data/lib/Nessus6/scan.rb +0 -7
- data/lib/Nessus6/scanner.rb +33 -0
- data/lib/Nessus6/server.rb +27 -0
- data/lib/Nessus6/session.rb +0 -7
- data/lib/Nessus6/user.rb +0 -8
- data/lib/Nessus6/verification.rb +9 -0
- data/lib/Nessus6/version.rb +1 -1
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ea57398554fa50d66e69cbd4f764fdfdf70800f
|
4
|
+
data.tar.gz: 59fbbc502baedf879a692a4413433bdccbf390de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 311e47c8a8e10bca9fac1cf82f60eb3196b24c4e7b5224b848406006fbc4b7aef0f8f074605c33a4e5fefceb3d51d1e3e7df49f562a1e34199a5222df62b279b
|
7
|
+
data.tar.gz: 9612248b7da4daffbb06bbd205656a05f38b5f0f86d0fe42b998a847f1e8ddc42588138e6513f95b8639192a8383cea3e95554b1f1feb0753c594ead2058c55b
|
data/Nessus6.gemspec
CHANGED
@@ -4,27 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'Nessus6/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'Nessus6'
|
8
8
|
spec.version = Nessus6::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Kevin Kirsche']
|
10
|
+
spec.email = ['kev.kirsche@gmail.com']
|
11
11
|
spec.license = 'Apache-2.0'
|
12
12
|
|
13
13
|
spec.summary = %q{[Under Construction] Nessus 6 API Gem}
|
14
14
|
spec.description = %q{Gem for interacting with the Tenable Nessus 6 REST API.}
|
15
|
-
spec.homepage =
|
15
|
+
spec.homepage = 'https://github.com/kkirsche/Nessus6'
|
16
16
|
|
17
17
|
spec.required_ruby_version = '>= 2.0.0'
|
18
18
|
|
19
19
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
spec.bindir =
|
20
|
+
spec.bindir = 'exe'
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = [
|
22
|
+
spec.require_paths = ['lib']
|
23
23
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'minitest', '~> 5.8'
|
27
|
+
spec.add_development_dependency 'yard', '~> 0.8'
|
28
28
|
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
|
29
|
-
spec.add_runtime_dependency
|
29
|
+
spec.add_runtime_dependency 'hurley', '~> 0.1'
|
30
30
|
end
|
data/lib/Nessus6/editor.rb
CHANGED
@@ -1,11 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'Nessus6/errors/bad_request' # 400
|
3
|
-
require 'Nessus6/errors/forbidden' # 403
|
4
|
-
require 'Nessus6/errors/not_found' # 404
|
5
|
-
require 'Nessus6/errors/conflict' # 409
|
6
|
-
require 'Nessus6/errors/internal_server_error' # 500
|
7
|
-
require 'Nessus6/errors/unknown' # Unknown Error Code
|
8
|
-
|
9
1
|
module Nessus6
|
10
2
|
# The Editor class is for interacting with Nessus6 templates. Templates are
|
11
3
|
# used to create scans or policies with predefined parameters.
|
data/lib/Nessus6/file.rb
CHANGED
data/lib/Nessus6/folder.rb
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'Nessus6/errors/internal_server_error'
|
3
|
-
require 'Nessus6/errors/forbidden'
|
4
|
-
require 'Nessus6/errors/bad_request'
|
5
|
-
require 'Nessus6/errors/not_found'
|
6
|
-
require 'Nessus6/errors/unknown'
|
7
|
-
|
8
1
|
module Nessus6
|
9
2
|
# The Folders class is for interacting with Nessus6 folders. Folders are used
|
10
3
|
# to sort and organize a user's scan results.
|
data/lib/Nessus6/group.rb
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'Nessus6/errors/internal_server_error' # 500
|
3
|
-
require 'Nessus6/errors/forbidden' # 403
|
4
|
-
require 'Nessus6/errors/bad_request' # 400
|
5
|
-
require 'Nessus6/errors/not_found' # 404
|
6
|
-
require 'Nessus6/errors/unknown'
|
7
|
-
|
8
1
|
module Nessus6
|
9
2
|
# The Groups class is for interacting with Nessus6 user groups. Groups are
|
10
3
|
# utilized to make sharing easier.
|
data/lib/Nessus6/permission.rb
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'Nessus6/errors/forbidden' # 403
|
3
|
-
require 'Nessus6/errors/not_found' # 404
|
4
|
-
require 'Nessus6/errors/unknown'
|
5
|
-
|
6
1
|
module Nessus6
|
7
2
|
# The Permissions class is for interacting with Nessus6 user permissions.
|
8
3
|
# Permissions are used to provide access rights to a given object.
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module Nessus6
|
2
|
+
# The Plugin class is for interacting with Nessus6 plugins.
|
3
|
+
# https://localhost:8834/api#/resources/plugins
|
4
|
+
class Plugin
|
5
|
+
include Nessus6::Verification
|
6
|
+
|
7
|
+
public
|
8
|
+
|
9
|
+
def initialize(client)
|
10
|
+
@client = client
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns the list of plugin families. This request requires standard user
|
14
|
+
# permissions.
|
15
|
+
#
|
16
|
+
# @return [Hash]
|
17
|
+
def families
|
18
|
+
response = @client.get('plugins/families')
|
19
|
+
verify response,
|
20
|
+
forbidden: 'You do not have permission to view plugin families',
|
21
|
+
internal_server_error: 'Server failed to retrieve the plugin '\
|
22
|
+
'family list.'
|
23
|
+
end
|
24
|
+
|
25
|
+
# Returns the list of plugins in a family. This request requires standard
|
26
|
+
# user permissions.
|
27
|
+
#
|
28
|
+
# @param plugin_family_id [String] The id of the family to lookup.
|
29
|
+
# @return [Hash]
|
30
|
+
def family_details(plugin_family_id)
|
31
|
+
response = @client.get("plugins/families/#{plugin_family_id}")
|
32
|
+
verify response,
|
33
|
+
forbidden: 'You do not have permission to view the plugin family',
|
34
|
+
not_found: 'Plugin family not found',
|
35
|
+
internal_server_error: 'Server failed to retrieve the plugin '\
|
36
|
+
'family details.'
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns the details for a given plugin. This request requires standard
|
40
|
+
# user permissions.
|
41
|
+
#
|
42
|
+
# @param plugin_id [String] The id of the plugin.
|
43
|
+
# @return [Hash]
|
44
|
+
def plugin_details(plugin_id)
|
45
|
+
response = @client.get("plugins/plugin/#{plugin_id}")
|
46
|
+
verify response,
|
47
|
+
forbidden: 'You do not have permission to view the plugin',
|
48
|
+
not_found: 'Plugin not found',
|
49
|
+
internal_server_error: 'Server failed to retrieve the plugin '\
|
50
|
+
'details.'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module Nessus6
|
2
|
+
# The Plugin class is for interacting with Nessus6 plugins.
|
3
|
+
# https://localhost:8834/api#/resources/plugins
|
4
|
+
class PluginRules
|
5
|
+
include Nessus6::Verification
|
6
|
+
|
7
|
+
public
|
8
|
+
|
9
|
+
def initialize(client)
|
10
|
+
@client = client
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns the list of plugin families. This request requires standard user
|
14
|
+
# permissions.
|
15
|
+
#
|
16
|
+
# @return [Hash]
|
17
|
+
def list
|
18
|
+
response = @client.get('plugins-rules')
|
19
|
+
verify response,
|
20
|
+
forbidden: 'You do not have permission to view plugin rules list',
|
21
|
+
internal_server_error: 'Server failed to create the group'
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns the list of plugins in a family. This request requires standard
|
25
|
+
# user permissions.
|
26
|
+
#
|
27
|
+
# @param plugin_id [String, Fixnum] The id of the plugin to apply the rule
|
28
|
+
# to.
|
29
|
+
# @param type [String] The new severity to apply (recast_critical,
|
30
|
+
# recast_high, recast_medium, recast_low, recast_info, exclude).
|
31
|
+
# @param host [String] The host to apply the rule to.
|
32
|
+
# @param date [String] The expiration date of the plugin rule
|
33
|
+
# @return [Hash]
|
34
|
+
def create(plugin_id, type, host, date = nil)
|
35
|
+
if date.nil?
|
36
|
+
response = @client.post('plugin-rules', plugin_id: plugin_id,
|
37
|
+
type: type,
|
38
|
+
host: host)
|
39
|
+
else
|
40
|
+
response = @client.post('plugin-rules', plugin_id: plugin_id,
|
41
|
+
type: type,
|
42
|
+
host: host,
|
43
|
+
date: date)
|
44
|
+
end
|
45
|
+
verify response,
|
46
|
+
bad_request: 'An argument is missing or invalid',
|
47
|
+
forbidden: 'You do not have permission to create this plugin rule',
|
48
|
+
not_found: 'Plugin family not found',
|
49
|
+
internal_server_error: 'Server failed to create the plugin rule'
|
50
|
+
end
|
51
|
+
|
52
|
+
# Deletes a plugin rule. This request requires read only user permissions.
|
53
|
+
#
|
54
|
+
# @param rule_id [String, Fixnum] The id of the rule to delete.
|
55
|
+
# @return [Hash]
|
56
|
+
def delete(rule_id)
|
57
|
+
response = @client.delete("plugin-rules/#{rule_id}")
|
58
|
+
verify response,
|
59
|
+
forbidden: 'You do not have permission to delete the rule.',
|
60
|
+
not_found: 'Rule with that ID could not be found',
|
61
|
+
internal_server_error: 'Server failed to create the group'
|
62
|
+
end
|
63
|
+
|
64
|
+
# Modify a plugin rule for the current user. This request requires read only
|
65
|
+
# user permissions.
|
66
|
+
#
|
67
|
+
# @param rule_id [String, Fixnum] The id of the rule to delete.
|
68
|
+
# @param plugin_id [String, Fixnum] The id of the plugin to apply the rule
|
69
|
+
# to.
|
70
|
+
# @param type [String] The new severity to apply (recast_critical,
|
71
|
+
# recast_high, recast_medium, recast_low, recast_info, exclude).
|
72
|
+
# @param host [String] The host to apply the rule to.
|
73
|
+
# @param date [String] The expiration date of the plugin rule
|
74
|
+
# @return [Hash]
|
75
|
+
def edit(rule_id, plugin_id, type, host, date = nil)
|
76
|
+
if date.nil?
|
77
|
+
response = @client.put("plugin-rules/#{rule_id}", plugin_id: plugin_id,
|
78
|
+
type: type,
|
79
|
+
host: host)
|
80
|
+
else
|
81
|
+
response = @client.put("plugin-rules/#{rule_id}", plugin_id: plugin_id,
|
82
|
+
type: type,
|
83
|
+
host: host,
|
84
|
+
date: date)
|
85
|
+
end
|
86
|
+
verify response,
|
87
|
+
forbidden: 'You do not have permission to delete the rule.',
|
88
|
+
not_found: 'Rule with that ID could not be found',
|
89
|
+
internal_server_error: 'Server failed to create the group'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
data/lib/Nessus6/scan.rb
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'Nessus6/errors/forbidden' # 403
|
3
|
-
require 'Nessus6/errors/not_found' # 404
|
4
|
-
require 'Nessus6/errors/conflict' # 409
|
5
|
-
require 'Nessus6/errors/internal_server_error' # 500
|
6
|
-
require 'Nessus6/errors/unknown'
|
7
|
-
|
8
1
|
module Nessus6
|
9
2
|
# The Scans class is for interacting with Nessus6 scans.
|
10
3
|
# https://localhost:8834/api#/resources/scans
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Nessus6
|
2
|
+
# The Scanner class provides details about the available scanners
|
3
|
+
# https://localhost:8834/api#/resources/server
|
4
|
+
class Scanner
|
5
|
+
include Nessus6::Verification
|
6
|
+
|
7
|
+
public
|
8
|
+
|
9
|
+
# Returns the scanner list. This request requires administrator user
|
10
|
+
# permissions.
|
11
|
+
#
|
12
|
+
# @return [Hash]
|
13
|
+
def list
|
14
|
+
response = @client.get('scanners')
|
15
|
+
verify response,
|
16
|
+
forbidden: 'You do not have permission to view the list',
|
17
|
+
internal_server_error: 'Server failed to retrieve properties'
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns the agent list for the given scanner. This request requires
|
21
|
+
# administrator user permissions.
|
22
|
+
#
|
23
|
+
# @param scanner_id [String, Fixnum] The id of the scanner to query for
|
24
|
+
# agents.
|
25
|
+
# @return [Hash]
|
26
|
+
def list_agents(scanner_id)
|
27
|
+
response = @client.get("scanners/#{scanner_id}/agents")
|
28
|
+
verify response,
|
29
|
+
forbidden: 'You do not have permission to view the list of agents',
|
30
|
+
internal_server_error: 'Server failed to retrieve agent list'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Nessus6
|
2
|
+
# The Server class returns information about the Nessus Server itself
|
3
|
+
# https://localhost:8834/api#/resources/server
|
4
|
+
class Server
|
5
|
+
include Nessus6::Verification
|
6
|
+
|
7
|
+
public
|
8
|
+
|
9
|
+
# Returns the Nessus server version and other properties.
|
10
|
+
#
|
11
|
+
# @return [Hash]
|
12
|
+
def properties
|
13
|
+
response = @client.get('server/properties')
|
14
|
+
verify response,
|
15
|
+
internal_server_error: 'Server failed to retrieve properties'
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns the Nessus server status.
|
19
|
+
#
|
20
|
+
# @return [Hash]
|
21
|
+
def status
|
22
|
+
response = @client.get('server/status')
|
23
|
+
verify response,
|
24
|
+
internal_server_error: 'Server failed to retrieve status'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/Nessus6/session.rb
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'Nessus6/errors/bad_request'
|
3
|
-
require 'Nessus6/errors/forbidden'
|
4
|
-
require 'Nessus6/errors/internal_server_error'
|
5
|
-
require 'Nessus6/errors/unauthorized'
|
6
|
-
require 'Nessus6/errors/unknown'
|
7
|
-
|
8
1
|
module Nessus6
|
9
2
|
# The Session class is used to create a session with Nessus6. User sessions
|
10
3
|
# allow us to interact throughout our applications.
|
data/lib/Nessus6/user.rb
CHANGED
@@ -1,11 +1,3 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'Nessus6/errors/bad_request'
|
3
|
-
require 'Nessus6/errors/conflict'
|
4
|
-
require 'Nessus6/errors/forbidden'
|
5
|
-
require 'Nessus6/errors/internal_server_error'
|
6
|
-
require 'Nessus6/errors/not_found'
|
7
|
-
require 'Nessus6/errors/unknown'
|
8
|
-
|
9
1
|
module Nessus6
|
10
2
|
# The Users class allows us to interact with Nessus 6 users.
|
11
3
|
# Users can utilize Nessus based on their given role.
|
data/lib/Nessus6/verification.rb
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'nessus6/errors/bad_request'
|
3
|
+
require 'nessus6/errors/conflict'
|
4
|
+
require 'nessus6/errors/forbidden'
|
5
|
+
require 'nessus6/errors/internal_server_error'
|
6
|
+
require 'nessus6/errors/not_found'
|
7
|
+
require 'nessus6/errors/unauthorized'
|
8
|
+
require 'nessus6/errors/unknown'
|
9
|
+
|
1
10
|
module Nessus6
|
2
11
|
# The verification class allows methods to verify responses from Nessus
|
3
12
|
module Verification
|
data/lib/Nessus6/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Nessus6
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Kirsche
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +124,11 @@ files:
|
|
124
124
|
- lib/Nessus6/folder.rb
|
125
125
|
- lib/Nessus6/group.rb
|
126
126
|
- lib/Nessus6/permission.rb
|
127
|
+
- lib/Nessus6/plugin.rb
|
128
|
+
- lib/Nessus6/plugin_rules.rb
|
127
129
|
- lib/Nessus6/scan.rb
|
130
|
+
- lib/Nessus6/scanner.rb
|
131
|
+
- lib/Nessus6/server.rb
|
128
132
|
- lib/Nessus6/session.rb
|
129
133
|
- lib/Nessus6/user.rb
|
130
134
|
- lib/Nessus6/verification.rb
|
@@ -149,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
153
|
version: '0'
|
150
154
|
requirements: []
|
151
155
|
rubyforge_project:
|
152
|
-
rubygems_version: 2.4.
|
156
|
+
rubygems_version: 2.4.5.1
|
153
157
|
signing_key:
|
154
158
|
specification_version: 4
|
155
159
|
summary: "[Under Construction] Nessus 6 API Gem"
|