Class: Nexpose::ScanSummary
Overview
Object that represents a summary of a scan.
Defined Under Namespace
Classes: Nodes, Tasks, Vulnerabilities
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
The reason the scan was stopped or failed, if applicable.
-
#nodes ⇒ Object
readonly
Node statistics, including live, dead, filtered, and unresolved.
-
#tasks ⇒ Object
readonly
Task statistics, including pending, active, and completed tasks.
-
#vulnerabilities ⇒ Object
readonly
Vulnerability statistics, including statuses, severities, and counts.
Attributes inherited from ScanData
#end_time, #engine_id, #scan_id, #site_id, #start_time, #status
Class Method Summary collapse
-
.parse(xml) ⇒ ScanSummary
Parse a response from a Nexpose console into a valid ScanSummary object.
Instance Method Summary collapse
-
#initialize(scan_id, site_id, engine_id, status, start_time, end_time, message, tasks, nodes, vulnerabilities) ⇒ ScanSummary
constructor
Constructor.
Constructor Details
#initialize(scan_id, site_id, engine_id, status, start_time, end_time, message, tasks, nodes, vulnerabilities) ⇒ ScanSummary
Constructor
379 380 381 382 |
# File 'lib/nexpose/scan.rb', line 379 def initialize(scan_id, site_id, engine_id, status, start_time, end_time, , tasks, nodes, vulnerabilities) @scan_id, @site_id, @engine_id, @status, @start_time, @end_time = scan_id, site_id, engine_id, status, start_time, end_time @message, @tasks, @nodes, @vulnerabilities = , tasks, nodes, vulnerabilities end |
Instance Attribute Details
#message ⇒ Object (readonly)
The reason the scan was stopped or failed, if applicable.
369 370 371 |
# File 'lib/nexpose/scan.rb', line 369 def @message end |
#nodes ⇒ Object (readonly)
Node statistics, including live, dead, filtered, and unresolved.
374 375 376 |
# File 'lib/nexpose/scan.rb', line 374 def nodes @nodes end |
#tasks ⇒ Object (readonly)
Task statistics, including pending, active, and completed tasks.
372 373 374 |
# File 'lib/nexpose/scan.rb', line 372 def tasks @tasks end |
#vulnerabilities ⇒ Object (readonly)
Vulnerability statistics, including statuses, severities, and counts.
376 377 378 |
# File 'lib/nexpose/scan.rb', line 376 def vulnerabilities @vulnerabilities end |
Class Method Details
.parse(xml) ⇒ ScanSummary
Parse a response from a Nexpose console into a valid ScanSummary object.
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/nexpose/scan.rb', line 389 def self.parse(xml) tasks = Tasks.parse(xml.elements['tasks']) nodes = Nodes.parse(xml.elements['nodes']) vulns = Vulnerabilities.parse(xml.attributes['scan-id'], xml) msg = xml.elements['message'] ? xml.elements['message'].text : nil # 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 ScanSummary.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, msg, tasks, nodes, vulns) end |