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.



116
117
118
# File 'lib/nexpose/alert.rb', line 116

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.



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

def confirmed
  @confirmed
end

#potentialObject

Vulnerability events to alert on.



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

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


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

def severity
  @severity
end

#unconfirmedObject

Vulnerability events to alert on.



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

def unconfirmed
  @unconfirmed
end

Class Method Details

.parse(xml) ⇒ Object



133
134
135
136
137
138
# File 'lib/nexpose/alert.rb', line 133

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

#as_xmlObject



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

def as_xml
  xml = REXML::Element.new('vulnFilter')
  xml.attributes['severityThreshold'] = @severity
  xml.attributes['confirmed'] = @confirmed
  xml.attributes['unconfirmed'] = @unconfirmed
  xml.attributes['potential'] = @potential
  xml
end

#to_xmlObject



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

def to_xml
  as_xml.to_s
end