Skip to content

Commit 8f8cc77

Browse files
committed
Fix/add C# support for msf{payload,venom}
Quick fix for rapid7#1944.
1 parent d0e1e4d commit 8f8cc77

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

msfpayload

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $args = Rex::Parser::Arguments.new(
3030
#
3131
def usage
3232
$stderr.puts("\n" +
33-
" 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" +
33+
" 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" +
3434
$args.usage)
3535
exit
3636
end
@@ -119,13 +119,13 @@ end
119119

120120
payload.datastore.merge! options
121121

122-
if (cmd =~ /^(p|y|r|d|c|j|x|b|v|w|n)/)
122+
if (cmd =~ /^(p|y|r|d|c|h|j|x|b|v|w|n)/)
123123
fmt = 'perl' if (cmd =~ /^p/)
124124
fmt = 'ruby' if (cmd =~ /^y/)
125125
fmt = 'raw' if (cmd =~ /^(r|x|d)/)
126126
fmt = 'raw' if (cmd =~ /^v/)
127127
fmt = 'c' if (cmd == 'c')
128-
fmt = 'csharp' if (cmd == 'csharp')
128+
fmt = 'csharp' if (cmd == 'h')
129129
fmt = 'js_be' if (cmd =~ /^j/ and Rex::Arch.endian(payload.arch) == ENDIAN_BIG)
130130
fmt = 'js_le' if (cmd =~ /^j/ and ! fmt)
131131
fmt = 'java' if (cmd =~ /^b/)

msfvenom

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,12 @@ end
422422

423423
$stdout.binmode
424424

425-
if opts[:format] !~/ruby|rb|perl|pl|bash|sh|c|js|dll|elf/i
425+
if opts[:format] !~/ruby|rb|perl|pl|bash|sh|c|csharp|js|dll|elf/i
426426
exe = Msf::Util::EXE.to_executable_fmt($framework, opts[:arch], opts[:platform], payload_raw, opts[:format], exeopts)
427427
end
428428

429429
case opts[:format]
430-
when /ruby|rb|perl|pl|bash|^sh$|^c$|js_le|raw|^py/i
430+
when /ruby|rb|perl|pl|bash|^sh$|^c$|^csharp$|js_le|raw|^py/i
431431
$stdout.write Msf::Simple::Buffer.transform(payload_raw, opts[:format])
432432
when /asp$/
433433
asp = Msf::Util::EXE.to_win32pe_asp($framework, payload_raw, exeopts)

0 commit comments

Comments
 (0)