Class: Nexpose::VulnFilter

Inherits:
Object
  • Object
show all
Includes:
JsonSerializer
Defined in:
lib/nexpose/alert.rb

Overview

Vulnerability filtering for alerting. Set values to 1 to enable and 0 to disable.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from JsonSerializer

#deserialize, #serialize, #to_hash

Constructor Details

#initialize(severity = 1, confirmed = 1, unconfirmed = 1, potential = 1) ⇒ VulnFilter

Returns a new instance of VulnFilter.



38
39
40
41
# File 'lib/nexpose/alert.rb', line 38

def initialize(severity = 1, confirmed = 1, unconfirmed = 1, potential = 1)
  @severity, @confirmed = severity.to_i, confirmed.to_i
  @unconfirmed, @potential = unconfirmed.to_i, potential.to_i
end

Instance Attribute Details

#confirmedObject

Vulnerability events to alert on.



36
37
38
# File 'lib/nexpose/alert.rb', line 36

def confirmed
  @confirmed
end

#potentialObject

Vulnerability events to alert on.



36
37
38
# File 'lib/nexpose/alert.rb', line 36

def potential
  @potential
end

#severityObject

Only alert on vulnerability findings with a severity level greater than this level. Range is 0 to 10. Values in the UI correspond as follows:

Any severity: 1
Severe and critical: 4
Only critical: 8


33
34
35
# File 'lib/nexpose/alert.rb', line 33

def severity
  @severity
end

#unconfirmedObject

Vulnerability events to alert on.



36
37
38
# File 'lib/nexpose/alert.rb', line 36

def unconfirmed
  @unconfirmed
end

Class Method Details

.json_initializer(filter) ⇒ Object



43
44
45
46
47
48
# File 'lib/nexpose/alert.rb', line 43

def self.json_initializer(filter)
  new(filter[:severity] ? 1 : 0,
      filter[:unconfirmed] ? 1 : 0,
      filter[:confirmed] ? 1 : 0,
      filter[:potential] ? 1 : 0)
end