Class: Nexpose::CompletedAsset
- Inherits:
-
Object
- Object
- Nexpose::CompletedAsset
- Defined in:
- lib/nexpose/device.rb
Overview
Summary object of a completed asset for a scan.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Time it took to scan the asset, in milliseconds.
-
#host_name ⇒ Object
readonly
Host name of the asset, if discovered.
-
#id ⇒ Object
readonly
Unique identifier of an asset.
-
#ip ⇒ Object
readonly
IP address of the asset.
-
#os ⇒ Object
readonly
Operating system fingerprint of the asset.
-
#status ⇒ Object
readonly
Status of the asset on scan completion.
-
#vulns ⇒ Object
readonly
Number of vulnerabilities discovered on the asset.
Class Method Summary collapse
-
.parse_json(json) ⇒ Object
Internal method for converting a JSON representation into a CompletedScan object.
Instance Method Summary collapse
-
#initialize(&block) ⇒ CompletedAsset
constructor
Internal constructor to be called by #parse_json.
-
#ip_address ⇒ Object
Convenience method for assessing “ip” as “ip_address”.
-
#operating_system ⇒ Object
Convenience method for assessing “os” as “operating_system”.
Constructor Details
#initialize(&block) ⇒ CompletedAsset
Internal constructor to be called by #parse_json.
207 208 209 |
# File 'lib/nexpose/device.rb', line 207 def initialize(&block) instance_eval(&block) if block_given? end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Time it took to scan the asset, in milliseconds.
204 205 206 |
# File 'lib/nexpose/device.rb', line 204 def duration @duration end |
#host_name ⇒ Object (readonly)
Host name of the asset, if discovered.
195 196 197 |
# File 'lib/nexpose/device.rb', line 195 def host_name @host_name end |
#id ⇒ Object (readonly)
Unique identifier of an asset.
191 192 193 |
# File 'lib/nexpose/device.rb', line 191 def id @id end |
#ip ⇒ Object (readonly)
IP address of the asset.
193 194 195 |
# File 'lib/nexpose/device.rb', line 193 def ip @ip end |
#os ⇒ Object (readonly)
Operating system fingerprint of the asset.
197 198 199 |
# File 'lib/nexpose/device.rb', line 197 def os @os end |
#status ⇒ Object (readonly)
Status of the asset on scan completion. One of :completed, :error, or :stopped.
202 203 204 |
# File 'lib/nexpose/device.rb', line 202 def status @status end |
#vulns ⇒ Object (readonly)
Number of vulnerabilities discovered on the asset.
199 200 201 |
# File 'lib/nexpose/device.rb', line 199 def vulns @vulns end |
Class Method Details
.parse_json(json) ⇒ Object
Internal method for converting a JSON representation into a CompletedScan object.
223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/nexpose/device.rb', line 223 def self.parse_json(json) new do @id = json['assetID'].to_i @ip = json['ipAddress'] @host_name = json['hostName'] @os = json['operatingSystem'] @vulns = json['vulnerabilityCount'] @status = json['scanStatusTranslation'].downcase.to_sym @duration = json['duration'] end end |
Instance Method Details
#ip_address ⇒ Object
Convenience method for assessing “ip” as “ip_address”.
212 213 214 |
# File 'lib/nexpose/device.rb', line 212 def ip_address ip end |
#operating_system ⇒ Object
Convenience method for assessing “os” as “operating_system”.
217 218 219 |
# File 'lib/nexpose/device.rb', line 217 def os end |