class Nexpose::ScanData

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.

Attributes

end_time[R]

The scan finish time

engine_id[R]

The Engine ID the scan was dispatched to.

scan_id[R]

The Scan ID of the Scan

site_id[R]

The site that was scanned.

start_time[R]

The scan start time

status[R]

The scan status. One of: running|finished|stopped|error|dispatched|paused|aborted|uknown

Public Class Methods

new(scan_id, site_id, engine_id, status, start_time, end_time) click to toggle source

Constructor

# File lib/nexpose/scan.rb, line 505
def initialize(scan_id, site_id, engine_id, status, start_time, end_time)
  @scan_id    = scan_id
  @site_id    = site_id
  @engine_id  = engine_id
  @status     = status
  @start_time = start_time
  @end_time   = end_time
end
parse(xml) click to toggle source
# File lib/nexpose/scan.rb, line 514
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