From 12151650e49425ce95075a729081be7519977326 Mon Sep 17 00:00:00 2001 From: William Vu Date: Thu, 17 Oct 2013 16:18:27 -0500 Subject: [PATCH] Add product info to hosts and services :) --- lib/rex/parser/outpost24_nokogiri.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/rex/parser/outpost24_nokogiri.rb b/lib/rex/parser/outpost24_nokogiri.rb index 61a4b2b255..b150189513 100644 --- a/lib/rex/parser/outpost24_nokogiri.rb +++ b/lib/rex/parser/outpost24_nokogiri.rb @@ -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])