nexpose 0.9.5 → 0.9.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a5335ef79b8475f47962eef38d900a725884a17
4
- data.tar.gz: 8900b1a1479b53be0f51856592f1630b6522a3b1
3
+ metadata.gz: e40ad91293e896ed8c7f1e9604857dc9d6bf6dd0
4
+ data.tar.gz: e362c3ca4411485a1230605a5a06685059911ed8
5
5
  SHA512:
6
- metadata.gz: c6e77bc50a09f1daacef6ac5709e813736dc53816f3d52fe35568e7102f2cc8a59d764e21f3a7343517d6a54a2d3b6313c83b03d0a218ba60287bbcd05388e0f
7
- data.tar.gz: 670ca7fe9660f3f98d6a7b7e562ef47a6112d53dcee5f7b0d1b8973c586ca3e2020dea25506d704f7914a9e1d7f2c6e75af85627586e0ad4236a907b523733fd
6
+ metadata.gz: f0ea6ca4789118697c035a466306dfaff611417227ba5f1c545d296c9c8916d5c97347b206eb320a59e63ce371aba1d21966020e98ec771b7df2cf7ab23d3571
7
+ data.tar.gz: 80b82688cce211cf4268aaafe085635d6f20195e9e4f9afb28a5bcfb5066059c41bf8681d525529064ff786a6e9203f44cb69d312ca8e052eddbd5b912184457
@@ -0,0 +1,68 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nexpose (0.9.6)
5
+ rex (= 2.0.7)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.3.7)
11
+ ast (2.0.0)
12
+ astrolabe (1.3.0)
13
+ parser (>= 2.2.0.pre.3, < 3.0)
14
+ codeclimate-test-reporter (0.4.7)
15
+ simplecov (>= 0.7.1, < 1.0.0)
16
+ crack (0.4.2)
17
+ safe_yaml (~> 1.0.0)
18
+ diff-lcs (1.2.5)
19
+ docile (1.1.5)
20
+ multi_json (1.10.1)
21
+ parser (2.2.0.3)
22
+ ast (>= 1.1, < 3.0)
23
+ powerpack (0.1.0)
24
+ rainbow (2.0.0)
25
+ rex (2.0.7)
26
+ rspec (3.2.0)
27
+ rspec-core (~> 3.2.0)
28
+ rspec-expectations (~> 3.2.0)
29
+ rspec-mocks (~> 3.2.0)
30
+ rspec-core (3.2.1)
31
+ rspec-support (~> 3.2.0)
32
+ rspec-expectations (3.2.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.2.0)
35
+ rspec-mocks (3.2.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.2.0)
38
+ rspec-support (3.2.2)
39
+ rubocop (0.29.1)
40
+ astrolabe (~> 1.3)
41
+ parser (>= 2.2.0.1, < 3.0)
42
+ powerpack (~> 0.1)
43
+ rainbow (>= 1.99.1, < 3.0)
44
+ ruby-progressbar (~> 1.4)
45
+ ruby-progressbar (1.7.1)
46
+ safe_yaml (1.0.4)
47
+ simplecov (0.9.2)
48
+ docile (~> 1.1.0)
49
+ multi_json (~> 1.0)
50
+ simplecov-html (~> 0.9.0)
51
+ simplecov-html (0.9.0)
52
+ vcr (2.9.3)
53
+ webmock (1.20.4)
54
+ addressable (>= 2.3.6)
55
+ crack (>= 0.3.2)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ bundler (~> 1.3)
62
+ codeclimate-test-reporter (~> 0.4.6)
63
+ nexpose!
64
+ rspec (~> 3.2)
65
+ rubocop (~> 0.29.0)
66
+ simplecov (~> 0.9.1)
67
+ vcr (~> 2.9.3)
68
+ webmock (~> 1.20.4)
@@ -1,4 +1,5 @@
1
1
  # Nexpose-Client
2
+ [![Gem Version](https://badge.fury.io/rb/nexpose.svg)](http://badge.fury.io/rb/nexpose) [![Build Status](https://travis-ci.org/rapid7/nexpose-client.svg?branch=master)](https://travis-ci.org/rapid7/nexpose-client) [![Test Coverage](https://codeclimate.com/github/rapid7/nexpose-client/badges/coverage.svg)](https://codeclimate.com/github/rapid7/nexpose-client) [![Inline docs](http://inch-ci.org/github/rapid7/nexpose-client.svg?branch=master)](http://inch-ci.org/github/rapid7/nexpose-client) [![Code Climate](https://codeclimate.com/github/rapid7/nexpose-client/badges/gpa.svg)](https://codeclimate.com/github/rapid7/nexpose-client)
2
3
 
3
4
  This is the official gem package for the Ruby Nexpose API.
4
5
 
@@ -103,7 +103,6 @@ require 'nexpose/version'
103
103
 
104
104
  module Nexpose
105
105
 
106
- # ==== Description
107
106
  # Echos the last XML API request and response for the specified object. (Useful for debugging)
108
107
  def self.print_xml(object)
109
108
  puts 'request: ' + object.request_xml.to_s
@@ -64,7 +64,7 @@ module Nexpose
64
64
 
65
65
  # Get a list of all assets currently associated with a group.
66
66
  #
67
- # @param [Fixnum] dev_id Unique identifier of a device (asset).
67
+ # @param [Fixnum] group_id Unique identifier of an asset group.
68
68
  # @return [Array[FilteredAsset]] List of group assets.
69
69
  #
70
70
  def group_assets(group_id)
@@ -66,7 +66,7 @@ module Nexpose
66
66
  # API call. Then upload the archive using HTTPS to a URL that is specified
67
67
  # as an API parameter.
68
68
  #
69
- # @param url Upload server to send the support log package to.
69
+ # @param uri Upload server to send the support log package to.
70
70
  #
71
71
  def send_log(uri = 'https://support.rapid7.com')
72
72
  url = REXML::Element.new('URL')
@@ -93,7 +93,7 @@ module Nexpose
93
93
  #
94
94
  # @param [Connection] connection Connection to console where site exists.
95
95
  # @param [String] name The name of the engine pool.
96
- # @param [String] silo The silo of the engine pool.
96
+ # @param [String] scope The silo of the engine pool.
97
97
  # @return [EnginePool] Engine pool configuration object.
98
98
  #
99
99
  def self.load(connection, name, scope = 'silo')
@@ -401,7 +401,7 @@ module Nexpose
401
401
 
402
402
  # Parse a response from a Nexpose console into a valid ScanSummary object.
403
403
  #
404
- # @param [REXML::Document] rexml XML document to parse.
404
+ # @param [REXML::Document] xml XML document to parse.
405
405
  # @return [ScanSummary] Scan summary represented by the XML.
406
406
  #
407
407
  def self.parse(xml)
@@ -200,7 +200,7 @@ module Nexpose
200
200
  end
201
201
 
202
202
  # Add custom UDP ports to scan for services
203
- # @param [Array] posts to scan
203
+ # @param [Array] ports to scan
204
204
  def udp_service_ports=(ports)
205
205
  service_ports = REXML::XPath.first(@xml, 'ScanTemplate/ServiceDiscovery/UDPPortScan')
206
206
  service_ports.attributes['mode'] = "custom"
@@ -251,6 +251,46 @@ module Nexpose
251
251
  end
252
252
  end
253
253
 
254
+ # Adds an asset to this site's exclude list, resolving whether an IP or
255
+ # hostname is provided.
256
+ #
257
+ # @param [String] asset Identifier of an asset, either IP or host name.
258
+ #
259
+ def exclude_asset(asset)
260
+ @exclude << HostOrIP.convert(asset)
261
+ end
262
+
263
+ alias_method :exclude_host, :exclude_asset
264
+ alias_method :exclude_ip, :exclude_asset
265
+
266
+ # Remove an asset from this site's exclude list, resolving whether an IP
267
+ # or hostname is provided.
268
+ #
269
+ # @param [String] asset Identifier of an asset, either IP or host name.
270
+ #
271
+ def remove_excluded_asset(asset)
272
+ @exclude.reject! { |existing_asset| existing_asset == HostOrIP.convert(asset) }
273
+ end
274
+
275
+ alias_method :remove_excluded_host, :remove_excluded_asset
276
+ alias_method :remove_excluded_ip, :remove_excluded_asset
277
+
278
+ # Adds assets to this site's exclude list by IP address range.
279
+ #
280
+ # @param [String] from Beginning IP address of a range.
281
+ # @param [String] to Ending IP address of a range.
282
+ def exclude_ip_range(from, to)
283
+ @exclude << IPRange.new(from, to)
284
+ end
285
+
286
+ # Remove assets from this site's exclude list by IP address range.
287
+ #
288
+ # @param [String] from Beginning IP address of a range.
289
+ # @param [String] to Ending IP address of a range.
290
+ def remove_excluded_ip_range(from, to)
291
+ @exclude.reject! { |asset| asset == IPRange.new(from, to) }
292
+ end
293
+
254
294
  # Load an existing configuration from a Nexpose instance.
255
295
  #
256
296
  # @param [Connection] connection Connection to console where site exists.
@@ -375,7 +415,6 @@ module Nexpose
375
415
  # Retrieve the currrent filter criteria used by a dynamic site.
376
416
  #
377
417
  # @param [Connection] nsc Connection to a console.
378
- # @param [Fixnum] site_id ID of an existing site.
379
418
  # @return [Criteria] Current criteria for the site.
380
419
  #
381
420
  def load_dynamic_attributes(nsc)
@@ -614,9 +653,36 @@ module Nexpose
614
653
  # End of range *Optional (If nil then IPRange is a single IP Address)
615
654
  attr_accessor :to
616
655
 
656
+ # @overload initialize(ip)
657
+ # @param [#to_s] from the IP single IP address.
658
+ # @example
659
+ # Nexpose::IPRange.new('192.168.1.0')
660
+ #
661
+ # @overload initialize(start_ip, end_ip)
662
+ # @param [#to_s] from the IP to start the range with.
663
+ # @param [#to_s] to the IP to end the range with.
664
+ # @example
665
+ # Nexpose::IPRange.new('192.168.1.0', '192.168.1.255')
666
+ #
667
+ # @overload initialize(cidr_range)
668
+ # @param [#to_s] from the CIDR notation IP address range.
669
+ # @example
670
+ # Nexpose::IPRange.new('192.168.1.0/24')
671
+ # @note The range will not be stripped of reserved IP addresses (such as
672
+ # x.x.x.0 and x.x.x.255).
673
+ #
674
+ # @return [IPRange] an IP address range of one or more addresses.
617
675
  def initialize(from, to = nil)
618
676
  @from = from
619
677
  @to = to unless from == to
678
+
679
+ return unless @to.nil?
680
+
681
+ range = IPAddr.new(@from.to_s).to_range
682
+ unless range.one?
683
+ @from = range.first.to_s
684
+ @to = range.last.to_s
685
+ end
620
686
  end
621
687
 
622
688
  # Size of the IP range. The total number of IP addresses represented
@@ -239,7 +239,7 @@ module Nexpose
239
239
  # Retrieve detailed description of a single tag
240
240
  #
241
241
  # @param [Connection] connection Nexpose connection
242
- # @param [Fixnum] ID of tag to retrieve
242
+ # @param [Fixnum] tag_id ID of tag to retrieve
243
243
  # @return [Tag] requested tag
244
244
  #
245
245
  def self.load(connection, tag_id)
@@ -1,4 +1,4 @@
1
1
  module Nexpose
2
2
  # The latest version of the Nexpose gem
3
- VERSION = '0.9.5'
3
+ VERSION = '0.9.6'
4
4
  end
@@ -18,7 +18,13 @@ Gem::Specification.new do |s|
18
18
  s.required_ruby_version = '>= 1.9'
19
19
  s.platform = 'ruby'
20
20
 
21
- s.add_runtime_dependency('rex', '~> 2.0.5', '>= 2.0.5')
21
+ s.add_runtime_dependency('rex', '2.0.7')
22
22
 
23
23
  s.add_development_dependency('bundler', '~> 1.3')
24
+ s.add_development_dependency('codeclimate-test-reporter', '~> 0.4.6')
25
+ s.add_development_dependency('simplecov', '~> 0.9.1')
26
+ s.add_development_dependency('rspec', '~> 3.2')
27
+ s.add_development_dependency('rubocop', '~> 0.29.0')
28
+ s.add_development_dependency('webmock', '~> 1.20.4')
29
+ s.add_development_dependency('vcr', '~> 2.9.3')
24
30
  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: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - HD Moore
@@ -13,28 +13,22 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-02-09 00:00:00.000000000 Z
16
+ date: 2015-03-05 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rex
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
- - - "~>"
23
- - !ruby/object:Gem::Version
24
- version: 2.0.5
25
- - - ">="
22
+ - - '='
26
23
  - !ruby/object:Gem::Version
27
- version: 2.0.5
24
+ version: 2.0.7
28
25
  type: :runtime
29
26
  prerelease: false
30
27
  version_requirements: !ruby/object:Gem::Requirement
31
28
  requirements:
32
- - - "~>"
29
+ - - '='
33
30
  - !ruby/object:Gem::Version
34
- version: 2.0.5
35
- - - ">="
36
- - !ruby/object:Gem::Version
37
- version: 2.0.5
31
+ version: 2.0.7
38
32
  - !ruby/object:Gem::Dependency
39
33
  name: bundler
40
34
  requirement: !ruby/object:Gem::Requirement
@@ -49,6 +43,90 @@ dependencies:
49
43
  - - "~>"
50
44
  - !ruby/object:Gem::Version
51
45
  version: '1.3'
46
+ - !ruby/object:Gem::Dependency
47
+ name: codeclimate-test-reporter
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: 0.4.6
53
+ type: :development
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 0.4.6
60
+ - !ruby/object:Gem::Dependency
61
+ name: simplecov
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: 0.9.1
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: 0.9.1
74
+ - !ruby/object:Gem::Dependency
75
+ name: rspec
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - "~>"
79
+ - !ruby/object:Gem::Version
80
+ version: '3.2'
81
+ type: :development
82
+ prerelease: false
83
+ version_requirements: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '3.2'
88
+ - !ruby/object:Gem::Dependency
89
+ name: rubocop
90
+ requirement: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "~>"
93
+ - !ruby/object:Gem::Version
94
+ version: 0.29.0
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "~>"
100
+ - !ruby/object:Gem::Version
101
+ version: 0.29.0
102
+ - !ruby/object:Gem::Dependency
103
+ name: webmock
104
+ requirement: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "~>"
107
+ - !ruby/object:Gem::Version
108
+ version: 1.20.4
109
+ type: :development
110
+ prerelease: false
111
+ version_requirements: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: 1.20.4
116
+ - !ruby/object:Gem::Dependency
117
+ name: vcr
118
+ requirement: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: 2.9.3
123
+ type: :development
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: 2.9.3
52
130
  description: This gem provides a Ruby API to the Nexpose vulnerability management
53
131
  product by Rapid7.
54
132
  email:
@@ -66,6 +144,7 @@ files:
66
144
  - CONTRIBUTING.md
67
145
  - COPYING
68
146
  - Gemfile
147
+ - Gemfile.lock
69
148
  - README.markdown
70
149
  - Rakefile
71
150
  - lib/README.md
@@ -139,4 +218,3 @@ signing_key:
139
218
  specification_version: 4
140
219
  summary: Ruby API for Rapid7 Nexpose
141
220
  test_files: []
142
- has_rdoc: