Add Outpost24 importer code to core/db.rb
parent
41ab4739e3
commit
38965f91ee
|
@ -41,6 +41,7 @@ require 'rex/parser/nexpose_simple_nokogiri'
|
|||
require 'rex/parser/nmap_nokogiri'
|
||||
require 'rex/parser/openvas_nokogiri'
|
||||
require 'rex/parser/wapiti_nokogiri'
|
||||
require 'rex/parser/outpost24_nokogiri'
|
||||
|
||||
# Legacy XML parsers -- these will be converted some day
|
||||
require 'rex/parser/ip360_aspl_xml'
|
||||
|
@ -2926,7 +2927,7 @@ class DBManager
|
|||
# Returns one of: :nexpose_simplexml :nexpose_rawxml :nmap_xml :openvas_xml
|
||||
# :nessus_xml :nessus_xml_v2 :qualys_scan_xml, :qualys_asset_xml, :msf_xml :nessus_nbe :amap_mlog
|
||||
# :amap_log :ip_list, :msf_zip, :libpcap, :foundstone_xml, :acunetix_xml, :appscan_xml
|
||||
# :burp_session, :ip360_xml_v3, :ip360_aspl_xml, :nikto_xml
|
||||
# :burp_session, :ip360_xml_v3, :ip360_aspl_xml, :nikto_xml, :outpost24_xml
|
||||
# If there is no match, an error is raised instead.
|
||||
def import_filetype_detect(data)
|
||||
|
||||
|
@ -3059,6 +3060,9 @@ class DBManager
|
|||
@import_filedata[:type] = "CI"
|
||||
return :ci_xml
|
||||
end
|
||||
when "main"
|
||||
@import_filedata[:type] = "Outpost24 XML"
|
||||
return :outpost24_xml
|
||||
else
|
||||
# Give up if we haven't hit the root tag in the first few lines
|
||||
break if line_count > 10
|
||||
|
@ -5923,6 +5927,36 @@ class DBManager
|
|||
parser.parse(args[:data])
|
||||
end
|
||||
|
||||
def import_outpost24_xml(args={}, &block)
|
||||
bl = validate_ips(args[:blacklist]) ? args[:blacklist].split : []
|
||||
wspace = args[:wspace] || workspace
|
||||
if Rex::Parser.nokogiri_loaded
|
||||
parser = "Nokogiri v#{::Nokogiri::VERSION}"
|
||||
noko_args = args.dup
|
||||
noko_args[:blacklist] = bl
|
||||
noko_args[:wspace] = wspace
|
||||
if block
|
||||
yield(:parser, parser)
|
||||
import_outpost24_noko_stream(noko_args) {|type, data| yield type,data}
|
||||
else
|
||||
import_outpost24_noko_stream(noko_args)
|
||||
end
|
||||
return true
|
||||
else # Sorry
|
||||
raise DBImportError.new("Could not import due to missing Nokogiri parser. Try 'gem install nokogiri'.")
|
||||
end
|
||||
end
|
||||
|
||||
def import_outpost24_noko_stream(args={},&block)
|
||||
if block
|
||||
doc = Rex::Parser::Outpost24Document.new(args,framework.db) {|type, data| yield type,data }
|
||||
else
|
||||
doc = Rex::Parser::Outpost24Document.new(args,self)
|
||||
end
|
||||
parser = ::Nokogiri::XML::SAX::Parser.new(doc)
|
||||
parser.parse(args[:data])
|
||||
end
|
||||
|
||||
|
||||
def unserialize_object(xml_elem, allow_yaml = false)
|
||||
return nil unless xml_elem
|
||||
|
|
Loading…
Reference in New Issue