class Risu::Parsers::Nexpose::SimpleNexpose
Constants
- VALID_FINGERPRINTS
Public Class Methods
new()
click to toggle source
@TODO comment
# File lib/risu/parsers/nexpose/simple_nexpose.rb, line 42 def initialize @vals = Hash.new @report = Report.create end
Public Instance Methods
on_characters(text)
click to toggle source
Called when the inner text of a element is reached
@param text
# File lib/risu/parsers/nexpose/simple_nexpose.rb, line 71 def on_characters(text) if @vals[@tag] == nil then @vals[@tag] = text else @vals[@tag] << text end end
on_end_element(element)
click to toggle source
Called when the end of the XML element is reached
@param element
# File lib/risu/parsers/nexpose/simple_nexpose.rb, line 82 def on_end_element(element) @tag = nil case element when "device" @in_device = false when "description" if @in_device && @in_fingerprint @rh.attributes = { VALID_FINGERPRINTS[element] => @vals[element].gsub("\n", ",") } if VALID_FINGERPRINTS.key?(element) @rh.save end when "fingerprint" @in_fingerprint = false end end
on_start_element(element, attributes)
click to toggle source
@TODO comment
# File lib/risu/parsers/nexpose/simple_nexpose.rb, line 50 def on_start_element(element, attributes) @tag = element @vals[@tag] = "" puts element case element when "device" @in_device = true @rh = @report.hosts.create @rh.name = attributes["address"] @rh.ip = attributes["address"] @rh.save when "fingerprint" @in_fingerprint = true end end