nexpose 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nexpose/site.rb +25 -2
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f12897628d1710af3338cb1dd054b486bdf6366
4
- data.tar.gz: 9791475b4e43ad471b8d540bda2f9bc02e7b8de3
3
+ metadata.gz: e8303bf73cfbd73693c68670f4dd448eccc8c2a0
4
+ data.tar.gz: b28294ca9658ae322e759a851ad13fa35d2bf06e
5
5
  SHA512:
6
- metadata.gz: 30abfc67f83742aba0c41f5b5289926dd9d3807680f8fc91cb8bda182db63706ab2ebd34259bf61d99466f0d8a204ba4f67ecd75d8926a95f132352a057e9e52
7
- data.tar.gz: a6965ad2a9c31df45eef1efcc563bfa6fe9f7590716e5c5d6a3f70b71ed1be8ad6facffbde4d50b523ebb4582b44edc4f3c9fbd90e98e2acebff074245721e83
6
+ metadata.gz: b58c671197ce229fb7518f2cfd7ee02940931bee4c9e5a832ae54737600331f2e831ea085b4ec2b9c5d90380e9f0ca37b3534dc0c9c6ee0802b3397c96ef549a
7
+ data.tar.gz: 7423eb92c736ef27cd5273bdc079dbf9806845663c98d7bd79197d79660ebab8187d80110b145ac70c385644caa33b88bbff5211e0f8ab4deda787d02e372c41
data/lib/nexpose/site.rb CHANGED
@@ -34,12 +34,35 @@ module Nexpose
34
34
  alias_method :devices, :site_device_listing
35
35
  alias_method :list_devices, :site_device_listing
36
36
 
37
+ # Find a Device by its address.
38
+ #
39
+ # This is a convenience method for finding a single device from a SiteDeviceListing.
40
+ # If no site_id is provided, the first matching device will be returned when a device
41
+ # occurs across multiple sites.
42
+ #
43
+ # @param [String] address Address of the device to find. Usually the IP address.
44
+ # @param [FixNum] site_id Site ID to request scan history for.
45
+ # @return [Device] The first matching Device with the provided address, if found.
46
+ #
47
+ def find_device_by_address(address, site_id = nil)
48
+ r = execute(make_xml('SiteDeviceListingRequest', {'site-id' => site_id}))
49
+ if r.success
50
+ device = REXML::XPath.first(r.res, "SiteDeviceListingResponse/SiteDevices/device[@address='#{address}']")
51
+ return Device.new(device.attributes['id'].to_i,
52
+ device.attributes['address'],
53
+ device.parent.attributes['site-id'],
54
+ device.attributes['riskfactor'].to_f,
55
+ device.attributes['riskscore'].to_f) if device
56
+ end
57
+ nil
58
+ end
59
+
37
60
  # Delete the specified site and all associated scan data.
38
61
  #
39
62
  # @return Whether or not the delete request succeeded.
40
63
  #
41
- def site_delete(param)
42
- r = execute(make_xml('SiteDeleteRequest', {'site-id' => param}))
64
+ def site_delete(site_id)
65
+ r = execute(make_xml('SiteDeleteRequest', {'site-id' => site_id}))
43
66
  r.success
44
67
  end
45
68
 
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.7
4
+ version: 0.2.8
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-07-02 00:00:00.000000000 Z
13
+ date: 2013-07-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: librex
@@ -87,7 +87,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - '>='
89
89
  - !ruby/object:Gem::Version
90
- version: 1.8.7
90
+ version: '1.9'
91
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - '>='