make exe template names more consistent

git-svn-id: file:///home/svn/framework3/trunk@10065 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Joshua Drake 2010-08-19 21:08:51 +00:00
parent ec169b9722
commit 2545410bc7
12 changed files with 19 additions and 11 deletions

View File

@ -1,3 +1,11 @@
#
# XXX: NOTE: this will only compile the x86 version.
#
# To compile the x64 version, use:
# C:\> call "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" amd64
# C:\> cl.exe -LD /Zl /GS- /DBUILDMODE=2 /link /entry:DllMain kernel32.lib
#
if [ -z "$PREFIX" ]; then
PREFIX=i586-mingw32msvc
fi
@ -7,10 +15,10 @@ $PREFIX-gcc -c template.c
$PREFIX-windres -o rc.o template.rc
$PREFIX-gcc -mdll -o junk.tmp -Wl,--base-file,base.tmp template.o rc.o
rm -f junk.tmp
$PREFIX-dlltool --dllname template.dll --base-file base.tmp --output-exp temp.exp --def template.def
$PREFIX-dlltool --dllname template_x86_windows.dll --base-file base.tmp --output-exp temp.exp --def template.def
rm -f base.tmp
$PREFIX-gcc -mdll -o template.dll template.o rc.o -Wl,temp.exp
$PREFIX-gcc -mdll -o template_x86_windows.dll template.o rc.o -Wl,temp.exp
rm -f temp.exp
$PREFIX-strip template.dll
$PREFIX-strip template_x86_windows.dll
rm -f *.o

View File

@ -292,7 +292,7 @@
/>
<Tool
Name="VCLinkerTool"
OutputFile="../../../../service_x64.exe"
OutputFile="../../../../template_x64_windows_svc.exe"
LinkIncremental="1"
GenerateManifest="false"
GenerateDebugInformation="false"

0
data/templates/template_armle_linux.bin Normal file → Executable file
View File

0
data/templates/template_x64_windows.dll Executable file → Normal file
View File

0
data/templates/template_x64_windows.exe Normal file → Executable file
View File

View File

@ -78,7 +78,7 @@ require 'metasm'
def self.to_win32pe(framework, code, opts={})
# Allow the user to specify their own EXE template
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "template.exe")
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "template_x86_windows.exe")
# Copy the code to a new RWX segment to allow for self-modifying encoders
payload = win32_rwx_exec(code)
@ -170,7 +170,7 @@ require 'metasm'
end
if(not text)
raise RuntimeError, "No .text section found in the template exe"
raise RuntimeError, "No .text section found in the template_x86_windows.exe"
end
if ! text.contains_rva?(pe.hdr.opt.AddressOfEntryPoint)
@ -280,7 +280,7 @@ require 'metasm'
def self.to_win32pe_old(framework, code, opts={})
# Allow the user to specify their own EXE template
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "template-old.exe")
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "template_x86_windows_old.exe")
pe = ''
File.open(opts[:template], "rb") { |fd|
@ -344,7 +344,7 @@ require 'metasm'
name = opts[:servicename] || 'SERVICENAME'
# Allow the user to specify their own service EXE template
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "service.exe")
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "template_x86_windows_svc.exe")
pe = ''
File.open(opts[:template], 'rb') { |fd|
@ -367,7 +367,7 @@ require 'metasm'
def self.to_win64pe_service(framework, code, opts={})
# Allow the user to specify their own service EXE template
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "service_x64.exe")
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "template_x64_windows_svc.exe")
pe = ''
File.open(opts[:template], "rb") { |fd|
@ -390,7 +390,7 @@ require 'metasm'
def self.to_win32pe_dll(framework, code, opts={})
# Allow the user to specify their own DLL template
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "template.dll")
opts[:template] ||= File.join(File.dirname(__FILE__), "..", "..", "..", "data", "templates", "template_x86_windows.dll")
pe = ''
File.open(opts[:template], "rb") { |fd|

View File

@ -104,7 +104,7 @@ class Metasploit3 < Msf::Exploit::Remote
register_advanced_options(
[
OptString.new('SaveToFile', [ false, "When set, source is saved to this directory under external/source/", nil ]),
OptString.new('Template', [ true, "The default executable template to use", File.join(Msf::Config.install_root, "data", "templates", "template.exe") ]),
OptString.new('Template', [ true, "The default executable template to use", File.join(Msf::Config.install_root, "data", "templates", "template_x86_windows.exe") ]),
OptString.new('InsertPayload', [ false, "Inject payload into template without affecting executable behavior", nil ])
], self.class)
end