From 98401072e55ed0531e403453de88190f2d5ee349 Mon Sep 17 00:00:00 2001 From: Matthew Kienow Date: Mon, 25 Mar 2019 13:38:32 -0400 Subject: [PATCH 1/5] Remove duplicate autoload for WebDataProxy --- .../framework/data_service/proxy/data_proxy_auto_loader.rb | 1 - 1 file changed, 1 deletion(-) 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 765edce774..c0e0cd2649 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 @@ -8,7 +8,6 @@ module DataProxyAutoLoader autoload :WorkspaceDataProxy, 'metasploit/framework/data_service/proxy/workspace_data_proxy' autoload :NoteDataProxy, 'metasploit/framework/data_service/proxy/note_data_proxy' autoload :WebDataProxy, 'metasploit/framework/data_service/proxy/web_data_proxy' - autoload :WebDataProxy, 'metasploit/framework/data_service/proxy/web_data_proxy' autoload :ServiceDataProxy, 'metasploit/framework/data_service/proxy/service_data_proxy' autoload :SessionDataProxy, 'metasploit/framework/data_service/proxy/session_data_proxy' autoload :ExploitDataProxy, 'metasploit/framework/data_service/proxy/exploit_data_proxy' From 6709780817f9df56b7c489cea836a4eef2995708 Mon Sep 17 00:00:00 2001 From: Matthew Kienow Date: Mon, 25 Mar 2019 13:43:16 -0400 Subject: [PATCH 2/5] Add entry to autoload PayloadDataProxy --- .../framework/data_service/proxy/data_proxy_auto_loader.rb | 2 ++ 1 file changed, 2 insertions(+) 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 c0e0cd2649..bc52eddbb6 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 @@ -20,6 +20,7 @@ module DataProxyAutoLoader autoload :DbImportDataProxy, 'metasploit/framework/data_service/proxy/db_import_data_proxy' autoload :VulnAttemptDataProxy, 'metasploit/framework/data_service/proxy/vuln_attempt_data_proxy' autoload :MsfDataProxy, 'metasploit/framework/data_service/proxy/msf_data_proxy' + autoload :PayloadDataProxy, 'metasploit/framework/data_service/proxy/payload_data_proxy' include ServiceDataProxy include HostDataProxy @@ -39,4 +40,5 @@ module DataProxyAutoLoader include DbImportDataProxy include VulnAttemptDataProxy include MsfDataProxy + include PayloadDataProxy end \ No newline at end of file From 6278563f25f498af1d73e003290b778555c6636b Mon Sep 17 00:00:00 2001 From: Matthew Kienow Date: Mon, 25 Mar 2019 19:38:28 -0400 Subject: [PATCH 3/5] Remove unused code --- lib/msf/core/payload/uuid/options.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/msf/core/payload/uuid/options.rb b/lib/msf/core/payload/uuid/options.rb index b2af6e9edb..c526bdcd44 100644 --- a/lib/msf/core/payload/uuid/options.rb +++ b/lib/msf/core/payload/uuid/options.rb @@ -92,9 +92,7 @@ module Msf::Payload::UUID::Options arch: uuid.arch, platform: uuid.platform, timestamp: uuid.timestamp, - workspace: framework.db.workspace, - # payload: self.fullname, - # datastore: self.datastore + workspace: framework.db.workspace }) if datastore['PayloadUUIDSeed'].to_s.length > 0 From 1b86c41dcc780cc532416f54c908d67d958c3c0c Mon Sep 17 00:00:00 2001 From: Matthew Kienow Date: Mon, 25 Mar 2019 19:39:25 -0400 Subject: [PATCH 4/5] Add add_opts_workspace call to query and create --- .../framework/data_service/proxy/payload_data_proxy.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/metasploit/framework/data_service/proxy/payload_data_proxy.rb b/lib/metasploit/framework/data_service/proxy/payload_data_proxy.rb index 955ec42a24..581f025991 100644 --- a/lib/metasploit/framework/data_service/proxy/payload_data_proxy.rb +++ b/lib/metasploit/framework/data_service/proxy/payload_data_proxy.rb @@ -3,6 +3,7 @@ module PayloadDataProxy def payloads(opts) begin self.data_service_operation do |data_service| + add_opts_workspace(opts) data_service.payloads(opts) end rescue => e @@ -13,6 +14,7 @@ module PayloadDataProxy def create_payload(opts) begin self.data_service_operation do |data_service| + add_opts_workspace(opts) data_service.create_payload(opts) end rescue => e From dc3be3378d3a1e74caeb47e9fd86e9d54d2d5020 Mon Sep 17 00:00:00 2001 From: Matthew Kienow Date: Mon, 25 Mar 2019 19:41:51 -0400 Subject: [PATCH 5/5] Process workspace for use in the create operation --- lib/msf/core/db_manager/payload.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/msf/core/db_manager/payload.rb b/lib/msf/core/db_manager/payload.rb index 4dda205b3a..296f65383e 100644 --- a/lib/msf/core/db_manager/payload.rb +++ b/lib/msf/core/db_manager/payload.rb @@ -8,7 +8,8 @@ module Msf::DBManager::Payload end end - Mdm::Payload.create!(opts) + wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework) + wspace.payloads.create!(opts) end end