nexpose 0.2.0 → 0.2.1
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.
- data/lib/nexpose/creds.rb +32 -21
- data/lib/nexpose/report.rb +2 -2
- data/lib/nexpose/site.rb +2 -2
- metadata +2 -2
data/lib/nexpose/creds.rb
CHANGED
@@ -9,33 +9,33 @@ module Nexpose
|
|
9
9
|
include XMLUtils
|
10
10
|
|
11
11
|
# Security blob for an existing set of credentials
|
12
|
-
|
12
|
+
attr_accessor :securityblob
|
13
13
|
# Designates if this object contains user defined credentials or a security blob
|
14
|
-
|
14
|
+
attr_accessor :isblob
|
15
15
|
# The service for these credentials. Can be All.
|
16
|
-
|
16
|
+
attr_accessor :service
|
17
17
|
# The host for these credentials. Can be Any.
|
18
|
-
|
18
|
+
attr_accessor :host
|
19
19
|
# The port on which to use these credentials.
|
20
|
-
|
20
|
+
attr_accessor :port
|
21
21
|
# The user id or username
|
22
|
-
|
22
|
+
attr_accessor :userid
|
23
23
|
# The password
|
24
|
-
|
24
|
+
attr_accessor :password
|
25
25
|
# The realm for these credentials
|
26
|
-
|
26
|
+
attr_accessor :realm
|
27
27
|
# When using httpheaders, this represents the set of headers to pass
|
28
28
|
# with the authentication request.
|
29
|
-
|
29
|
+
attr_accessor :headers
|
30
30
|
# When using htmlforms, this represents the tho form to pass the
|
31
31
|
# authentication request to.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
attr_accessor :html_forms
|
33
|
+
# The type of privilege escalation to use (sudo/su)
|
34
|
+
attr_accessor :priv_type
|
35
|
+
# The userid to use when escalating privileges (optional)
|
36
|
+
attr_accessor :priv_username
|
37
|
+
# The password to use when escalating privileges (optional)
|
38
|
+
attr_accessor :priv_password
|
39
39
|
|
40
40
|
def initialize(isblob = false)
|
41
41
|
@isblob = isblob
|
@@ -53,12 +53,23 @@ module Nexpose
|
|
53
53
|
@realm = realm
|
54
54
|
end
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
def self.for_service(service, user, password, realm = nil, host = nil, port = nil)
|
57
|
+
cred = new
|
58
|
+
cred.service = service
|
59
|
+
cred.userid = user
|
60
|
+
cred.password = password
|
61
|
+
cred.realm = realm
|
62
|
+
cred.host = host
|
63
|
+
cred.port = port
|
64
|
+
cred
|
65
|
+
end
|
66
|
+
|
67
|
+
# Sets privilege escalation credentials. Type should be either
|
68
|
+
# sudo/su.
|
58
69
|
def set_privilege_credentials(type, username, password)
|
59
|
-
|
60
|
-
|
61
|
-
|
70
|
+
@priv_type = type
|
71
|
+
@priv_username = username
|
72
|
+
@priv_password = password
|
62
73
|
end
|
63
74
|
|
64
75
|
# The name of the service. Possible values are outlined in the
|
data/lib/nexpose/report.rb
CHANGED
@@ -320,7 +320,7 @@ module Nexpose
|
|
320
320
|
xml << '</ReportSaveRequest>'
|
321
321
|
response = connection.execute(xml)
|
322
322
|
if response.success
|
323
|
-
@id = response.attributes['reportcfg-id']
|
323
|
+
@id = response.attributes['reportcfg-id'].to_i
|
324
324
|
end
|
325
325
|
end
|
326
326
|
|
@@ -676,7 +676,7 @@ module Nexpose
|
|
676
676
|
xml << '</ReportTemplateSaveRequest>'
|
677
677
|
response = connection.execute(xml)
|
678
678
|
if response.success
|
679
|
-
@id = response.attributes['template-id']
|
679
|
+
@id = response.attributes['template-id'].to_i
|
680
680
|
end
|
681
681
|
end
|
682
682
|
|
data/lib/nexpose/site.rb
CHANGED
@@ -293,7 +293,7 @@ module Nexpose
|
|
293
293
|
def save(connection)
|
294
294
|
r = connection.execute('<SiteSaveRequest session-id="' + connection.session_id + '">' + to_xml + ' </SiteSaveRequest>')
|
295
295
|
if r.success
|
296
|
-
@id = r.attributes['site-id']
|
296
|
+
@id = r.attributes['site-id'].to_i
|
297
297
|
end
|
298
298
|
end
|
299
299
|
|
@@ -314,7 +314,7 @@ module Nexpose
|
|
314
314
|
def scan(connection, sync_id = nil)
|
315
315
|
xml = REXML::Element.new('SiteScanRequest')
|
316
316
|
xml.add_attributes({'session-id' => connection.session_id,
|
317
|
-
'site-id' => id,
|
317
|
+
'site-id' => @id,
|
318
318
|
'sync-id' => sync_id})
|
319
319
|
|
320
320
|
response = connection.execute(xml)
|
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-05-
|
14
|
+
date: 2013-05-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: librex
|