Class: Nexpose::VulnFilter

Inherits:
Object
  • Object
show all
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

Constructor Details

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

Returns a new instance of VulnFilter.



113
114
115
# File 'lib/nexpose/alert.rb', line 113

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

Instance Attribute Details

#confirmedObject

Vulnerability events to alert on.



111
112
113
# File 'lib/nexpose/alert.rb', line 111

def confirmed
  @confirmed
end

#potentialObject

Vulnerability events to alert on.



111
112
113
# File 'lib/nexpose/alert.rb', line 111

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


108
109
110
# File 'lib/nexpose/alert.rb', line 108

def severity
  @severity
end

#unconfirmedObject

Vulnerability events to alert on.



111
112
113
# File 'lib/nexpose/alert.rb', line 111

def unconfirmed
  @unconfirmed
end

Class Method Details

.parse(xml) ⇒ Object



126
127
128
129
130
131
# File 'lib/nexpose/alert.rb', line 126

def self.parse(xml)
  new(xml.attributes['severityThreshold'].to_i,
      xml.attributes['confirmed'].to_i,
      xml.attributes['unconfirmed'].to_i,
      xml.attributes['potential'].to_i)
end

Instance Method Details

#to_xmlObject



117
118
119
120
121
122
123
124
# File 'lib/nexpose/alert.rb', line 117

def to_xml
  xml = '<vulnFilter'
  xml << %Q( severityThreshold="#{@severity}")
  xml << %Q( confirmed="#{@confirmed}")
  xml << %Q( unconfirmed="#{@unconfirmed}")
  xml << %Q( potential="#{@potential}")
  xml << '/>'
end