a6795c4714
git-svn-id: file:///home/svn/framework3/trunk@9340 4d416f70-5f16-0410-b530-b9f4589650da
48 lines
887 B
Ruby
48 lines
887 B
Ruby
##
|
|
# $Id$
|
|
##
|
|
|
|
###
|
|
#
|
|
# This module exposes a simple method to create an payload in an executable.
|
|
#
|
|
###
|
|
|
|
module Msf
|
|
module Exploit::EXE
|
|
|
|
def initialize(info = {})
|
|
super
|
|
|
|
register_options(
|
|
[
|
|
OptString.new( 'EXETEMPLATE', [ false, 'The executable template file name.' ]),
|
|
OptBool.new( 'EXEINJECT', [ false, 'Set to preserve the original EXE function' ])
|
|
], Msf::Exploit::EXE)
|
|
end
|
|
|
|
def generate_exe(opts = {})
|
|
if (altexe = datastore['EXETEMPLATE'])
|
|
opts.merge!({ :template => altexe })
|
|
end
|
|
if (datastore['EXEINJECT'])
|
|
opts.merge!({ :inject => true })
|
|
end
|
|
|
|
# Default to X86
|
|
if arch.length < 1
|
|
arch << ARCH_X86
|
|
end
|
|
|
|
# Transform the PlatformList
|
|
plat = platform
|
|
if (platform.kind_of? Msf::Module::PlatformList)
|
|
plat = platform.platforms
|
|
end
|
|
|
|
Msf::Util::EXE.to_executable(framework, arch, plat, payload.encoded, opts)
|
|
end
|
|
|
|
end
|
|
end
|