Class: Nexpose::ScanSummary::Vulnerabilities::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/scan.rb

Overview

Value class for tracking vulnerability status counts.

Severities will only be mapped if they are provided in the response, which currently only happens for vuln-exploit, vuln-version, and vuln-potential.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(severity = nil, count = 0) ⇒ Status

Returns a new instance of Status.



251
252
253
254
255
256
257
258
259
260
# File 'lib/nexpose/scan.rb', line 251

def initialize(severity = nil, count = 0)
  if severity
    @severities = {}
    @count = 0
    add_severity(severity.to_i, count)
  else
    @severities = nil
    @count = count
  end
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



249
250
251
# File 'lib/nexpose/scan.rb', line 249

def count
  @count
end

#severitiesObject (readonly)

Returns the value of attribute severities.



249
250
251
# File 'lib/nexpose/scan.rb', line 249

def severities
  @severities
end

Instance Method Details

#add_severity(severity, count) ⇒ Object

For vuln-exploit, vuln-version, and vuln-potential, map the count at a severity level, but also maintain an overall count.



264
265
266
267
# File 'lib/nexpose/scan.rb', line 264

def add_severity(severity, count)
  @count += count
  @severities[severity] = count
end