From 28f8ac322f2c5917f6635e007915060d7f535cae Mon Sep 17 00:00:00 2001 From: Meatballs Date: Sat, 14 Dec 2013 21:30:52 +0000 Subject: [PATCH] Enable inject --- lib/msf/util/exe.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/msf/util/exe.rb b/lib/msf/util/exe.rb index 12b1242090..b7f7fa4fe4 100644 --- a/lib/msf/util/exe.rb +++ b/lib/msf/util/exe.rb @@ -469,14 +469,24 @@ require 'msf/core/exe/segment_injector' # Allow the user to specify their own DLL template set_template_default(opts, "template_x86_windows.dll") opts[:exe_type] = :dll - exe_sub_method(code,opts) + + if opts[:inject] + return self.to_win32pe(framework, code, opts) + else + return exe_sub_method(code,opts) + end end def self.to_win64pe_dll(framework, code, opts={}) # Allow the user to specify their own DLL template set_template_default(opts, "template_x64_windows.dll") opts[:exe_type] = :dll - exe_sub_method(code,opts) + + if opts[:inject] + raise RuntimeError, 'Template injection unsupported for x64 DLLs' + else + return exe_sub_method(code,opts) + end end # @@ -1610,6 +1620,7 @@ def self.to_vba(framework,code,opts={}) when ARCH_X86_64 then to_win64pe_dll(framework, code, exeopts) when ARCH_X64 then to_win64pe_dll(framework, code, exeopts) end + when 'exe' output = case arch when ARCH_X86,nil then to_win32pe(framework, code, exeopts)