Fix/add C# support for msf{payload,venom}

Quick fix for rapid7/metasploit-framework#1944.
unstable
William Vu 2013-06-12 13:01:51 -05:00
parent d0e1e4df0a
commit 8f8cc77a9d
2 changed files with 5 additions and 5 deletions

View File

@ -30,7 +30,7 @@ $args = Rex::Parser::Arguments.new(
#
def usage
$stderr.puts("\n" +
" Usage: #{$0} [<options>] <payload> [var=val] <[S]ummary|C|[P]erl|Rub[y]|[R]aw|[J]s|e[X]e|[D]ll|[V]BA|[W]ar|Pytho[N]>\n" +
" Usage: #{$0} [<options>] <payload> [var=val] <[S]ummary|C|Cs[H]arp|[P]erl|Rub[Y]|[R]aw|[J]s|e[X]e|[D]ll|[V]BA|[W]ar|Pytho[N]>\n" +
$args.usage)
exit
end
@ -119,13 +119,13 @@ end
payload.datastore.merge! options
if (cmd =~ /^(p|y|r|d|c|j|x|b|v|w|n)/)
if (cmd =~ /^(p|y|r|d|c|h|j|x|b|v|w|n)/)
fmt = 'perl' if (cmd =~ /^p/)
fmt = 'ruby' if (cmd =~ /^y/)
fmt = 'raw' if (cmd =~ /^(r|x|d)/)
fmt = 'raw' if (cmd =~ /^v/)
fmt = 'c' if (cmd == 'c')
fmt = 'csharp' if (cmd == 'csharp')
fmt = 'csharp' if (cmd == 'h')
fmt = 'js_be' if (cmd =~ /^j/ and Rex::Arch.endian(payload.arch) == ENDIAN_BIG)
fmt = 'js_le' if (cmd =~ /^j/ and ! fmt)
fmt = 'java' if (cmd =~ /^b/)

View File

@ -422,12 +422,12 @@ end
$stdout.binmode
if opts[:format] !~/ruby|rb|perl|pl|bash|sh|c|js|dll|elf/i
if opts[:format] !~/ruby|rb|perl|pl|bash|sh|c|csharp|js|dll|elf/i
exe = Msf::Util::EXE.to_executable_fmt($framework, opts[:arch], opts[:platform], payload_raw, opts[:format], exeopts)
end
case opts[:format]
when /ruby|rb|perl|pl|bash|^sh$|^c$|js_le|raw|^py/i
when /ruby|rb|perl|pl|bash|^sh$|^c$|^csharp$|js_le|raw|^py/i
$stdout.write Msf::Simple::Buffer.transform(payload_raw, opts[:format])
when /asp$/
asp = Msf::Util::EXE.to_win32pe_asp($framework, payload_raw, exeopts)