From 465998bc17f3fb5a200230f1c7d9495ffeff4073 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Fri, 8 Jun 2012 22:55:55 -0500 Subject: [PATCH] Export host_details and vuln_details, add missing refs to db_export --- lib/msf/core/db.rb | 6 ++++++ lib/msf/core/db_export.rb | 30 ++++++++++++++++++++++++++++++ lib/msf/core/db_manager.rb | 2 +- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/lib/msf/core/db.rb b/lib/msf/core/db.rb index 65217cf5b4..16a0a4d5e9 100644 --- a/lib/msf/core/db.rb +++ b/lib/msf/core/db.rb @@ -3393,6 +3393,12 @@ class DBManager } host_address = host_data[:host].dup # Preserve after report_host() deletes hobj = report_host(host_data) + + # XXX: HOST_DETAILS + host.elements["host_details"].each do |hdet| + hdet_data = {} + end + host.elements.each('services/service') do |service| service_data = {} service_data[:workspace] = wspace diff --git a/lib/msf/core/db_export.rb b/lib/msf/core/db_export.rb index c83e932cfa..13dfbf67af 100644 --- a/lib/msf/core/db_export.rb +++ b/lib/msf/core/db_export.rb @@ -362,6 +362,16 @@ class Export report_file.write(" #{el}\n") # Not checking types end + # Host details sub-elements + report_file.write(" \n") + h.host_details.find(:all).each do |d| + d.attributes.each_pair do |k,v| + el = create_xml_element(k,v) + report_file.write(" #{el}\n") + end + end + report_file.write(" \n") + # Service sub-elements report_file.write(" \n") @services.find_all_by_host_id(host_id).each do |e| @@ -394,6 +404,26 @@ class Export el = create_xml_element(k,v) report_file.write(" #{el}\n") end + + # References + report_file.write(" \n") + e.refs.each do |ref| + el = create_xml_element("ref",ref.name) + report_file.write(" #{el}\n") + end + report_file.write(" \n") + + + # Vuln details sub-elements + report_file.write(" \n") + e.vuln_details.find(:all).each do |d| + d.attributes.each_pair do |k,v| + el = create_xml_element(k,v) + report_file.write(" #{el}\n") + end + end + report_file.write(" \n") + report_file.write(" \n") end report_file.write(" \n") diff --git a/lib/msf/core/db_manager.rb b/lib/msf/core/db_manager.rb index ff6cde05c0..1840ebe0e3 100644 --- a/lib/msf/core/db_manager.rb +++ b/lib/msf/core/db_manager.rb @@ -302,7 +302,7 @@ class DBManager success = false end - ::FileUtils.rm_rf(temp_dir) + # ::FileUtils.rm_rf(temp_dir) return true end