Add product info to hosts and services :)

bug/bundler_fix
William Vu 2013-10-17 16:18:27 -05:00
parent 06c7943f54
commit 12151650e4
1 changed files with 14 additions and 2 deletions

View File

@ -10,6 +10,8 @@ load_nokogiri && class Outpost24Document < Nokogiri::XML::SAX::Document
def start_element(name, attrs)
@state[:current_tag][name] = true
case name
when "report"
@state[:has_text] = true
when "hostlist"
@report_data[:hosts] = []
when "portlist"
@ -56,6 +58,8 @@ load_nokogiri && class Outpost24Document < Nokogiri::XML::SAX::Document
def end_element(name)
case name
when "report"
collect_product
when "hostlist"
report_hosts
when "portlist"
@ -102,10 +106,17 @@ load_nokogiri && class Outpost24Document < Nokogiri::XML::SAX::Document
@state[:current_tag].delete(name)
end
def collect_product
@state[:has_text] = false
@state[:pinfo] = @text.strip if @text
@text = nil
end
def collect_host
@host[:host] = @state[:host]
@host[:name] = @state[:hname]
@host[:os_name] = @state[:os_name]
@host[:info] = @state[:pinfo]
@report_data[:hosts] << @host
end
@ -114,13 +125,14 @@ load_nokogiri && class Outpost24Document < Nokogiri::XML::SAX::Document
@service[:port] = @state[:port]
@service[:proto] = @state[:proto]
@service[:name] = @state[:sname]
@service[:info] = @state[:pinfo]
@report_data[:services] << @service
end
def collect_vuln
@vuln[:host] = @state[:host]
@vuln[:name] = @state[:vname]
@vuln[:info] = @state[:info]
@vuln[:info] = @state[:vinfo]
@vuln[:refs] = @refs
@report_data[:vulns] << @vuln
end
@ -162,7 +174,7 @@ load_nokogiri && class Outpost24Document < Nokogiri::XML::SAX::Document
if name == "name"
@state[:vname] = @text.strip if @text
elsif name == "description"
@state[:info] = @text.strip if @text
@state[:vinfo] = @text.strip if @text
elsif name == "id"
@state[:ref] = @text.strip if @text
@refs << normalize_ref("CVE", @state[:ref])