Permalink
Browse files

Macho support for msfencode

git-svn-id: file:///home/svn/framework3/trunk@9071 4d416f70-5f16-0410-b530-b9f4589650da
  • Loading branch information...
1 parent 321404e commit e9e8519be6cf520fab689fb6fbe755f3eb490226 HD Moore committed Apr 14, 2010
Showing with 11 additions and 2 deletions.
  1. +11 −2 msfencode
View
@@ -20,7 +20,7 @@ $args = Rex::Parser::Arguments.new(
"-m" => [ true, "Specifies an additional module search path" ],
"-a" => [ true, "The architecture to encode as" ],
"-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'" ],
"-s" => [ true, "The maximum size of the encoded data" ],
"-e" => [ true, "The encoder to use" ],
@@ -126,7 +126,7 @@ $args.parse(ARGV) { |opt, idx, val|
when "-s"
space = val.to_i
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
else
$stderr.puts(OutError + "Invalid format: #{val}")
@@ -254,6 +254,15 @@ case cmd
fd.write(elf)
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'
exe = Msf::Util::EXE.to_win32pe($framework, raw, {:insert => inject, :template => altexe})
vba = Msf::Util::EXE.to_exe_vba(exe)

0 comments on commit e9e8519

Please sign in to comment.