Macho support for msfencode

git-svn-id: file:///home/svn/framework3/trunk@9071 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-04-14 17:23:35 +00:00
parent 321404e2fe
commit e9e8519be6
1 changed files with 11 additions and 2 deletions

View File

@ -20,7 +20,7 @@ $args = Rex::Parser::Arguments.new(
"-m" => [ true, "Specifies an additional module search path" ], "-m" => [ true, "Specifies an additional module search path" ],
"-a" => [ true, "The architecture to encode as" ], "-a" => [ true, "The architecture to encode as" ],
"-p" => [ true, "The platform to encode for" ], "-p" => [ true, "The platform to encode for" ],
"-t" => [ true, "The format to display the encoded buffer with (c, elf, exe, java, js_le, js_be, perl, raw, ruby, vba, vbs, loop-vbs, asp, war)" ], "-t" => [ true, "The format to display the encoded buffer with (c, elf, exe, java, js_le, js_be, perl, raw, ruby, vba, vbs, loop-vbs, asp, war, macho)" ],
"-b" => [ true, "The list of characters to avoid: '\\x00\\xff'" ], "-b" => [ true, "The list of characters to avoid: '\\x00\\xff'" ],
"-s" => [ true, "The maximum size of the encoded data" ], "-s" => [ true, "The maximum size of the encoded data" ],
"-e" => [ true, "The encoder to use" ], "-e" => [ true, "The encoder to use" ],
@ -126,7 +126,7 @@ $args.parse(ARGV) { |opt, idx, val|
when "-s" when "-s"
space = val.to_i space = val.to_i
when "-t" when "-t"
if (val =~ /^(perl|ruby|rb|raw|c|js_le|js_be|java|exe|exe-small|elf|vba|vbs|loop-vbs|asp|war)$/) if (val =~ /^(perl|ruby|rb|raw|c|js_le|js_be|java|exe|exe-small|elf|vba|vbs|loop-vbs|asp|war|macho)$/)
fmt = val fmt = val
else else
$stderr.puts(OutError + "Invalid format: #{val}") $stderr.puts(OutError + "Invalid format: #{val}")
@ -254,6 +254,15 @@ case cmd
fd.write(elf) fd.write(elf)
end end
end end
when 'macho'
macho = Msf::Util::EXE.to_osx_x86_macho($framework, raw)
if(not output)
$stdout.write(macho)
else
File.open(output, "wb") do |fd|
fd.write(macho)
end
end
when 'vba' when 'vba'
exe = Msf::Util::EXE.to_win32pe($framework, raw, {:insert => inject, :template => altexe}) exe = Msf::Util::EXE.to_win32pe($framework, raw, {:insert => inject, :template => altexe})
vba = Msf::Util::EXE.to_exe_vba(exe) vba = Msf::Util::EXE.to_exe_vba(exe)