Class: Nexpose::CompletedAsset
- Inherits:
-
Object
- Object
- Nexpose::CompletedAsset
- Defined in:
- lib/nexpose/device.rb
Overview
Summary object of a completed asset for a scan.
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.
163 164 165 |
# File 'lib/nexpose/device.rb', line 163 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.
160 161 162 |
# File 'lib/nexpose/device.rb', line 160 def duration @duration end |
#host_name ⇒ Object (readonly)
Host name of the asset, if discovered.
151 152 153 |
# File 'lib/nexpose/device.rb', line 151 def host_name @host_name end |
#id ⇒ Object (readonly)
Unique identifier of an asset.
147 148 149 |
# File 'lib/nexpose/device.rb', line 147 def id @id end |
#ip ⇒ Object (readonly)
IP address of the asset.
149 150 151 |
# File 'lib/nexpose/device.rb', line 149 def ip @ip end |
#os ⇒ Object (readonly)
Operating system fingerprint of the asset.
153 154 155 |
# File 'lib/nexpose/device.rb', line 153 def os @os end |
#status ⇒ Object (readonly)
Status of the asset on scan completion. One of :completed, :error, or :stopped.
158 159 160 |
# File 'lib/nexpose/device.rb', line 158 def status @status end |
#vulns ⇒ Object (readonly)
Number of vulnerabilities discovered on the asset.
155 156 157 |
# File 'lib/nexpose/device.rb', line 155 def vulns @vulns end |
Class Method Details
.parse_json(json) ⇒ Object
Internal method for converting a JSON representation into a CompletedScan object.
179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/nexpose/device.rb', line 179 def self.parse_json(json) new do @id = json['id'].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”.
168 169 170 |
# File 'lib/nexpose/device.rb', line 168 def ip_address ip end |
#operating_system ⇒ Object
Convenience method for assessing “os” as “operating_system”.
173 174 175 |
# File 'lib/nexpose/device.rb', line 173 def os end |