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.



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

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.



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

def confirmed
  @confirmed
end

#potentialObject

Vulnerability events to alert on.



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

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


104
105
106
# File 'lib/nexpose/alert.rb', line 104

def severity
  @severity
end

#unconfirmedObject

Vulnerability events to alert on.



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

def unconfirmed
  @unconfirmed
end

Class Method Details

.parse(xml) ⇒ Object



122
123
124
125
126
127
# File 'lib/nexpose/alert.rb', line 122

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



113
114
115
116
117
118
119
120
# File 'lib/nexpose/alert.rb', line 113

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