Class: Nexpose::ScanFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/scan.rb,
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.



281
282
283
284
285
# File 'lib/nexpose/scan.rb', line 281

def initialize(scan_stop, scan_failed, scan_start)
  @scan_stop = scan_stop
  @scan_failed = scan_failed
  @scan_start = scan_start
end

Instance Attribute Details

#failObject

Scan events to alert on.



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

def fail
  @fail
end

#pauseObject

Scan events to alert on.



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

def pause
  @pause
end

#resumeObject

Scan events to alert on.



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

def resume
  @resume
end

#scan_failedObject (readonly)

Returns the value of attribute scan_failed.



278
279
280
# File 'lib/nexpose/scan.rb', line 278

def scan_failed
  @scan_failed
end

#scan_startObject (readonly)

Returns the value of attribute scan_start.



279
280
281
# File 'lib/nexpose/scan.rb', line 279

def scan_start
  @scan_start
end

#scan_stopObject (readonly)

Returns the value of attribute scan_stop.



277
278
279
# File 'lib/nexpose/scan.rb', line 277

def scan_stop
  @scan_stop
end

#startObject

Scan events to alert on.



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

def start
  @start
end

#stopObject

Scan events to alert on.



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

def stop
  @stop
end

Class Method Details

.parse(xml) ⇒ Object



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

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

#to_xmlObject



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

def to_xml
  xml = '<scanFilter'
  xml << %Q( scanStart="#{@start}")
  xml << %Q( scanStop="#{@stop}")
  xml << %Q( scanFailed="#{@fail}")
  xml << %Q( scanResumed="#{@resume}")
  xml << %Q( scanPaused="#{@pause}")
  xml << '/>'
end