Nessus6 0.1.1 → 0.1.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/.travis.yml +18 -0
- data/Nessus6.gemspec +1 -0
- data/README.md +2 -0
- data/Rakefile +11 -1
- data/bin/console +4 -4
- data/lib/Nessus6.rb +22 -18
- data/lib/Nessus6/editor.rb +88 -0
- data/lib/Nessus6/errors/authentication_error.rb +8 -0
- data/lib/Nessus6/errors/bad_request.rb +10 -6
- data/lib/Nessus6/errors/conflict.rb +9 -5
- data/lib/Nessus6/errors/forbidden.rb +9 -5
- data/lib/Nessus6/errors/internal_server_error.rb +8 -4
- data/lib/Nessus6/errors/not_found.rb +9 -5
- data/lib/Nessus6/errors/unauthorized.rb +11 -7
- data/lib/Nessus6/errors/unknown.rb +7 -3
- data/lib/Nessus6/file.rb +31 -0
- data/lib/Nessus6/folder.rb +72 -0
- data/lib/Nessus6/group.rb +115 -0
- data/lib/Nessus6/permission.rb +46 -0
- data/lib/Nessus6/scan.rb +135 -0
- data/lib/Nessus6/session.rb +106 -0
- data/lib/Nessus6/user.rb +136 -0
- data/lib/Nessus6/verification.rb +29 -0
- data/lib/Nessus6/version.rb +1 -1
- metadata +26 -10
- data/lib/Nessus6/editor/methods.rb +0 -108
- data/lib/Nessus6/file/methods.rb +0 -34
- data/lib/Nessus6/folders/methods.rb +0 -118
- data/lib/Nessus6/groups/methods.rb +0 -202
- data/lib/Nessus6/permissions/methods.rb +0 -66
- data/lib/Nessus6/scans/methods.rb +0 -106
- data/lib/Nessus6/session/methods.rb +0 -142
- data/lib/Nessus6/users/methods.rb +0 -180
@@ -0,0 +1,29 @@
|
|
1
|
+
module Nessus6
|
2
|
+
# The verification class allows methods to verify responses from Nessus
|
3
|
+
module Verification
|
4
|
+
private
|
5
|
+
|
6
|
+
def verify(response, message = nil)
|
7
|
+
case response.status_code
|
8
|
+
when 200
|
9
|
+
return JSON.parse response.body
|
10
|
+
when 400
|
11
|
+
fail Nessus6::Error::BadRequestError, "#{message[:bad_request]}"
|
12
|
+
when 401
|
13
|
+
fail Nessus6::Error::UnauthorizedError, "#{message[:unauthorized]}"
|
14
|
+
when 403
|
15
|
+
fail Nessus6::Error::ForbiddenError, "#{message[:forbidden]}"
|
16
|
+
when 404
|
17
|
+
fail Nessus6::Error::NotFoundError, "#{message[:not_found]}"
|
18
|
+
when 409
|
19
|
+
fail Nessus6::Error::ConflictError, "#{message[:conflict]}"
|
20
|
+
when 500
|
21
|
+
fail Nessus6::Error::InternalServerError,
|
22
|
+
"#{message[:internal_server_error]}"
|
23
|
+
else
|
24
|
+
fail Nessus6::Error::UnknownError, 'An unknown error occurred. ' \
|
25
|
+
'Please consult Nessus for further details.'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
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.2
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: codeclimate-test-reporter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.4'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.4'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: hurley
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,7 +111,8 @@ files:
|
|
97
111
|
- bin/console
|
98
112
|
- bin/setup
|
99
113
|
- lib/Nessus6.rb
|
100
|
-
- lib/Nessus6/editor
|
114
|
+
- lib/Nessus6/editor.rb
|
115
|
+
- lib/Nessus6/errors/authentication_error.rb
|
101
116
|
- lib/Nessus6/errors/bad_request.rb
|
102
117
|
- lib/Nessus6/errors/conflict.rb
|
103
118
|
- lib/Nessus6/errors/forbidden.rb
|
@@ -105,13 +120,14 @@ files:
|
|
105
120
|
- lib/Nessus6/errors/not_found.rb
|
106
121
|
- lib/Nessus6/errors/unauthorized.rb
|
107
122
|
- lib/Nessus6/errors/unknown.rb
|
108
|
-
- lib/Nessus6/file
|
109
|
-
- lib/Nessus6/
|
110
|
-
- lib/Nessus6/
|
111
|
-
- lib/Nessus6/
|
112
|
-
- lib/Nessus6/
|
113
|
-
- lib/Nessus6/session
|
114
|
-
- lib/Nessus6/
|
123
|
+
- lib/Nessus6/file.rb
|
124
|
+
- lib/Nessus6/folder.rb
|
125
|
+
- lib/Nessus6/group.rb
|
126
|
+
- lib/Nessus6/permission.rb
|
127
|
+
- lib/Nessus6/scan.rb
|
128
|
+
- lib/Nessus6/session.rb
|
129
|
+
- lib/Nessus6/user.rb
|
130
|
+
- lib/Nessus6/verification.rb
|
115
131
|
- lib/Nessus6/version.rb
|
116
132
|
homepage: https://github.com/kkirsche/Nessus6
|
117
133
|
licenses:
|
@@ -1,108 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'Nessus6/errors/forbidden'
|
3
|
-
require 'Nessus6/errors/not_found'
|
4
|
-
require 'Nessus6/errors/unknown'
|
5
|
-
|
6
|
-
module Nessus6
|
7
|
-
# The Editor class is for interacting with Nessus6 templates
|
8
|
-
class Editor
|
9
|
-
def initialize(client)
|
10
|
-
@client = client
|
11
|
-
end
|
12
|
-
|
13
|
-
def audits(type, object_id, file_id)
|
14
|
-
response = @client.get("editor/#{type}/#{object_id}/audits/#{file_id}")
|
15
|
-
verify_audits response
|
16
|
-
end
|
17
|
-
|
18
|
-
def details(type, template_uuid)
|
19
|
-
response = @client.get("editor/#{type}/templates/#{template_uuid}")
|
20
|
-
verify_details response
|
21
|
-
end
|
22
|
-
|
23
|
-
def edit(type, id)
|
24
|
-
response = @client.get("editor/#{type}/#{id}")
|
25
|
-
verify_edit response
|
26
|
-
end
|
27
|
-
|
28
|
-
def list(type)
|
29
|
-
response = @client.get("editor/#{type}/templates")
|
30
|
-
verify response
|
31
|
-
end
|
32
|
-
|
33
|
-
def plugin_description(policy_id, family_id, plugin_id)
|
34
|
-
response = @client.get("editor/policy/#{policy_id}/families/#{family_id}/plugins/#{plugin_id}")
|
35
|
-
verify_plugin_description response
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def verify_audits(response)
|
41
|
-
case response.status_code
|
42
|
-
when 200
|
43
|
-
return JSON.parse response.body
|
44
|
-
when 403
|
45
|
-
fail ForbiddenError,
|
46
|
-
'You do not have permission to export the audit file'
|
47
|
-
when 404
|
48
|
-
fail NotFoundError, 'Audit file does not exist'
|
49
|
-
else
|
50
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
51
|
-
'for further details.'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def verify_details(response)
|
56
|
-
case response.status_code
|
57
|
-
when 200
|
58
|
-
return JSON.parse response.body
|
59
|
-
when 403
|
60
|
-
fail ForbiddenError,
|
61
|
-
'You do not have permission to open the template'
|
62
|
-
when 404
|
63
|
-
fail NotFoundError, 'Template does not exist'
|
64
|
-
else
|
65
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
66
|
-
'for further details.'
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def verify_edit(response)
|
71
|
-
case response.status_code
|
72
|
-
when 200
|
73
|
-
return JSON.parse response.body
|
74
|
-
when 403
|
75
|
-
fail ForbiddenError,
|
76
|
-
'You do not have permission to open the object'
|
77
|
-
when 404
|
78
|
-
fail NotFoundError, 'Object does not exist'
|
79
|
-
else
|
80
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
81
|
-
'for further details.'
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def verify_list(response)
|
86
|
-
case response.status_code
|
87
|
-
when 200
|
88
|
-
return JSON.parse response.body
|
89
|
-
when 403
|
90
|
-
fail ForbiddenError,
|
91
|
-
'You do not have permission to view the list'
|
92
|
-
else
|
93
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
94
|
-
'for further details.'
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def verify_plugin_description(response)
|
99
|
-
case response.status_code
|
100
|
-
when 200
|
101
|
-
return JSON.parse response.body
|
102
|
-
else
|
103
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
104
|
-
'for further details.'
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
data/lib/Nessus6/file/methods.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'hurley'
|
3
|
-
require 'Nessus6/errors/internal_server_error'
|
4
|
-
require 'Nessus6/errors/unknown'
|
5
|
-
|
6
|
-
module Nessus6
|
7
|
-
# The Editor class is for interacting with Nessus6 templates
|
8
|
-
class File
|
9
|
-
def initialize(client)
|
10
|
-
@client = client
|
11
|
-
end
|
12
|
-
|
13
|
-
def upload(file_path, file_type, encrypted = 0)
|
14
|
-
response = @client.post('file/upload',
|
15
|
-
file: Hurley::UploadIO.new(file_path, file_type),
|
16
|
-
no_enc: encrypted)
|
17
|
-
verify_upload response
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def verify_upload(response)
|
23
|
-
case response.status_code
|
24
|
-
when 200
|
25
|
-
return JSON.parse response.body
|
26
|
-
when 500
|
27
|
-
fail InternalServerError, 'File failed to upload'
|
28
|
-
else
|
29
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
30
|
-
'for further details.'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,118 +0,0 @@
|
|
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
|
-
module Nessus6
|
9
|
-
# The Editor class is for interacting with Nessus6 templates
|
10
|
-
class Folders
|
11
|
-
def initialize(client)
|
12
|
-
@client = client
|
13
|
-
end
|
14
|
-
|
15
|
-
# Creates a new folder for the current user. This request requires
|
16
|
-
# read-only user permissions.
|
17
|
-
#
|
18
|
-
# @param name [String] The name of the folder.
|
19
|
-
# @return [Hash]
|
20
|
-
def create(name)
|
21
|
-
response = @client.post('folders', name: name)
|
22
|
-
verify_create response
|
23
|
-
end
|
24
|
-
|
25
|
-
# Deletes a folder. This request requires read-only user permissions.
|
26
|
-
#
|
27
|
-
# @param folder_id [String, Fixnum] The id of the folder to delete.
|
28
|
-
# @return [Hash]
|
29
|
-
def delete(folder_id)
|
30
|
-
response = @client.delete("folders/#{folder_id}")
|
31
|
-
verify_delete response
|
32
|
-
end
|
33
|
-
|
34
|
-
# Rename a folder for the current user. This request requires read-only
|
35
|
-
# user permissions.
|
36
|
-
#
|
37
|
-
# @param folder_id [String, Fixnum] The id of the folder to edit.
|
38
|
-
# @param name [String] The name of the folder.
|
39
|
-
# @return [Hash]
|
40
|
-
def edit(folder_id, name)
|
41
|
-
response = @client.put("folders/#{folder_id}", name: name)
|
42
|
-
verify_edit response
|
43
|
-
end
|
44
|
-
|
45
|
-
alias_method :rename, :edit
|
46
|
-
|
47
|
-
# Returns the current user's scan folders.
|
48
|
-
#
|
49
|
-
# @return [Hash] { "folders": [folder Resource] }
|
50
|
-
def list
|
51
|
-
response = @client.get('folders')
|
52
|
-
verify_list response
|
53
|
-
end
|
54
|
-
|
55
|
-
private
|
56
|
-
|
57
|
-
def verify_create(response)
|
58
|
-
case response.status_code
|
59
|
-
when 200
|
60
|
-
return JSON.parse response.body
|
61
|
-
when 400
|
62
|
-
fail BadRequestError, 'Folder name is invalid'
|
63
|
-
when 403
|
64
|
-
fail ForbiddenError, 'You do not have permission to create a folder'
|
65
|
-
when 500
|
66
|
-
fail InternalServerError, 'Server failed to create the folder'
|
67
|
-
else
|
68
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
69
|
-
'for further details.'
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def verify_delete(response)
|
74
|
-
case response.status_code
|
75
|
-
when 200
|
76
|
-
return JSON.parse response.body
|
77
|
-
when 403
|
78
|
-
fail ForbiddenError, 'Cannot delete a system folder'
|
79
|
-
when 404
|
80
|
-
fail NotFoundError, 'Folder does not exist'
|
81
|
-
when 500
|
82
|
-
fail InternalServerError, 'Server failed to delete the folder'
|
83
|
-
else
|
84
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
85
|
-
'for further details.'
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def verify_edit(response)
|
90
|
-
case response.status_code
|
91
|
-
when 200
|
92
|
-
return JSON.parse response.body
|
93
|
-
when 403
|
94
|
-
fail ForbiddenError, 'Cannot rename a system folder'
|
95
|
-
when 404
|
96
|
-
fail NotFoundError, 'Folder does not exist'
|
97
|
-
when 500
|
98
|
-
fail InternalServerError, 'Server failed to rename the folder'
|
99
|
-
else
|
100
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
101
|
-
'for further details.'
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def verify_list(response)
|
106
|
-
case response.status_code
|
107
|
-
when 200
|
108
|
-
return JSON.parse response.body
|
109
|
-
when 403
|
110
|
-
fail ForbiddenError,
|
111
|
-
'You do not have permission to view the folder list'
|
112
|
-
else
|
113
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
114
|
-
'for further details.'
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
@@ -1,202 +0,0 @@
|
|
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
|
-
module Nessus6
|
9
|
-
# The Editor class is for interacting with Nessus6 templates
|
10
|
-
class Groups
|
11
|
-
def initialize(client)
|
12
|
-
@client = client
|
13
|
-
end
|
14
|
-
|
15
|
-
# Add a user to the group. This request requires administrator user
|
16
|
-
# permissions.
|
17
|
-
#
|
18
|
-
# @param group_id [String, Fixnum] The unique id of the group.
|
19
|
-
# @param user_id [String, Fixnum] The unique id of the user.
|
20
|
-
# @return [Hash]
|
21
|
-
def add_user(group_id, user_id)
|
22
|
-
response = @client.post("groups/#{group_id}/users/#{user_id}")
|
23
|
-
verify_add_user response
|
24
|
-
end
|
25
|
-
|
26
|
-
# Create a group. This request requires administrator user
|
27
|
-
# permissions.
|
28
|
-
#
|
29
|
-
# @param name [String, Fixnum] The name of the group.
|
30
|
-
# @return [Hash]
|
31
|
-
def create(name)
|
32
|
-
response = @client.post('groups', name: name)
|
33
|
-
verify_create response
|
34
|
-
end
|
35
|
-
|
36
|
-
# Delete a group. This request requires administrator user
|
37
|
-
# permissions.
|
38
|
-
#
|
39
|
-
# @param group_id [String, Fixnum] The unique id of the group.
|
40
|
-
# @return [Hash]
|
41
|
-
def delete(group_id)
|
42
|
-
response = @client.delete("groups/#{group_id}")
|
43
|
-
verify_delete response
|
44
|
-
end
|
45
|
-
|
46
|
-
# Deletes a user from the group. This request requires administrator user
|
47
|
-
# permissions.
|
48
|
-
#
|
49
|
-
# @param group_id [String, Fixnum] The unique id of the group.
|
50
|
-
# @param user_id [String, Fixnum] The unique id of the user.
|
51
|
-
# @return [Hash]
|
52
|
-
def delete_user(group_id, user_id)
|
53
|
-
response = @client.delete("groups/#{group_id}/users/#{user_id}")
|
54
|
-
verify_delete_user response
|
55
|
-
end
|
56
|
-
|
57
|
-
# Edit a group. This request requires administrator user permissions.
|
58
|
-
#
|
59
|
-
# @param group_id [String, Fixnum] The unique id of the group.
|
60
|
-
# @param name [String] The name of the group.
|
61
|
-
# @return [Hash]
|
62
|
-
def edit(group_id, name)
|
63
|
-
response = @client.put("groups/#{group_id}", name: name)
|
64
|
-
verify_edit response
|
65
|
-
end
|
66
|
-
|
67
|
-
alias_method :rename, :edit
|
68
|
-
|
69
|
-
# Returns the group list. This request requires read-only user permissions.
|
70
|
-
#
|
71
|
-
# @return [Hash]
|
72
|
-
def list
|
73
|
-
response = @client.get('groups')
|
74
|
-
verify_list response
|
75
|
-
end
|
76
|
-
|
77
|
-
# Return the group user list. This request requires administrator user
|
78
|
-
# permissions.
|
79
|
-
#
|
80
|
-
# @param group_id [String, Fixnum] The unique id of the group.
|
81
|
-
# @return [Hash]
|
82
|
-
def list_users(group_id)
|
83
|
-
response = @client.get("groups/#{group_id}/users")
|
84
|
-
verify_list_users response
|
85
|
-
end
|
86
|
-
|
87
|
-
private
|
88
|
-
|
89
|
-
def verify_add_user(response)
|
90
|
-
case response.status_code
|
91
|
-
when 200
|
92
|
-
return JSON.parse response.body
|
93
|
-
when 403
|
94
|
-
fail ForbiddenError,
|
95
|
-
'You do not have permission to add users to a group'
|
96
|
-
when 404
|
97
|
-
fail NotFoundError, 'Group or user does not exist'
|
98
|
-
when 500
|
99
|
-
fail InternalServerError, 'Server failed to add the user to the group'
|
100
|
-
else
|
101
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
102
|
-
'for further details.'
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def verify_create(response)
|
107
|
-
case response.status_code
|
108
|
-
when 200
|
109
|
-
return JSON.parse response.body
|
110
|
-
when 400
|
111
|
-
fail BadRequestError, 'Field is invalid'
|
112
|
-
when 403
|
113
|
-
fail ForbiddenError, 'You do not have permission to create a group'
|
114
|
-
when 500
|
115
|
-
fail InternalServerError, 'Server failed to create the group'
|
116
|
-
else
|
117
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
118
|
-
'for further details.'
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def verify_delete(response)
|
123
|
-
case response.status_code
|
124
|
-
when 200
|
125
|
-
return JSON.parse response.body
|
126
|
-
when 400
|
127
|
-
fail BadRequestError, 'Group does not exist'
|
128
|
-
when 403
|
129
|
-
fail ForbiddenError, 'You do not have permission to delete the group'
|
130
|
-
when 500
|
131
|
-
fail InternalServerError, 'Server failed to delete the group'
|
132
|
-
else
|
133
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
134
|
-
'for further details.'
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
def verify_delete_user(response)
|
139
|
-
case response.status_code
|
140
|
-
when 200
|
141
|
-
return JSON.parse response.body
|
142
|
-
when 403
|
143
|
-
fail ForbiddenError,
|
144
|
-
'You do not have permission to delete users from a group'
|
145
|
-
when 404
|
146
|
-
fail NotFoundError, 'Group or user does not exist'
|
147
|
-
when 500
|
148
|
-
fail InternalServerError,
|
149
|
-
'Server failed to remove the user from the group'
|
150
|
-
else
|
151
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
152
|
-
'for further details.'
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
def verify_edit(response)
|
157
|
-
case response.status_code
|
158
|
-
when 200
|
159
|
-
return JSON.parse response.body
|
160
|
-
when 400
|
161
|
-
fail BadRequestError, 'Field is invalid'
|
162
|
-
when 403
|
163
|
-
fail ForbiddenError, 'You do not have permission to edit a group'
|
164
|
-
when 404
|
165
|
-
fail NotFoundError, 'Group does not exist'
|
166
|
-
when 500
|
167
|
-
fail InternalServerError, 'Server failed to edit / rename the group'
|
168
|
-
else
|
169
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
170
|
-
'for further details.'
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
def verify_list(response)
|
175
|
-
case response.status_code
|
176
|
-
when 200
|
177
|
-
return JSON.parse response.body
|
178
|
-
when 403
|
179
|
-
fail ForbiddenError,
|
180
|
-
'You do not have permission to view the groups list'
|
181
|
-
else
|
182
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
183
|
-
'for further details.'
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
def verify_list_users(response)
|
188
|
-
case response.status_code
|
189
|
-
when 200
|
190
|
-
return JSON.parse response.body
|
191
|
-
when 403
|
192
|
-
fail ForbiddenError,
|
193
|
-
'You do not have permission to view the groups users list'
|
194
|
-
when 404
|
195
|
-
fail NotFoundError, 'Group does not exist'
|
196
|
-
else
|
197
|
-
fail UnknownError, 'An unknown error occurred. Please consult Nessus' \
|
198
|
-
'for further details.'
|
199
|
-
end
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|