Permalink
Browse files

patch to msfencode to support elf format output from Bernardo Damele …

…A. G.

git-svn-id: file:///home/svn/framework3/trunk@6543 4d416f70-5f16-0410-b530-b9f4589650da
  • Loading branch information...
1 parent d70d2c5 commit 8c3266b4844adde42a19d6446ab170151d58bc73 HD Moore committed May 11, 2009
Showing with 11 additions and 2 deletions.
  1. +11 −2 msfencode
View
@@ -19,7 +19,7 @@ $args = Rex::Parser::Arguments.new(
"-i" => [ true, "Encode the contents of the supplied file path" ],
"-m" => [ true, "Specifies an additional module search path" ],
"-a" => [ true, "The architecture to encode as" ],
- "-t" => [ true, "The format to display the encoded buffer with (raw, ruby, perl, c, exe, vba)" ],
+ "-t" => [ true, "The format to display the encoded buffer with (c, elf, exe, java, perl, raw, ruby, vba)" ],
"-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" ],
@@ -118,7 +118,7 @@ $args.parse(ARGV) { |opt, idx, val|
when "-s"
space = val.to_i
when "-t"
- if (val =~ /^(perl|ruby|raw|c|js_le|js_be|java|exe|vba)$/)
+ if (val =~ /^(perl|ruby|raw|c|js_le|js_be|java|exe|elf|vba)$/)
fmt = val
else
$stderr.puts(OutError + "Invalid format: #{val}")
@@ -199,6 +199,15 @@ case cmd
fd.write(exe)
end
end
+ when 'elf'
+ elf = Rex::Text.to_linux_x86_elf(raw, "")
+ if(not output)
+ $stdout.write(elf)
+ else
+ File.open(output, "wb") do |fd|
+ fd.write(elf)
+ end
+ end
when 'vba'
exe = Rex::Text.to_win32pe(raw, "")
vba = Rex::Text.to_exe_vba(exe)

0 comments on commit 8c3266b

Please sign in to comment.