Class: Nexpose::ScanData
- Inherits:
-
Object
- Object
- Nexpose::ScanData
- Defined in:
- lib/nexpose/scan.rb
Overview
Minimal scan data object. Unlike ScanSummary, these objects don’t collect vulnerability data, which can be rather verbose and isn’t useful for many automation scenarios.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#end_time ⇒ Object
readonly
The scan finish time.
-
#engine_id ⇒ Object
readonly
The Engine ID the scan was dispatched to.
-
#scan_id ⇒ Object
readonly
The Scan ID of the Scan.
-
#site_id ⇒ Object
readonly
The site that was scanned.
-
#start_time ⇒ Object
readonly
The scan start time.
-
#status ⇒ Object
readonly
The scan status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(scan_id, site_id, engine_id, status, start_time, end_time) ⇒ ScanData
constructor
Constructor.
Constructor Details
#initialize(scan_id, site_id, engine_id, status, start_time, end_time) ⇒ ScanData
Constructor
353 354 355 |
# File 'lib/nexpose/scan.rb', line 353 def initialize(scan_id, site_id, engine_id, status, start_time, end_time) @scan_id, @site_id, @engine_id, @status, @start_time, @end_time = scan_id, site_id, engine_id, status, start_time, end_time end |
Instance Attribute Details
#end_time ⇒ Object (readonly)
The scan finish time
347 348 349 |
# File 'lib/nexpose/scan.rb', line 347 def end_time @end_time end |
#engine_id ⇒ Object (readonly)
The Engine ID the scan was dispatched to.
343 344 345 |
# File 'lib/nexpose/scan.rb', line 343 def engine_id @engine_id end |
#scan_id ⇒ Object (readonly)
The Scan ID of the Scan
339 340 341 |
# File 'lib/nexpose/scan.rb', line 339 def scan_id @scan_id end |
#site_id ⇒ Object (readonly)
The site that was scanned.
341 342 343 |
# File 'lib/nexpose/scan.rb', line 341 def site_id @site_id end |
#start_time ⇒ Object (readonly)
The scan start time
345 346 347 |
# File 'lib/nexpose/scan.rb', line 345 def start_time @start_time end |
#status ⇒ Object (readonly)
The scan status. One of: running|finished|stopped|error|dispatched|paused|aborted|uknown
350 351 352 |
# File 'lib/nexpose/scan.rb', line 350 def status @status end |
Class Method Details
.parse(xml) ⇒ Object
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/nexpose/scan.rb', line 356 def self.parse(xml) # Start time can be empty in some error conditions. start_time = nil unless xml.attributes['startTime'] == '' start_time = DateTime.parse(xml.attributes['startTime'].to_s).to_time # Timestamp is UTC, but parsed as local time. start_time -= start_time.gmt_offset end # End time is often not present, since reporting on running scans. end_time = nil if xml.attributes['endTime'] end_time = DateTime.parse(xml.attributes['endTime'].to_s).to_time # Timestamp is UTC, but parsed as local time. end_time -= end_time.gmt_offset end ScanData.new(xml.attributes['scan-id'].to_i, xml.attributes['site-id'].to_i, xml.attributes['engine-id'].to_i, xml.attributes['status'], start_time, end_time) end |