Parent

Class/Module Index [+]

Quicksearch

Rex::Parser::IP360ASPLXMLStreamParser

Attributes

on_found_aspl[RW]

Public Class Methods

new(&block) click to toggle source
# File lib/rex/parser/ip360_aspl_xml.rb, line 16
def initialize(&block)
        reset_state
        on_found_aspl = block if block
end

Public Instance Methods

attlist() click to toggle source
# File lib/rex/parser/ip360_aspl_xml.rb, line 98
def attlist; end
cdata() click to toggle source
# File lib/rex/parser/ip360_aspl_xml.rb, line 95
def cdata; end
comment(str) click to toggle source
# File lib/rex/parser/ip360_aspl_xml.rb, line 96
def comment(str); end
instruction(name, instruction) click to toggle source
# File lib/rex/parser/ip360_aspl_xml.rb, line 97
def instruction(name, instruction); end
reset_state() click to toggle source
# File lib/rex/parser/ip360_aspl_xml.rb, line 21
def reset_state
        @aspl = {'vulns' => {'name' => { }, 'cve' => { }, 'bid' => { } },
                'oses' => {'name' => { } } }
        @state = :generic_state
end
tag_end(name) click to toggle source
# File lib/rex/parser/ip360_aspl_xml.rb, line 64
def tag_end(name)
        case name
        when "ontology"
                on_found_aspl.call(@aspl) if on_found_aspl
                reset_state
        when "advisory"
                if (@x['pub'] =~ /CVE/)
                        if (@cfirst == 0)
                                @c += ","
                        end
                        @c += @x['refid']
                        @cfirst = 0
                elsif (@x['pub'] =~ /BugTraq/)
                        if (@bfirst == 0)
                                @b += ","
                        end
                        @b += @x['refid']
                        @bfirst = 0
                end
        when "advisories"
                @aspl['vulns']['cve'][@vulnid] = @c
                @aspl['vulns']['bid'][@vulnid] = @b
                @c = ""
                @b = ""
        end
        @state = :generic_state
end
tag_start(name, attributes) click to toggle source
# File lib/rex/parser/ip360_aspl_xml.rb, line 27
def tag_start(name, attributes)
        case name
        when "vulns"
                @location = "vulns"
        when "vuln"
                @vulnid = attributes['id'].strip
        when "name"
                @state = :is_name
        when "advisories"
                @c = ""
                @cfirst = 1
                @b = ""
                @bfirst = 1
                @x = Hash.new
        when "publisher"
                @state = :is_pub
        when "id"
                @state = :is_refid
        when "operatingSystems"
                @location = "os"
        when "operatingSystem"
                @osid = attributes['id'].strip
        end
end
text(str) click to toggle source
# File lib/rex/parser/ip360_aspl_xml.rb, line 52
def text(str)
        case @state
        when :is_name
                @aspl['vulns']['name'][@vulnid] = str if @location == "vulns"
                @aspl['oses'][@osid] = str if @location == "os"
        when :is_pub
                @x['pub'] = str
        when :is_refid
                @x['refid'] = str
        end
end
xmldecl(version, encoding, standalone) click to toggle source

We don't need these methods, but they're necessary to keep REXML happy

# File lib/rex/parser/ip360_aspl_xml.rb, line 94
def xmldecl(version, encoding, standalone); end

[Validate]

Generated with the Darkfish Rdoc Generator 2.