Class: Nexpose::ScanSummary::Vulnerabilities
- Inherits:
-
Object
- Object
- Nexpose::ScanSummary::Vulnerabilities
- Defined in:
- lib/nexpose/scan.rb
Overview
Value class for tracking vulnerability counts.
Defined Under Namespace
Classes: Status
Instance Attribute Summary collapse
-
#disabled ⇒ Object
readonly
Returns the value of attribute disabled.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#not_vuln_exploit ⇒ Object
readonly
Returns the value of attribute not_vuln_exploit.
-
#not_vuln_version ⇒ Object
readonly
Returns the value of attribute not_vuln_version.
-
#other ⇒ Object
readonly
Returns the value of attribute other.
-
#vuln_exploit ⇒ Object
readonly
Returns the value of attribute vuln_exploit.
-
#vuln_potential ⇒ Object
readonly
Returns the value of attribute vuln_potential.
-
#vuln_version ⇒ Object
readonly
Returns the value of attribute vuln_version.
Class Method Summary collapse
-
.parse(scan_id, rexml) ⇒ Vulnerabilities
Parse REXML to Vulnerabilities object.
Instance Method Summary collapse
-
#initialize(vuln_exploit, vuln_version, vuln_potential, not_vuln_exploit, not_vuln_version, error, disabled, other) ⇒ Vulnerabilities
constructor
A new instance of Vulnerabilities.
Constructor Details
#initialize(vuln_exploit, vuln_version, vuln_potential, not_vuln_exploit, not_vuln_version, error, disabled, other) ⇒ Vulnerabilities
Returns a new instance of Vulnerabilities.
340 341 342 343 344 345 346 347 348 349 |
# File 'lib/nexpose/scan.rb', line 340 def initialize(vuln_exploit, vuln_version, vuln_potential, not_vuln_exploit, not_vuln_version, error, disabled, other) @vuln_exploit, @vuln_version, @vuln_potential, @not_vuln_exploit, @not_vuln_version, @error, @disabled, @other = vuln_exploit, vuln_version, vuln_potential, not_vuln_exploit, not_vuln_version, error, disabled, other end |
Instance Attribute Details
#disabled ⇒ Object (readonly)
Returns the value of attribute disabled.
336 337 338 |
# File 'lib/nexpose/scan.rb', line 336 def disabled @disabled end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
336 337 338 |
# File 'lib/nexpose/scan.rb', line 336 def error @error end |
#not_vuln_exploit ⇒ Object (readonly)
Returns the value of attribute not_vuln_exploit.
336 337 338 |
# File 'lib/nexpose/scan.rb', line 336 def not_vuln_exploit @not_vuln_exploit end |
#not_vuln_version ⇒ Object (readonly)
Returns the value of attribute not_vuln_version.
336 337 338 |
# File 'lib/nexpose/scan.rb', line 336 def not_vuln_version @not_vuln_version end |
#other ⇒ Object (readonly)
Returns the value of attribute other.
336 337 338 |
# File 'lib/nexpose/scan.rb', line 336 def other @other end |
#vuln_exploit ⇒ Object (readonly)
Returns the value of attribute vuln_exploit.
336 337 338 |
# File 'lib/nexpose/scan.rb', line 336 def vuln_exploit @vuln_exploit end |
#vuln_potential ⇒ Object (readonly)
Returns the value of attribute vuln_potential.
336 337 338 |
# File 'lib/nexpose/scan.rb', line 336 def vuln_potential @vuln_potential end |
#vuln_version ⇒ Object (readonly)
Returns the value of attribute vuln_version.
336 337 338 |
# File 'lib/nexpose/scan.rb', line 336 def vuln_version @vuln_version end |
Class Method Details
.parse(scan_id, rexml) ⇒ Vulnerabilities
Parse REXML to Vulnerabilities object.
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/nexpose/scan.rb', line 357 def self.parse(scan_id, rexml) return nil unless rexml map = {} rexml.elements.each("//ScanSummary[contains(@scan-id,'#{scan_id}')]/vulnerabilities") do |vuln| status = map[vuln.attributes['status']] if status && vuln.attributes['status'] =~ /^vuln-/ status.add_severity(vuln.attributes['severity'].to_i, vuln.attributes['count'].to_i) else map[vuln.attributes['status']] = Status.new(vuln.attributes['severity'], vuln.attributes['count'].to_i) end end Vulnerabilities.new(map['vuln-exploit'], map['vuln-version'], map['vuln-potential'], map['not-vuln-exploit'], map['not-vuln-version'], map['error'], map['disabled'], map['other']) end |