WIP: port db_export command

GSoC/Meterpreter_Web_Console
James Barnett 2018-03-06 15:15:27 -06:00
parent 4f6b1de9a3
commit c058d0fba0
No known key found for this signature in database
GPG Key ID: 647983861A4EC5EA
6 changed files with 24 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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