nexpose 0.0.94 → 0.0.95
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nexpose.rb +2 -2
- data/lib/nexpose/creds.rb +264 -174
- data/lib/nexpose/report.rb +9 -8
- data/lib/nexpose/scan.rb +3 -3
- data/lib/nexpose/scan_engine.rb +3 -3
- data/lib/nexpose/site.rb +37 -19
- data/lib/nexpose/util.rb +4 -3
- data/nexpose.gemspec +1 -1
- metadata +6 -6
data/lib/nexpose.rb
CHANGED
@@ -95,7 +95,7 @@ module Nexpose
|
|
95
95
|
def self.getAttribute(attribute, xml)
|
96
96
|
value = ''
|
97
97
|
#@value = substr(substr(strstr(strstr(@xml,@attribute),'"'),1),0,strpos(substr(strstr(strstr(@xml,@attribute),'"'),1),'"'))
|
98
|
-
|
98
|
+
value
|
99
99
|
end
|
100
100
|
|
101
101
|
# === Description
|
@@ -126,4 +126,4 @@ module Nexpose
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
end
|
129
|
+
end
|
data/lib/nexpose/creds.rb
CHANGED
@@ -1,189 +1,279 @@
|
|
1
1
|
module Nexpose
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
attr_reader :isblob
|
12
|
-
# The service for these credentials. Can be All.
|
13
|
-
attr_reader :service
|
14
|
-
# The host for these credentials. Can be Any.
|
15
|
-
attr_reader :host
|
16
|
-
# The port on which to use these credentials.
|
17
|
-
attr_reader :port
|
18
|
-
# The user id or username
|
19
|
-
attr_reader :userid
|
20
|
-
# The password
|
21
|
-
attr_reader :password
|
22
|
-
# The realm for these credentials
|
23
|
-
attr_reader :realm
|
24
|
-
# When using httpheaders, this represents the set of headers to pass
|
25
|
-
# with the authentication request.
|
26
|
-
attr_reader :headers
|
27
|
-
|
28
|
-
def initialize(isblob = false)
|
29
|
-
@isblob = isblob
|
30
|
-
end
|
2
|
+
# === Description
|
3
|
+
# Object that represents administrative credentials to be used
|
4
|
+
# during a scan. When retrived from an existing site configuration
|
5
|
+
# the credentials will be returned as a security blob and can only
|
6
|
+
# be passed back as is during a Site Save operation. This object
|
7
|
+
# can only be used to create a new set of credentials.
|
8
|
+
#
|
9
|
+
class AdminCredentials
|
10
|
+
include XMLUtils
|
31
11
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
12
|
+
# Security blob for an existing set of credentials
|
13
|
+
attr_reader :securityblob
|
14
|
+
# Designates if this object contains user defined credentials or a security blob
|
15
|
+
attr_reader :isblob
|
16
|
+
# The service for these credentials. Can be All.
|
17
|
+
attr_reader :service
|
18
|
+
# The host for these credentials. Can be Any.
|
19
|
+
attr_reader :host
|
20
|
+
# The port on which to use these credentials.
|
21
|
+
attr_reader :port
|
22
|
+
# The user id or username
|
23
|
+
attr_reader :userid
|
24
|
+
# The password
|
25
|
+
attr_reader :password
|
26
|
+
# The realm for these credentials
|
27
|
+
attr_reader :realm
|
28
|
+
# When using httpheaders, this represents the set of headers to pass
|
29
|
+
# with the authentication request.
|
30
|
+
attr_reader :headers
|
31
|
+
# When using htmlforms, this represents the tho form to pass the
|
32
|
+
# authentication request to.
|
33
|
+
attr_reader :html_forms
|
43
34
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
35
|
+
def initialize(isblob = false)
|
36
|
+
@isblob = isblob
|
37
|
+
end
|
48
38
|
|
49
|
-
|
50
|
-
|
51
|
-
|
39
|
+
# Sets the credentials information for this object.
|
40
|
+
def set_credentials(service, host, port, userid, password, realm)
|
41
|
+
@isblob = false
|
42
|
+
@securityblob = nil
|
43
|
+
@service = service
|
44
|
+
@host = host
|
45
|
+
@port = port
|
46
|
+
@userid = userid
|
47
|
+
@password = password
|
48
|
+
@realm = realm
|
49
|
+
end
|
52
50
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
51
|
+
# TODO: add description
|
52
|
+
def set_service(service)
|
53
|
+
@service = service
|
54
|
+
end
|
58
55
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
56
|
+
def set_host(host)
|
57
|
+
@host = host
|
58
|
+
end
|
63
59
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
xml << %Q{ password="#{replace_entities(password)}"} if (password)
|
70
|
-
xml << %Q{ realm="#{replace_entities(realm)}"} if (realm)
|
71
|
-
xml << %Q{ host="#{replace_entities(host)}"} if (host)
|
72
|
-
xml << %Q{ port="#{replace_entities(port)}"} if (port)
|
73
|
-
xml << '>'
|
74
|
-
xml << replace_entities(securityblob) if (isblob)
|
75
|
-
xml << @headers.to_xml() if @headers
|
76
|
-
xml << '</adminCredentials>'
|
77
|
-
|
78
|
-
xml
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# Object that represents Header name-value pairs, associated with Web Session Authentication.
|
83
|
-
class Header
|
84
|
-
# Name, one per Header
|
85
|
-
attr_reader :name
|
86
|
-
# Value, one per Header
|
87
|
-
attr_reader :value
|
88
|
-
|
89
|
-
# Construct with name value pair
|
90
|
-
def initialize(name, value)
|
91
|
-
@name = name
|
92
|
-
@value = value
|
93
|
-
end
|
60
|
+
# TODO: add description
|
61
|
+
def set_blob(securityblob)
|
62
|
+
@isblob = true
|
63
|
+
@securityblob = securityblob
|
64
|
+
end
|
94
65
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
66
|
+
# Add Headers to credentials for httpheaders.
|
67
|
+
def set_headers(headers)
|
68
|
+
@headers = headers
|
69
|
+
end
|
70
|
+
|
71
|
+
def set_html_forms(html_forms)
|
72
|
+
@html_forms = html_forms
|
73
|
+
end
|
74
|
+
|
75
|
+
def to_xml
|
76
|
+
to_xml_elem.to_s
|
77
|
+
end
|
78
|
+
|
79
|
+
def to_xml_elem
|
80
|
+
attributes = {}
|
81
|
+
|
82
|
+
attributes['service'] = @service
|
83
|
+
attributes['userid'] = @userid
|
84
|
+
attributes['password'] = @password
|
85
|
+
attributes['realm'] = @realm
|
86
|
+
attributes['host'] = @host
|
87
|
+
attributes['port'] = @port
|
88
|
+
|
89
|
+
data = isblob ? securityblob : ''
|
90
|
+
xml = make_xml('adminCredentials', attributes, data)
|
91
|
+
xml.add_element(@headers.to_xml_elem) if @headers
|
92
|
+
xml.add_element(@html_forms.to_xml_elem) if @html_forms
|
93
|
+
xml
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Object that represents Header name-value pairs, associated with Web Session Authentication.
|
98
|
+
class Header
|
99
|
+
include XMLUtils
|
100
|
+
# Name, one per Header
|
101
|
+
attr_reader :name
|
102
|
+
# Value, one per Header
|
103
|
+
attr_reader :value
|
104
|
+
|
105
|
+
# Construct with name value pair
|
106
|
+
def initialize(name, value)
|
107
|
+
@name = name
|
108
|
+
@value = value
|
109
|
+
end
|
110
|
+
|
111
|
+
def to_xml_elem
|
112
|
+
attributes = {}
|
113
|
+
attributes['name'] = @name
|
114
|
+
attributes['value'] = @value
|
115
|
+
|
116
|
+
make_xml('Header', attributes)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
# Object that represents Headers, associated with Web Session Authentication.
|
121
|
+
class Headers
|
122
|
+
include XMLUtils
|
123
|
+
# A regular expression used to match against the response to identify authentication failures.
|
124
|
+
attr_reader :soft403
|
125
|
+
# Base URL of the application for which the form authentication applies.
|
126
|
+
attr_reader :webapproot
|
127
|
+
# When using httpheaders, this represents the set of headers to pass with the authentication request.
|
128
|
+
attr_reader :headers
|
129
|
+
|
130
|
+
def initialize(webapproot, soft403)
|
131
|
+
@headers = []
|
132
|
+
@webapproot = webapproot
|
133
|
+
@soft403 = soft403
|
134
|
+
end
|
135
|
+
|
136
|
+
def add_header(header)
|
137
|
+
@headers.push(header)
|
138
|
+
end
|
139
|
+
|
140
|
+
def to_xml_elem
|
141
|
+
attributes = {}
|
142
|
+
attributes['webapproot'] = @webapproot
|
143
|
+
attributes['soft403'] = @soft403
|
144
|
+
|
145
|
+
xml = make_xml('Headers', attributes)
|
146
|
+
@headers.each do |header|
|
147
|
+
xml.add_element(header.to_xml_elem)
|
118
148
|
end
|
149
|
+
xml
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
# When using htmlform, this represents the login form information.
|
155
|
+
class Field
|
156
|
+
include XMLUtils
|
157
|
+
# The name of the HTML field (form parameter).
|
158
|
+
attr_reader :name
|
159
|
+
# The value of the HTML field (form parameter).
|
160
|
+
attr_reader :value
|
161
|
+
# The type of the HTML field (form parameter).
|
162
|
+
attr_reader :type
|
163
|
+
# Is the HTML field (form parameter) dynamically generated? If so,
|
164
|
+
# the login page is requested and the value of the field is extracted
|
165
|
+
# from the response.
|
166
|
+
attr_reader :dynamic
|
167
|
+
# If the HTML field (form parameter) is a radio button, checkbox or select
|
168
|
+
# field, this flag determines if the field should be checked (selected).
|
169
|
+
attr_reader :checked
|
170
|
+
|
171
|
+
def initialize(name, value, type, dynamic, checked)
|
172
|
+
@name = name
|
173
|
+
@value = value
|
174
|
+
@type = type
|
175
|
+
@dynamic = dynamic
|
176
|
+
@checked = checked
|
177
|
+
end
|
178
|
+
|
179
|
+
def to_xml_elem
|
180
|
+
attributes = {}
|
181
|
+
attributes['name'] = @name
|
182
|
+
attributes['value'] = @value
|
183
|
+
attributes['type'] = @type
|
184
|
+
attributes['dynamic'] = @dynamic
|
185
|
+
attributes['checked'] = @checked
|
186
|
+
|
187
|
+
make_xml('Field', attributes)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# When using htmlform, this represents the login form information.
|
192
|
+
class HTMLForm
|
193
|
+
include XMLUtils
|
194
|
+
# The name of the form being submitted.
|
195
|
+
attr_reader :name
|
196
|
+
# The HTTP action (URL) through which to submit the login form.
|
197
|
+
attr_reader :action
|
198
|
+
# The HTTP request method with which to submit the form.
|
199
|
+
attr_reader :method
|
200
|
+
# The HTTP encoding type with which to submit the form.
|
201
|
+
attr_reader :enctype
|
202
|
+
# The fields in the HTML Form
|
203
|
+
attr_reader :fields
|
204
|
+
|
205
|
+
def initialize(name, action, method, enctype)
|
206
|
+
@name = name
|
207
|
+
@action = action
|
208
|
+
@method = method
|
209
|
+
@enctype = enctype
|
210
|
+
@fields = []
|
211
|
+
end
|
212
|
+
|
213
|
+
def add_field(field)
|
214
|
+
@fields << field
|
215
|
+
end
|
119
216
|
|
120
|
-
|
121
|
-
|
217
|
+
def to_xml_elem
|
218
|
+
attributes = {}
|
219
|
+
attributes['name'] = @name
|
220
|
+
attributes['action'] = @action
|
221
|
+
attributes['method'] = @method
|
222
|
+
attributes['enctype'] = @enctype
|
223
|
+
|
224
|
+
xml = make_xml('HTMLForm', attributes)
|
225
|
+
|
226
|
+
fields.each() do |field|
|
227
|
+
xml.add_element(field.to_xml_elem)
|
122
228
|
end
|
123
229
|
|
230
|
+
xml
|
231
|
+
end
|
232
|
+
|
233
|
+
end
|
234
|
+
|
235
|
+
# When using htmlform, this represents the login form information.
|
236
|
+
class HTMLForms
|
237
|
+
include XMLUtils
|
238
|
+
# The URL of the login page containing the login form.
|
239
|
+
attr_reader :parentpage
|
240
|
+
# A regular expression used to match against the response to identify
|
241
|
+
# authentication failures.
|
242
|
+
attr_reader :soft403
|
243
|
+
# Base URL of the application for which the form authentication applies.
|
244
|
+
attr_reader :webapproot
|
245
|
+
# The forms to authenticate with
|
246
|
+
attr_reader :html_forms
|
247
|
+
|
248
|
+
def initialize(parentpage, soft403, webapproot)
|
249
|
+
@parentpage = parentpage
|
250
|
+
@soft403 = soft403
|
251
|
+
@webapproot = webapproot
|
252
|
+
@html_forms = []
|
253
|
+
end
|
124
254
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
255
|
+
def add_html_form(html_form)
|
256
|
+
@html_forms << html_form
|
257
|
+
end
|
258
|
+
|
259
|
+
def to_xml_elem
|
260
|
+
attributes = {}
|
261
|
+
attributes['parentpage'] = @parentpage
|
262
|
+
attributes['soft403'] = @soft403
|
263
|
+
attributes['webapproot'] = @webapproot
|
264
|
+
|
265
|
+
xml = make_xml('HTMLForms', attributes)
|
266
|
+
|
267
|
+
html_forms.each() do |html_form|
|
268
|
+
xml.add_element(html_form.to_xml_elem)
|
136
269
|
end
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
attr_reader :type
|
147
|
-
# Is the HTML field (form parameter) dynamically generated? If so,
|
148
|
-
# the login page is requested and the value of the field is extracted
|
149
|
-
# from the response.
|
150
|
-
attr_reader :dynamic
|
151
|
-
# If the HTML field (form parameter) is a radio button, checkbox or select
|
152
|
-
# field, this flag determines if the field should be checked (selected).
|
153
|
-
attr_reader :checked
|
154
|
-
|
155
|
-
# TODO
|
156
|
-
end
|
157
|
-
|
158
|
-
# When using htmlform, this represents the login form information.
|
159
|
-
class HTMLForm
|
160
|
-
# The name of the form being submitted.
|
161
|
-
attr_reader :name
|
162
|
-
# The HTTP action (URL) through which to submit the login form.
|
163
|
-
attr_reader :action
|
164
|
-
# The HTTP request method with which to submit the form.
|
165
|
-
attr_reader :method
|
166
|
-
# The HTTP encoding type with which to submit the form.
|
167
|
-
attr_reader :enctype
|
168
|
-
|
169
|
-
# TODO
|
170
|
-
end
|
171
|
-
|
172
|
-
# When using htmlform, this represents the login form information.
|
173
|
-
class HTMLForms
|
174
|
-
# The URL of the login page containing the login form.
|
175
|
-
attr_reader :parentpage
|
176
|
-
# A regular expression used to match against the response to identify
|
177
|
-
# authentication failures.
|
178
|
-
attr_reader :soft403
|
179
|
-
# Base URL of the application for which the form authentication applies.
|
180
|
-
attr_reader :webapproot
|
181
|
-
|
182
|
-
# TODO
|
183
|
-
end
|
184
|
-
|
185
|
-
# When using ssh-key, this represents the PEM-format keypair information.
|
186
|
-
class PEMKey
|
187
|
-
# TODO
|
188
|
-
end
|
270
|
+
xml
|
271
|
+
end
|
272
|
+
|
273
|
+
end
|
274
|
+
|
275
|
+
# When using ssh-key, this represents the PEM-format keypair information.
|
276
|
+
class PEMKey
|
277
|
+
# TODO
|
278
|
+
end
|
189
279
|
end
|
data/lib/nexpose/report.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
module Nexpose
|
2
3
|
module NexposeAPI
|
3
4
|
include XMLUtils
|
@@ -208,7 +209,7 @@ module Nexpose
|
|
208
209
|
|
209
210
|
@error = false
|
210
211
|
@connection = connection
|
211
|
-
@filters =
|
212
|
+
@filters = []
|
212
213
|
@template_id = template_id
|
213
214
|
@format = format
|
214
215
|
|
@@ -326,9 +327,9 @@ module Nexpose
|
|
326
327
|
@error = false
|
327
328
|
@connection = connection
|
328
329
|
@config_id = config_id
|
329
|
-
@xml_tag_stack =
|
330
|
-
@filters =
|
331
|
-
@email_recipients =
|
330
|
+
@xml_tag_stack = []
|
331
|
+
@filters = []
|
332
|
+
@email_recipients = []
|
332
333
|
@name = "New Report " + rand(999999999).to_s
|
333
334
|
|
334
335
|
r = @connection.execute('<ReportConfigRequest session-id="' + @connection.session_id.to_s + '" reportcfg-id="' + @config_id.to_s + '"/>')
|
@@ -391,7 +392,7 @@ module Nexpose
|
|
391
392
|
xml += ' <Filters>'
|
392
393
|
|
393
394
|
@filters.each do |f|
|
394
|
-
xml += ' <' + f.type.to_s + ' id="' + f.id.to_s + '"/>'
|
395
|
+
xml += ' <filter type="' + f.type.to_s + '" id="' + f.id.to_s + '"/>'
|
395
396
|
end
|
396
397
|
|
397
398
|
xml += ' </Filters>'
|
@@ -518,7 +519,7 @@ module Nexpose
|
|
518
519
|
|
519
520
|
@error = nil
|
520
521
|
@connection = connection
|
521
|
-
@report_template_summaries =
|
522
|
+
@report_template_summaries = []
|
522
523
|
|
523
524
|
r = @connection.execute('<ReportTemplateListingRequest session-id="' + connection.session_id.to_s + '"/>')
|
524
525
|
if (r.success)
|
@@ -587,7 +588,7 @@ module Nexpose
|
|
587
588
|
|
588
589
|
def initialize(name)
|
589
590
|
|
590
|
-
@properties =
|
591
|
+
@properties = []
|
591
592
|
@name = name
|
592
593
|
end
|
593
594
|
|
@@ -599,4 +600,4 @@ module Nexpose
|
|
599
600
|
|
600
601
|
end
|
601
602
|
|
602
|
-
end
|
603
|
+
end
|
data/lib/nexpose/scan.rb
CHANGED
@@ -211,8 +211,8 @@ module Nexpose
|
|
211
211
|
@name = name
|
212
212
|
@templateID = templateID
|
213
213
|
@configVersion = configVersion
|
214
|
-
@schedules =
|
215
|
-
@scanTriggers =
|
214
|
+
@schedules = []
|
215
|
+
@scanTriggers = []
|
216
216
|
|
217
217
|
end
|
218
218
|
|
@@ -277,4 +277,4 @@ module Nexpose
|
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
-
end
|
280
|
+
end
|
data/lib/nexpose/scan_engine.rb
CHANGED
@@ -168,9 +168,9 @@ module Nexpose
|
|
168
168
|
xml << %Q{ scope="#{scope}"}
|
169
169
|
xml << %Q{ priority="#{priority}"} if (priority)
|
170
170
|
xml << '>'
|
171
|
-
|
172
|
-
|
173
|
-
|
171
|
+
sites.each do |site|
|
172
|
+
xml << %Q{<Site id="#{site}" />}
|
173
|
+
end
|
174
174
|
xml << '</EngineConfig>'
|
175
175
|
xml
|
176
176
|
end
|
data/lib/nexpose/site.rb
CHANGED
@@ -437,10 +437,10 @@ module Nexpose
|
|
437
437
|
attr_reader :scanConfig
|
438
438
|
|
439
439
|
def initialize()
|
440
|
-
@xml_tag_stack =
|
441
|
-
@hosts =
|
442
|
-
@credentials =
|
443
|
-
@alerts =
|
440
|
+
@xml_tag_stack = []
|
441
|
+
@hosts = []
|
442
|
+
@credentials = []
|
443
|
+
@alerts = []
|
444
444
|
@error = false
|
445
445
|
end
|
446
446
|
|
@@ -566,8 +566,8 @@ module Nexpose
|
|
566
566
|
attr_reader :error_msg
|
567
567
|
# The last XML request sent by this object
|
568
568
|
attr_reader :request_xml
|
569
|
-
# The last
|
570
|
-
attr_reader :
|
569
|
+
# The last response received by this object
|
570
|
+
attr_reader :response
|
571
571
|
# The NSC Connection associated with this object
|
572
572
|
attr_reader :connection
|
573
573
|
# The Site ID
|
@@ -579,13 +579,24 @@ module Nexpose
|
|
579
579
|
@site_id = id
|
580
580
|
@error = false
|
581
581
|
@connection = connection
|
582
|
-
@scan_summaries =
|
582
|
+
@scan_summaries = []
|
583
583
|
|
584
|
-
|
584
|
+
@request_xml = '<SiteScanHistoryRequest' + ' session-id="' + @connection.session_id + '" site-id="' + "#{@site_id}" + '"/>'
|
585
|
+
r = @connection.execute(@request_xml)
|
586
|
+
@response = r
|
585
587
|
|
586
588
|
if r and r.success
|
587
|
-
|
588
|
-
|
589
|
+
r.res.elements.each('//ScanSummary') do |summary|
|
590
|
+
scan_id=summary.attributes['scan-id'].to_i
|
591
|
+
engine_id=summary.attributes['engine-id'].to_i
|
592
|
+
name=summary.attributes['name'].to_s
|
593
|
+
start_time=summary.attributes['startTime'].to_s
|
594
|
+
end_time=summary.attributes['endTime'].to_s
|
595
|
+
status=summary.attributes['status'].to_s
|
596
|
+
scan_summary = ScanSummary.new(scan_id, engine_id, name, start_time, end_time, status)
|
597
|
+
scan_summaries << scan_summary
|
598
|
+
end
|
599
|
+
end
|
589
600
|
end
|
590
601
|
end
|
591
602
|
|
@@ -614,19 +625,26 @@ module Nexpose
|
|
614
625
|
@site_id = site_id
|
615
626
|
@error = false
|
616
627
|
@connection = connection
|
617
|
-
@devices =
|
628
|
+
@devices = []
|
618
629
|
|
619
630
|
r = nil
|
620
631
|
if (@site_id)
|
621
632
|
r = @connection.execute('<SiteDeviceListingRequest session-id="' + connection.session_id + '" site-id="' + "#{@site_id}" + '"/>')
|
633
|
+
if r.success
|
634
|
+
r.res.elements.each('SiteDeviceListingResponse/SiteDevices/device') do |d|
|
635
|
+
@devices.push(Device.new(d.attrubytes['id'], @site_id, d.attributes["address"], d.attributes["riskfactor"], d.attributes["riskscore"]))
|
636
|
+
end
|
637
|
+
end
|
622
638
|
else
|
623
639
|
r = @connection.execute('<SiteDeviceListingRequest session-id="' + connection.session_id + '"/>')
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
640
|
+
if r.success
|
641
|
+
r.res.elements.each('SiteDeviceListingResponse/SiteDevices') do |rr|
|
642
|
+
@sid = rr.attribute("site-id")
|
643
|
+
rr.elements.each('device') do |d|
|
644
|
+
@devices.push(Device.new(d.attributes['id'], @sid, d.attributes["address"], d.attributes['riskfactor'], d.attributes['riskscore']))
|
645
|
+
end
|
646
|
+
end
|
647
|
+
end
|
630
648
|
end
|
631
649
|
end
|
632
650
|
end
|
@@ -802,7 +820,7 @@ module Nexpose
|
|
802
820
|
@sender = sender
|
803
821
|
@enabled = enabled
|
804
822
|
@limitText = limitText
|
805
|
-
@recipients =
|
823
|
+
@recipients = []
|
806
824
|
# Sets default vuln filter - All Events
|
807
825
|
setVulnFilter(VulnFilter.new("50790400", 1))
|
808
826
|
end
|
@@ -877,4 +895,4 @@ module Nexpose
|
|
877
895
|
end
|
878
896
|
end
|
879
897
|
end
|
880
|
-
end
|
898
|
+
end
|
data/lib/nexpose/util.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module Nexpose
|
2
|
-
|
3
2
|
module Sanitize
|
4
3
|
def replace_entities(str)
|
5
4
|
ret = str.dup
|
@@ -24,7 +23,9 @@ module Nexpose
|
|
24
23
|
end
|
25
24
|
|
26
25
|
opts.keys.each do |k|
|
27
|
-
|
26
|
+
if opts[k] != nil
|
27
|
+
xml.attributes[k] = "#{opts[k]}"
|
28
|
+
end
|
28
29
|
end
|
29
30
|
|
30
31
|
xml.text = data
|
@@ -32,4 +33,4 @@ module Nexpose
|
|
32
33
|
xml
|
33
34
|
end
|
34
35
|
end
|
35
|
-
end
|
36
|
+
end
|
data/nexpose.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nexpose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.95
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-24 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: librex
|
17
|
-
requirement: &
|
17
|
+
requirement: &28418712 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.0.32
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *28418712
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rex
|
28
|
-
requirement: &
|
28
|
+
requirement: &28418436 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: 1.0.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *28418436
|
37
37
|
description: This gem provides a Ruby API to the NeXpose vulnerability management
|
38
38
|
product by Rapid7. This version is based on Metasploit SVN revision 12878
|
39
39
|
email:
|