Class: Nexpose::ScanFilter

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

Overview

Scan filter 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(start = 0, stop = 0, fail = 0, resume = 0, pause = 0) ⇒ ScanFilter

Returns a new instance of ScanFilter.



73
74
75
# File 'lib/nexpose/alert.rb', line 73

def initialize(start = 0, stop = 0, fail = 0, resume = 0, pause = 0)
  @start, @stop, @fail, @resume, @pause = start, stop, fail, resume, pause
end

Instance Attribute Details

#failObject

Scan events to alert on.



71
72
73
# File 'lib/nexpose/alert.rb', line 71

def fail
  @fail
end

#pauseObject

Scan events to alert on.



71
72
73
# File 'lib/nexpose/alert.rb', line 71

def pause
  @pause
end

#resumeObject

Scan events to alert on.



71
72
73
# File 'lib/nexpose/alert.rb', line 71

def resume
  @resume
end

#startObject

Scan events to alert on.



71
72
73
# File 'lib/nexpose/alert.rb', line 71

def start
  @start
end

#stopObject

Scan events to alert on.



71
72
73
# File 'lib/nexpose/alert.rb', line 71

def stop
  @stop
end

Class Method Details

.parse(xml) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/nexpose/alert.rb', line 91

def self.parse(xml)
  new(xml.attributes['scanStart'].to_i,
      xml.attributes['scanStop'].to_i,
      xml.attributes['scanFailed'].to_i,
      xml.attributes['scanResumed'].to_i,
      xml.attributes['scanPaused'].to_i)
end

Instance Method Details

#as_xmlObject



77
78
79
80
81
82
83
84
85
# File 'lib/nexpose/alert.rb', line 77

def as_xml
  xml = REXML::Element.new('scanFilter')
  xml.attributes['scanStart'] = @start
  xml.attributes['scanStop'] = @stop
  xml.attributes['scanFailed'] = @fail
  xml.attributes['scanResumed'] = @resume
  xml.attributes['scanPaused'] = @pause
  xml
end

#to_xmlObject



87
88
89
# File 'lib/nexpose/alert.rb', line 87

def to_xml
  as_xml.to_s
end