nexpose 3.0.1 → 3.1.0

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: 70c4f4ef8d091956dabc195132a8e03576941c1f
4
- data.tar.gz: 1026e14754b114bec2c0195d4aa0d0e8d1be1e80
3
+ metadata.gz: 5a180ab3eff433d31088604fa0cbebe07a7be22c
4
+ data.tar.gz: b50d30db2b8eb0d351dae295214cdd0f8e63c803
5
5
  SHA512:
6
- metadata.gz: cd109c671af57fca71f584e99604f4c81bbfbe5bac8f15981542e7a0398e28c53438d057380f80eef2bb4cb91158033a45b5a763f7e3588a3867415657aad367
7
- data.tar.gz: 0ce383fa6a43b85dcc0550751b442462ee5ef415abe01ed48d96f64cccf2c45778c85bef5b895995d6cb0afecf2a89bbfb7e6a9bffcabdc9a6857bce8eefe422
6
+ metadata.gz: 63bc634571fb06d9b4a40870b9e102cc8d53d67375052e34295a4e0f1c37167f24912a30b2c1b2d3dd205f8d60af091905fa8027b0b54bfd8a3cd0923f9e8488
7
+ data.tar.gz: 3fecd48a480fd0cb88a855e08dea01ef80beeb25cbbfd189a77fda8bc2fff716d8b4fe564265df41d55c2e81caf330784a39f3bc465bfcec3582fa303abbd4bd
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nexpose (2.1.3)
5
- multipart-post (~> 2.0.0)
4
+ nexpose (3.1.0)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
@@ -17,8 +16,7 @@ GEM
17
16
  safe_yaml (~> 1.0.0)
18
17
  diff-lcs (1.2.5)
19
18
  docile (1.1.5)
20
- multi_json (1.11.0)
21
- multipart-post (2.0.0)
19
+ multi_json (1.10.1)
22
20
  parser (2.2.0.3)
23
21
  ast (>= 1.1, < 3.0)
24
22
  powerpack (0.1.0)
@@ -27,7 +25,7 @@ GEM
27
25
  rspec-core (~> 3.2.0)
28
26
  rspec-expectations (~> 3.2.0)
29
27
  rspec-mocks (~> 3.2.0)
30
- rspec-core (3.2.2)
28
+ rspec-core (3.2.1)
31
29
  rspec-support (~> 3.2.0)
32
30
  rspec-expectations (3.2.0)
33
31
  diff-lcs (>= 1.2.0, < 2.0)
@@ -36,6 +36,8 @@ module Nexpose
36
36
  attr_reader :password
37
37
  # The URL for communication
38
38
  attr_reader :url
39
+ # The token used to login to the NSC
40
+ attr_reader :token
39
41
 
40
42
  # The last XML request sent by this object, useful for debugging.
41
43
  attr_reader :request_xml
@@ -43,17 +45,18 @@ module Nexpose
43
45
  attr_reader :response_xml
44
46
 
45
47
  # A constructor to load a Connection object from a URI
46
- def self.from_uri(uri, user, pass, silo_id = nil)
48
+ def self.from_uri(uri, user, pass, silo_id = nil, token = nil)
47
49
  uri = URI.parse(uri)
48
- new(uri.host, user, pass, uri.port, silo_id)
50
+ new(uri.host, user, pass, uri.port, silo_id, token)
49
51
  end
50
52
 
51
53
  # A constructor for Connection
52
- def initialize(ip, user, pass, port = 3780, silo_id = nil)
54
+ def initialize(ip, user, pass, port = 3780, silo_id = nil, token = nil)
53
55
  @host = ip
54
56
  @port = port
55
57
  @username = user
56
58
  @password = pass
59
+ @token = token
57
60
  @silo_id = silo_id
58
61
  @session_id = nil
59
62
  @url = "https://#{@host}:#{@port}/api/API_VERSION/xml"
@@ -62,7 +65,7 @@ module Nexpose
62
65
  # Establish a new connection and Session ID
63
66
  def login
64
67
  begin
65
- login_hash = {'sync-id' => 0, 'password' => @password, 'user-id' => @username}
68
+ login_hash = {'sync-id' => 0, 'password' => @password, 'user-id' => @username, 'token' => @token}
66
69
  login_hash['silo-id'] = @silo_id if @silo_id
67
70
  r = execute(make_xml('LoginRequest', login_hash))
68
71
  if r.success
data/lib/nexpose/user.rb CHANGED
@@ -90,15 +90,16 @@ module Nexpose
90
90
  # but caller can override (e.g., using LDAP authenticator).
91
91
  attr_accessor :authsrcid
92
92
  # Optional fields
93
- attr_accessor :email, :password, :sites, :groups
93
+ attr_accessor :email, :password, :sites, :groups, :token
94
94
  # 1 to enable this user, 0 to disable
95
95
  attr_accessor :enabled
96
96
  # Boolean values
97
97
  attr_accessor :all_sites, :all_groups
98
98
 
99
- def initialize(name, full_name, password, role_name = 'user', id = -1, enabled = 1, email = nil, all_sites = false, all_groups = false)
99
+ def initialize(name, full_name, password, role_name = 'user', id = -1, enabled = 1, email = nil, all_sites = false, all_groups = false, token = nil)
100
100
  @name = name
101
101
  @password = password
102
+ @token = token
102
103
  @role_name = role_name
103
104
  @authsrcid = ('global-admin'.eql? @role_name) ? '1' : '2'
104
105
  @id = id
@@ -119,6 +120,7 @@ module Nexpose
119
120
  xml << %Q{ fullname="#{replace_entities(@full_name)}"}
120
121
  xml << %Q{ role-name="#{replace_entities(@role_name)}"}
121
122
  xml << %Q{ password="#{replace_entities(@password)}"} if @password
123
+ xml << %Q{ token="#{replace_entities(@token)}"} if @token
122
124
  xml << %Q{ email="#{replace_entities(@email)}"} if @email
123
125
  xml << %Q{ enabled="#{@enabled}"}
124
126
  # These two fields are keying off role_name to work around a defect.
@@ -166,12 +168,13 @@ module Nexpose
166
168
 
167
169
  email = config.attributes['email']
168
170
  password = config.attributes['password']
171
+ token = config.attributes['token']
169
172
  enabled = config.attributes['enabled'].to_i
170
173
  all_sites = config.attributes['allSites'] == 'true' ? true : false
171
174
  all_groups = config.attributes['allGroups'] == 'true' ? true : false
172
175
  # Not trying to load sites and groups.
173
176
  # Looks like API currently doesn't return that info to load.
174
- return User.new(name, fullname, password, role_name, id, enabled, email, all_sites, all_groups)
177
+ return User.new(name, fullname, password, role_name, id, enabled, email, all_sites, all_groups, token)
175
178
  end
176
179
  end
177
180
  end
@@ -1,4 +1,4 @@
1
1
  module Nexpose
2
2
  # The latest version of the Nexpose gem
3
- VERSION = '3.0.1'
3
+ VERSION = '3.1.0'
4
4
  end
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: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HD Moore
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-12-11 00:00:00.000000000 Z
16
+ date: 2016-01-06 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: bundler
@@ -212,9 +212,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  version: '0'
213
213
  requirements: []
214
214
  rubyforge_project:
215
- rubygems_version: 2.4.6
215
+ rubygems_version: 2.4.8
216
216
  signing_key:
217
217
  specification_version: 4
218
218
  summary: Ruby API for Rapid7 Nexpose
219
219
  test_files: []
220
- has_rdoc: