From df9ec8a08c8dcd08ef539d9ca44a71c6b8628abd Mon Sep 17 00:00:00 2001 From: HD Moore Date: Mon, 3 May 2010 01:49:00 +0000 Subject: [PATCH] Updates to the nessus parser. Closes #1715 git-svn-id: file:///home/svn/framework3/trunk@9211 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/db.rb | 51 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/lib/msf/core/db.rb b/lib/msf/core/db.rb index 9bcc8f69e8..7754983eab 100644 --- a/lib/msf/core/db.rb +++ b/lib/msf/core/db.rb @@ -1765,6 +1765,36 @@ class DBManager addr = host.attribute("name").value end + os = host.elements["HostProperties/tag[@name='operating-system']"] + if os + report_note( + :workspace => wspace, + :host => addr, + :type => 'host.os.nessus_fingerprint', + :data => { + :os => os.text.to_s.strip + } + ) + end + + hname = host.elements["HostProperties/tag[@name='host-fqdn']"] + if hname + report_host( + :workspace => wspace, + :host => addr, + :name => hname.text.to_s.strip + ) + end + + mac = host.elements["HostProperties/tag[@name='mac-address']"] + if mac + report_host( + :workspace => wspace, + :host => addr, + :mac => mac.text.to_s.strip.upcase + ) + end + host.elements.each('ReportItem') do |item| nasl = item.attribute('pluginID').value port = item.attribute('port').value @@ -1964,7 +1994,8 @@ protected :proto => proto, :name => nss, :data => data, - :refs => refs) + :refs => refs + ) end # @@ -1980,7 +2011,9 @@ protected info[:name] = name end - report_service(info) + if port.to_i != 0 + report_service(info) + end return if nasl == "0" @@ -2002,14 +2035,20 @@ protected nss = 'NSS-' + nasl - report_vuln( + vuln = { :workspace => wspace, :host => addr, - :port => port, - :proto => proto, :name => nss, :data => description ? description.text : "", - :refs => refs) + :refs => refs + } + + if port.to_i != 0 + vuln[:port] = port + vuln[:proto] = proto + end + + report_vuln(vuln) end #