diff --git a/lib/msf/core/db_manager/import.rb b/lib/msf/core/db_manager/import.rb index 783e6c3fb2..27c2ff2cda 100644 --- a/lib/msf/core/db_manager/import.rb +++ b/lib/msf/core/db_manager/import.rb @@ -413,27 +413,6 @@ module Msf::DBManager::Import end end - # - # Import Nessus XML v1 and v2 output - # - # Old versions of openvas exported this as well - # - def import_nessus_xml_file(args={}) - filename = args[:filename] - wspace = args[:wspace] || workspace - - data = "" - ::File.open(filename, 'rb') do |f| - data = f.read(f.stat.size) - end - - if data.index("NessusClientData_v2") - import_nessus_xml_v2(args.merge(:data => data)) - else - import_nessus_xml(args.merge(:data => data)) - end - end - def import_nessus_xml_v2(args={}, &block) data = args[:data] wspace = args[:wspace] || workspace diff --git a/lib/msf/core/db_manager/import/nessus.rb b/lib/msf/core/db_manager/import/nessus.rb index 488c99703d..0479e10b10 100644 --- a/lib/msf/core/db_manager/import/nessus.rb +++ b/lib/msf/core/db_manager/import/nessus.rb @@ -1,5 +1,7 @@ module Msf::DBManager::Import::Nessus autoload :NBE, 'msf/core/db_manager/import/nessus/nbe' + autoload :XML, 'msf/core/db_manager/import/nessus/xml' include Msf::DBManager::Import::Nessus::NBE + include Msf::DBManager::Import::Nessus::XML end \ No newline at end of file diff --git a/lib/msf/core/db_manager/import/nessus/xml.rb b/lib/msf/core/db_manager/import/nessus/xml.rb new file mode 100644 index 0000000000..ceb8d13bcb --- /dev/null +++ b/lib/msf/core/db_manager/import/nessus/xml.rb @@ -0,0 +1,22 @@ +module Msf::DBManager::Import::Nessus::XML + # + # Import Nessus XML v1 and v2 output + # + # Old versions of openvas exported this as well + # + def import_nessus_xml_file(args={}) + filename = args[:filename] + wspace = args[:wspace] || workspace + + data = "" + ::File.open(filename, 'rb') do |f| + data = f.read(f.stat.size) + end + + if data.index("NessusClientData_v2") + import_nessus_xml_v2(args.merge(:data => data)) + else + import_nessus_xml(args.merge(:data => data)) + end + end +end