nexpose 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53818a10219a24c3d90a3fb09b2f658936aedd0b
4
- data.tar.gz: 1b9a61cfb7ee75f878f9969d1472bba737e8499c
3
+ metadata.gz: 50b3a4ea395acfdb69e8cc0293d403b9cd53eccc
4
+ data.tar.gz: b9e88228bbb4ff2b6a77718654f73582284328c7
5
5
  SHA512:
6
- metadata.gz: f6fd0316810c84f88463f7db042ef87934cfefa0547fe9df7d8530d9b2d45d579452b22305b16850ae0ea1fcf13d5a5ea6dd45422a1c78a351955fa4c769b880
7
- data.tar.gz: 5e7422dfe20cdc0066e47e9b0ba1638fa8d6c0269a85df03d50b38fe1f6b5aef1c45ac50f8d932aeeb95b3a0d5219646edd1de01332210f31d793abc6448f76f
6
+ metadata.gz: cc964a92ba088913a9e17b9c037282faaa545bd2cce65ef42f6bda1191b5fd4bc72872bccd1f225d6a2cef6fb3835fbe44c00a4bf6fe1d10b373bd7c26c8e03b
7
+ data.tar.gz: 3eca493933ccd66545cc95684d48d57fe9cd7251eaa1794cdec5a642d13ebccd2e40a9af678929656c39adda898b579672de00ad28077166c681101684187b3b
data/lib/nexpose/error.rb CHANGED
@@ -18,4 +18,11 @@ module Nexpose
18
18
  @reason = "Login Failed"
19
19
  end
20
20
  end
21
+
22
+ class PermissionError < APIError
23
+ def initialize(req)
24
+ @req = req
25
+ @reason = 'User does not have permission to perform this action.'
26
+ end
27
+ end
21
28
  end
data/lib/nexpose/group.rb CHANGED
@@ -129,7 +129,6 @@ module Nexpose
129
129
  alias_method :get, :load
130
130
 
131
131
  def self.parse(xml)
132
- puts xml
133
132
  return nil unless xml
134
133
 
135
134
  group = REXML::XPath.first(xml, 'AssetGroupConfigResponse/AssetGroup')
@@ -56,27 +56,23 @@ module Nexpose
56
56
  execute(make_xml('RestartRequest', {})).success
57
57
  end
58
58
 
59
- # --
60
- # TODO This is not yet implemented correctly.
61
- #
62
59
  # Output diagnostic information into log files, zip the files, and encrypt
63
60
  # the archive with a PGP public key that is provided as a parameter for the
64
- # API call. Then, either e-mail this archive to an address that is
65
- # specified as an API parameter, or upload the archive using HTTP or HTTPS
66
- # to a URL that is specified as an API parameter.
61
+ # API call. Then upload the archive using HTTPS to a URL that is specified
62
+ # as an API parameter.
67
63
  #
68
- # If you do not specify a key, the SendLogRequest uses a default key.
64
+ # @param url Upload server to send the support log package to.
69
65
  #
70
- # @param protocol should be one of: smtp, http, https.
71
- # ++
72
- def send_log(key_id, protocol, transport)
73
- xml = make_xml('ConsoleCommandRequest', {'keyid' => key_id})
66
+ def send_log(uri = 'https://support.rapid7.com')
67
+ url = REXML::Element.new('URL')
68
+ url.text = uri
74
69
  tpt = REXML::Element.new('Transport')
75
- tpt.add_attribute('protocol', protocol)
76
- tpt.text = transport
70
+ tpt.add_attribute('protocol', 'https')
71
+ tpt << url
72
+ xml = make_xml('SendLogRequest')
77
73
  xml << tpt
78
74
 
79
- # execute(xml)
75
+ execute(xml).success
80
76
  end
81
77
  end
82
78
  end
data/lib/nexpose/site.rb CHANGED
@@ -523,11 +523,11 @@ module Nexpose
523
523
  attr_reader :site_id
524
524
 
525
525
  def initialize(id, address, site_id, risk_factor = 1.0, risk_score = 0.0)
526
- @id = id
526
+ @id = id.to_i
527
527
  @address = address
528
- @site_id = site_id
529
- @risk_factor = risk_factor
530
- @risk_score = risk_score
528
+ @site_id = site_id.to_i
529
+ @risk_factor = risk_factor.to_f
530
+ @risk_score = risk_score.to_f
531
531
  end
532
532
  end
533
533
 
@@ -123,7 +123,7 @@ module Nexpose
123
123
  # Add vulnerabilities
124
124
  vulnerabilities_xml = REXML::Element.new 'Vulnerabilities'
125
125
  vulnerabilities.each do |vuln_id|
126
- vulnerabilities_xml.add_element 'Vulnerability', {'id' => vuln_id}
126
+ vulnerabilities_xml.add_element 'Vulnerability', {'id' => vuln_id.downcase}
127
127
  end
128
128
  create_request_xml.add_element vulnerabilities_xml
129
129
 
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.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - HD Moore
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-23 00:00:00.000000000 Z
13
+ date: 2013-06-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: librex
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.0.3
98
+ rubygems_version: 2.0.0.rc.2
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Ruby API for Rapid7 Nexpose