Class: Nexpose::ScanSummary
- Inherits:
-
Object
- Object
- Nexpose::ScanSummary
- Defined in:
- lib/nexpose/scan.rb
Overview
Description
Object that represents a summary of a scan.
Defined Under Namespace
Classes: Nodes, Tasks, Vulnerabilities
Instance Attribute Summary collapse
-
#end_time ⇒ Object
readonly
The scan finish time.
-
#engine_id ⇒ Object
readonly
The Engine ID the scan was dispatched to.
-
#message ⇒ Object
readonly
The reason the scan was stopped or failed, if applicable.
-
#nodes ⇒ Object
readonly
Node statistics, including live, dead, filtered, and unresolved.
-
#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.
-
#tasks ⇒ Object
readonly
Task statistics, including pending, active, and completed tasks.
-
#vulnerabilities ⇒ Object
readonly
Vulnerability statistics, including statuses, severities, and counts.
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
112 113 114 115 |
# File 'lib/nexpose/scan.rb', line 112 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
#end_time ⇒ Object (readonly)
The scan finish time
96 97 98 |
# File 'lib/nexpose/scan.rb', line 96 def end_time @end_time end |
#engine_id ⇒ Object (readonly)
The Engine ID the scan was dispatched to.
92 93 94 |
# File 'lib/nexpose/scan.rb', line 92 def engine_id @engine_id end |
#message ⇒ Object (readonly)
The reason the scan was stopped or failed, if applicable.
102 103 104 |
# File 'lib/nexpose/scan.rb', line 102 def @message end |
#nodes ⇒ Object (readonly)
Node statistics, including live, dead, filtered, and unresolved.
107 108 109 |
# File 'lib/nexpose/scan.rb', line 107 def nodes @nodes end |
#scan_id ⇒ Object (readonly)
The Scan ID of the Scan
88 89 90 |
# File 'lib/nexpose/scan.rb', line 88 def scan_id @scan_id end |
#site_id ⇒ Object (readonly)
The site that was scanned.
90 91 92 |
# File 'lib/nexpose/scan.rb', line 90 def site_id @site_id end |
#start_time ⇒ Object (readonly)
The scan start time
94 95 96 |
# File 'lib/nexpose/scan.rb', line 94 def start_time @start_time end |
#status ⇒ Object (readonly)
The scan status. One of: running|finished|stopped|error|dispatched|paused|aborted|uknown
99 100 101 |
# File 'lib/nexpose/scan.rb', line 99 def status @status end |
#tasks ⇒ Object (readonly)
Task statistics, including pending, active, and completed tasks.
105 106 107 |
# File 'lib/nexpose/scan.rb', line 105 def tasks @tasks end |
#vulnerabilities ⇒ Object (readonly)
Vulnerability statistics, including statuses, severities, and counts.
109 110 111 |
# File 'lib/nexpose/scan.rb', line 109 def vulnerabilities @vulnerabilities end |
Class Method Details
.parse(xml) ⇒ ScanSummary
Parse a response from a Nexpose console into a valid ScanSummary object.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/nexpose/scan.rb', line 122 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 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 end return 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 |