diff --git a/lib/msf/core/db_export.rb b/lib/msf/core/db_export.rb index a4450d3d2e..a5ab5f7087 100644 --- a/lib/msf/core/db_export.rb +++ b/lib/msf/core/db_export.rb @@ -255,6 +255,13 @@ class Export extract_web_vuln_info(report_file) report_file.write %Q|\n| + yield(:status, "start", "module details") if block_given? + report_file.write %Q|\n| + report_file.flush + extract_module_detail_info(report_file) + report_file.write %Q|\n| + + report_file.write %Q|\n| report_file.flush report_file.close @@ -350,6 +357,96 @@ class Export return el end + + def extract_module_detail_info(report_file) + Mdm::ModuleDetail.all.each do |m| + report_file.write("\n") + m_id = m.attributes["id"] + + # Module attributes + m.attributes.each_pair do |k,v| + el = create_xml_element(k,v) + report_file.write(" #{el}\n") # Not checking types + end + + # Authors sub-elements + report_file.write(" \n") + m.authors.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") + + # Refs sub-elements + report_file.write(" \n") + m.refs.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") + + + # Archs sub-elements + report_file.write(" \n") + m.archs.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") + + + # Platforms sub-elements + report_file.write(" \n") + m.platforms.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") + + + # Targets sub-elements + report_file.write(" \n") + m.targets.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") + + # Actions sub-elements + report_file.write(" \n") + m.actions.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") + + # Mixins sub-elements + report_file.write(" \n") + m.mixins.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.flush + end + # ActiveRecord's to_xml is easy and wrong. This isn't, on both counts. def extract_host_info(report_file) @hosts.each do |h| @@ -372,6 +469,16 @@ class Export end report_file.write(" \n") + # Host exploit attempts sub-elements + report_file.write(" \n") + h.exploit_attempts.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| diff --git a/lib/msf/core/db_manager.rb b/lib/msf/core/db_manager.rb index e58bcb4c1c..51f200fb6f 100644 --- a/lib/msf/core/db_manager.rb +++ b/lib/msf/core/db_manager.rb @@ -392,7 +392,7 @@ class DBManager when :ref md.add_ref(vals[:name]) when :mixin - md.add_ref(vals[:name]) + # md.add_mixin(vals[:name]) end end