Merge branch 'osx_x64_bin_template' of https://github.com/argp/metasploit-framework into argp-osx_x64_bin_template

unstable
sinn3r 2012-02-06 10:33:33 -06:00
commit b03e752fab
2 changed files with 27 additions and 1 deletions

Binary file not shown.

View File

@ -95,6 +95,10 @@ require 'digest/sha1'
if (plat.index(Msf::Module::Platform::Linux)) if (plat.index(Msf::Module::Platform::Linux))
return to_linux_x64_elf(framework, code, opts) return to_linux_x64_elf(framework, code, opts)
end end
if (plat.index(Msf::Module::Platform::OSX))
return to_osx_x64_macho(framework, code)
end
end end
if(arch.index(ARCH_ARMLE)) if(arch.index(ARCH_ARMLE))
@ -575,6 +579,22 @@ require 'digest/sha1'
return mo return mo
end end
def self.to_osx_x64_macho(framework, code, opts={})
set_template_default(opts, "template_x64_darwin.bin")
macho = ''
File.open(opts[:template], 'rb') { |fd|
macho = fd.read(fd.stat.size)
}
bin = macho.index('PAYLOAD:')
raise RuntimeError, "Invalid Mac OS X x86_64 Mach-O template: missing \"PAYLOAD:\" tag" if not bin
macho[bin, code.length] = code
return macho
end
# #
# Create a 64-bit Linux ELF containing the payload provided in +code+ # Create a 64-bit Linux ELF containing the payload provided in +code+
# #
@ -1700,7 +1720,13 @@ End Sub
end end
when 'macho' when 'macho'
output = Msf::Util::EXE.to_osx_x86_macho(framework, code, exeopts) if (not arch or (arch.index(ARCH_X86)))
output = Msf::Util::EXE.to_osx_x86_macho(framework, code, exeopts)
end
if (arch and (arch.index(ARCH_X86_64) or arch.index(ARCH_X64)))
output = Msf::Util::EXE.to_osx_x64_macho(framework, code, exeopts)
end
when 'vba' when 'vba'
output = Msf::Util::EXE.to_vba(framework, code, exeopts) output = Msf::Util::EXE.to_vba(framework, code, exeopts)