From 562a62412737bf6fe32c6473b2bff4a0560ee422 Mon Sep 17 00:00:00 2001 From: Matt Weeks Date: Wed, 24 Aug 2011 20:25:28 +0000 Subject: [PATCH] Fix issues with undefined or incorrect variables, and update encoding opts. git-svn-id: file:///home/svn/framework3/trunk@13621 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/rpc/v10/rpc_module.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/msf/core/rpc/v10/rpc_module.rb b/lib/msf/core/rpc/v10/rpc_module.rb index d298ff47f9..ee5388fd10 100644 --- a/lib/msf/core/rpc/v10/rpc_module.rb +++ b/lib/msf/core/rpc/v10/rpc_module.rb @@ -166,7 +166,7 @@ class RPC_Module < RPC_Base platform = nil if options['platform'] - platform = Msf::Module::PlatformList.transform(platform) + platform = Msf::Module::PlatformList.transform(options['platform']) end arch = nil @@ -185,18 +185,27 @@ class RPC_Module < RPC_Base :template_path => options['exedir'] } + # If we were given addshellcode for a win32 payload, + # create a double-payload; one running in one thread, one running in the other + if options['addshellcode'] + buf = Msf::Util::EXE.win32_rwx_exec_thread(buf,0,'end') + file = ::File.new(options['addshellcode']) + file.binmode + buf << file.read + file.close + end + enc = self.framework.encoders.create(encoder) begin # Imports options enc.datastore.update(options) - eout = buf.dup - raw = nil + raw = data.dup 1.upto(ecount) do |iteration| # Encode it up - raw = enc.encode(eout, badchars, nil, plat) + raw = enc.encode(raw, badchars, nil, platform) end output = Msf::Util::EXE.to_executable_fmt(self.framework, arch, platform, raw, fmt, exeopts)