Merge branch 'task/MS-1354/OpenVAS-Nessus-Importer' of https://github.com/bpatterson-r7/metasploit-framework into bpatterson-r7-task/MS-1354/OpenVAS-Nessus-Importer
commit
5e8ed09b66
|
@ -254,6 +254,9 @@ module Msf::DBManager::Import
|
||||||
elsif (firstline.index("<scanJob>"))
|
elsif (firstline.index("<scanJob>"))
|
||||||
@import_filedata[:type] = "Retina XML"
|
@import_filedata[:type] = "Retina XML"
|
||||||
return :retina_xml
|
return :retina_xml
|
||||||
|
elsif (firstline.index(/<get_results_response status=['"]200['"] status_text=['"]OK['"]>/))
|
||||||
|
@import_filedata[:type] = "OpenVAS XML"
|
||||||
|
return :openvas_new_xml
|
||||||
elsif (firstline.index(/<get_reports_response status=['"]200['"] status_text=['"]OK['"]>/))
|
elsif (firstline.index(/<get_reports_response status=['"]200['"] status_text=['"]OK['"]>/))
|
||||||
@import_filedata[:type] = "OpenVAS XML"
|
@import_filedata[:type] = "OpenVAS XML"
|
||||||
return :openvas_new_xml
|
return :openvas_new_xml
|
||||||
|
@ -286,7 +289,7 @@ module Msf::DBManager::Import
|
||||||
@import_filedata[:type] = "Nmap XML"
|
@import_filedata[:type] = "Nmap XML"
|
||||||
return :nmap_xml
|
return :nmap_xml
|
||||||
when "openvas-report"
|
when "openvas-report"
|
||||||
@import_filedata[:type] = "OpenVAS Report"
|
@import_filedata[:type] = "OpenVAS"
|
||||||
return :openvas_xml
|
return :openvas_xml
|
||||||
when "NessusClientData"
|
when "NessusClientData"
|
||||||
@import_filedata[:type] = "Nessus XML (v1)"
|
@import_filedata[:type] = "Nessus XML (v1)"
|
||||||
|
|
|
@ -12,20 +12,22 @@ module Msf::DBManager::Import::Nessus
|
||||||
# Nessus NBE and NESSUS v1 methods
|
# Nessus NBE and NESSUS v1 methods
|
||||||
#
|
#
|
||||||
def handle_nessus(wspace, hobj, port, nasl, plugin_name, severity, data,task=nil)
|
def handle_nessus(wspace, hobj, port, nasl, plugin_name, severity, data,task=nil)
|
||||||
|
|
||||||
addr = hobj.address
|
addr = hobj.address
|
||||||
# The port section looks like:
|
# The port section looks like:
|
||||||
# http (80/tcp)
|
# http (80/tcp)
|
||||||
p = port.match(/^([^\(]+)\((\d+)\/([^\)]+)\)/)
|
p = port.match(/^([^\(]+)\((\d+)\/([^\)]+)\)/)
|
||||||
return if not p
|
|
||||||
|
|
||||||
# Unnecessary as the caller should already have reported this host
|
if p
|
||||||
#report_host(:workspace => wspace, :host => addr, :state => Msf::HostState::Alive)
|
name = p[1].strip
|
||||||
name = p[1].strip
|
port = p[2].to_i
|
||||||
port = p[2].to_i
|
proto = p[3].downcase
|
||||||
proto = p[3].downcase
|
else
|
||||||
|
port = nil
|
||||||
|
end
|
||||||
|
|
||||||
info = { :workspace => wspace, :host => hobj, :port => port, :proto => proto, :task => task }
|
info = { :workspace => wspace, :host => hobj, :port => port, :proto => proto, :task => task }
|
||||||
if name != "unknown" and name[-1,1] != "?"
|
if name and name != "unknown" and name[-1,1] != "?"
|
||||||
info[:name] = name
|
info[:name] = name
|
||||||
end
|
end
|
||||||
report_service(info)
|
report_service(info)
|
||||||
|
|
|
@ -29,6 +29,6 @@ module Msf::DBManager::Import::OpenVAS
|
||||||
filename = args[:filename]
|
filename = args[:filename]
|
||||||
wspace = args[:wspace] || workspace
|
wspace = args[:wspace] || workspace
|
||||||
|
|
||||||
raise Msf::DBImportError.new("No OpenVAS XML support. Please submit a patch to msfdev[at]metasploit.com")
|
raise Msf::DBImportError.new("No OpenVas XML support. Please submit a patch to msfdev[at]metasploit.com")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ require "rex/parser/nokogiri_doc_mixin"
|
||||||
module Rex
|
module Rex
|
||||||
module Parser
|
module Parser
|
||||||
|
|
||||||
# If Nokogiri is available, define OpenVAS document class.
|
# If Nokogiri is available, define OpenVas document class.
|
||||||
load_nokogiri && class OpenVASDocument < Nokogiri::XML::SAX::Document
|
load_nokogiri && class OpenVASDocument < Nokogiri::XML::SAX::Document
|
||||||
|
|
||||||
include NokogiriDocMixin
|
include NokogiriDocMixin
|
||||||
|
@ -37,8 +37,10 @@ module Parser
|
||||||
@state[:vuln_name] = @text.strip if @text
|
@state[:vuln_name] = @text.strip if @text
|
||||||
end
|
end
|
||||||
when 'description'
|
when 'description'
|
||||||
@state[:has_text] = true
|
if in_tag('result')
|
||||||
@state[:vuln_desc] = @text.strip if @text
|
@state[:has_text] = true
|
||||||
|
@state[:vuln_desc] = @text.strip if @text
|
||||||
|
end
|
||||||
when 'bid'
|
when 'bid'
|
||||||
if in_tag('result') && in_tag('nvt')
|
if in_tag('result') && in_tag('nvt')
|
||||||
@state[:has_text] = true
|
@state[:has_text] = true
|
||||||
|
@ -62,7 +64,7 @@ module Parser
|
||||||
when 'subnet'
|
when 'subnet'
|
||||||
@state[:has_text] = true
|
@state[:has_text] = true
|
||||||
when 'result'
|
when 'result'
|
||||||
record_vuln if in_tag('results')
|
record_vuln
|
||||||
when 'threat'
|
when 'threat'
|
||||||
@state[:has_text] = true if in_tag('ports') && in_tag('port')
|
@state[:has_text] = true if in_tag('ports') && in_tag('port')
|
||||||
when 'host'
|
when 'host'
|
||||||
|
|
Loading…
Reference in New Issue