diff --git a/lib/metasploit/framework/data_service/proxy/data_proxy_auto_loader.rb b/lib/metasploit/framework/data_service/proxy/data_proxy_auto_loader.rb index d38a2e6cc9..4a8255bcfa 100644 --- a/lib/metasploit/framework/data_service/proxy/data_proxy_auto_loader.rb +++ b/lib/metasploit/framework/data_service/proxy/data_proxy_auto_loader.rb @@ -16,6 +16,7 @@ module DataProxyAutoLoader autoload :SessionEventDataProxy, 'metasploit/framework/data_service/proxy/session_event_data_proxy' autoload :CredentialDataProxy, 'metasploit/framework/data_service/proxy/credential_data_proxy' autoload :NmapDataProxy, 'metasploit/framework/data_service/proxy/nmap_data_proxy' + autoload :DbExportDataProxy, 'metasploit/framework/data_service/proxy/db_export_data_proxy' include ServiceDataProxy include HostDataProxy include VulnDataProxy @@ -29,4 +30,5 @@ module DataProxyAutoLoader include SessionEventDataProxy include CredentialDataProxy include NmapDataProxy + include DbExportDataProxy end \ No newline at end of file diff --git a/lib/metasploit/framework/data_service/remote/http/data_service_auto_loader.rb b/lib/metasploit/framework/data_service/remote/http/data_service_auto_loader.rb index 56bf7f63f7..f6b6766c37 100644 --- a/lib/metasploit/framework/data_service/remote/http/data_service_auto_loader.rb +++ b/lib/metasploit/framework/data_service/remote/http/data_service_auto_loader.rb @@ -15,6 +15,7 @@ module DataServiceAutoLoader autoload :RemoteSessionEventDataService, 'metasploit/framework/data_service/remote/http/remote_session_event_data_service' autoload :RemoteCredentialDataService, 'metasploit/framework/data_service/remote/http/remote_credential_data_service' autoload :RemoteNmapDataService, 'metasploit/framework/data_service/remote/http/remote_nmap_data_service' + autoload :RemoteDbExportDataService, 'metasploit/framework/data_service/remote/http/remote_db_export_data_service' include RemoteHostDataService include RemoteEventDataService include RemoteNoteDataService @@ -28,4 +29,5 @@ module DataServiceAutoLoader include RemoteSessionEventDataService include RemoteCredentialDataService include RemoteNmapDataService + include RemoteDbExportDataService end \ No newline at end of file diff --git a/lib/msf/core/db_export.rb b/lib/msf/core/db_export.rb index bd5449ba98..189e844695 100644 --- a/lib/msf/core/db_export.rb +++ b/lib/msf/core/db_export.rb @@ -35,10 +35,10 @@ class Export def to_pwdump_file(path, &block) exporter = Metasploit::Credential::Exporter::Pwdump.new(workspace: workspace) - File.open(path, 'w') do |file| + output_file = File.open(path, 'w') do |file| file << exporter.rendered_output end - true + output_file.path end @@ -107,7 +107,7 @@ class Export yield(:status, "complete", "report") if block_given? - true + report_file.path end # A convenience function that bundles together host, event, and service extraction. diff --git a/lib/msf/core/db_manager.rb b/lib/msf/core/db_manager.rb index d335fcd910..cf780bb525 100644 --- a/lib/msf/core/db_manager.rb +++ b/lib/msf/core/db_manager.rb @@ -32,6 +32,7 @@ class Msf::DBManager autoload :Client, 'msf/core/db_manager/client' autoload :Connection, 'msf/core/db_manager/connection' autoload :Cred, 'msf/core/db_manager/cred' + autoload :DbExport, 'msf/core/db_manager/db_export' autoload :Event, 'msf/core/db_manager/event' autoload :ExploitAttempt, 'msf/core/db_manager/exploit_attempt' autoload :ExploitedHost, 'msf/core/db_manager/exploited_host' @@ -68,6 +69,7 @@ class Msf::DBManager include Msf::DBManager::Client include Msf::DBManager::Connection include Msf::DBManager::Cred + include Msf::DBManager::DbExport include Msf::DBManager::Event include Msf::DBManager::ExploitAttempt include Msf::DBManager::ExploitedHost diff --git a/lib/msf/core/db_manager/http/sinatra_app.rb b/lib/msf/core/db_manager/http/sinatra_app.rb index 1d706eeb21..622201d9a2 100644 --- a/lib/msf/core/db_manager/http/sinatra_app.rb +++ b/lib/msf/core/db_manager/http/sinatra_app.rb @@ -14,6 +14,7 @@ require 'msf/core/db_manager/http/servlet/loot_servlet' require 'msf/core/db_manager/http/servlet/session_event_servlet' require 'msf/core/db_manager/http/servlet/credential_servlet' require 'msf/core/db_manager/http/servlet/nmap_servlet' +require 'msf/core/db_manager/http/servlet/db_export_servlet' class SinatraApp < Sinatra::Base @@ -34,4 +35,5 @@ class SinatraApp < Sinatra::Base register SessionEventServlet register CredentialServlet register NmapServlet + register DbExportServlet end \ No newline at end of file diff --git a/lib/msf/ui/console/command_dispatcher/db.rb b/lib/msf/ui/console/command_dispatcher/db.rb index bdcdbd1d5a..fcc0dd08da 100644 --- a/lib/msf/ui/console/command_dispatcher/db.rb +++ b/lib/msf/ui/console/command_dispatcher/db.rb @@ -1504,18 +1504,19 @@ module Msf end print_status("Starting export of workspace #{framework.db.workspace.name} to #{output} [ #{format} ]...") - exporter = ::Msf::DBManager::Export.new(framework.db.workspace) - - exporter.send("to_#{format}_file".intern,output) do |mtype, mstatus, mname| - if mtype == :status - if mstatus == "start" - print_status(" >> Starting export of #{mname}") - end - if mstatus == "complete" - print_status(" >> Finished export of #{mname}") - end - end - end + # exporter = ::Msf::DBManager::Export.new(framework.db.workspace) + # + # exporter.send("to_#{format}_file".intern,output) do |mtype, mstatus, mname| + # if mtype == :status + # if mstatus == "start" + # print_status(" >> Starting export of #{mname}") + # end + # if mstatus == "complete" + # print_status(" >> Finished export of #{mname}") + # end + # end + # end + framework.db.run_db_export(output, format) print_status("Finished export of workspace #{framework.db.workspace.name} to #{output} [ #{format} ]...") } end