Land #10519, Add msfvenom -l archs like -l platforms

4.x
Wei Chen 2018-08-27 13:52:50 -05:00 committed by Jeffrey Martin
parent 6f42bcafcf
commit 4d785c4fea
No known key found for this signature in database
GPG Key ID: 0CD9BBC2AF15F171
1 changed files with 47 additions and 5 deletions

View File

@ -63,12 +63,13 @@ def parse_args(args)
opt = OptionParser.new
banner = "MsfVenom - a Metasploit standalone payload generator.\n"
banner << "Also a replacement for msfpayload and msfencode.\n"
banner << "Usage: #{$0} [options] <var=val>"
banner << "Usage: #{$0} [options] <var=val>\n"
banner << "Example: #{$0} -p windows/meterpreter/reverse_tcp LHOST=<IP> -f exe -o payload.exe"
opt.banner = banner
opt.separator('')
opt.separator('Options:')
opt.on('-l', '--list <type>', Array, 'List all modules for [type]. Types are: payloads, encoders, nops, platforms, formats, all') do |l|
opt.on('-l', '--list <type>', Array, 'List all modules for [type]. Types are: payloads, encoders, nops, platforms, archs, formats, all') do |l|
if l.to_s.empty?
l = ["all"]
end
@ -100,7 +101,7 @@ def parse_args(args)
opts[:smallest] = true
end
opt.on('-a', '--arch <arch>', String, 'The architecture to use for --payload and --encoders') do |a|
opt.on('-a', '--arch <arch>', String, 'The architecture to use for --payload and --encoders (use --list archs to list)') do |a|
opts[:arch] = a
end
@ -226,7 +227,45 @@ def dump_platforms
])
supported_platforms.sort.each do |name|
tbl << [ name]
tbl << [name]
end
"\n" + tbl.to_s + "\n"
end
def dump_archs
init_framework(:module_types => [])
supported_archs = ARCH_ALL.dup
tbl = Rex::Text::Table.new(
'Indent' => 4,
'Header' => "Framework Architectures [--arch <value>]",
'Columns' =>
[
"Name",
])
supported_archs.sort.each do |name|
tbl << [name]
end
"\n" + tbl.to_s + "\n"
end
def dump_archs
init_framework(:module_types => [])
supported_archs = ARCH_ALL.dup
tbl = Rex::Text::Table.new(
'Indent' => 4,
'Header' => "Framework Architectures [--arch <value>]",
'Columns' =>
[
"Name",
])
supported_archs.sort.each do |name|
tbl << [name]
end
"\n" + tbl.to_s + "\n"
@ -341,6 +380,8 @@ if generator_opts[:list]
$stdout.puts dump_nops
when "platforms", "dump_platform"
$stdout.puts dump_platforms
when "archs", "dump_arch"
$stdout.puts dump_archs
when "formats", "format", "f"
$stdout.puts dump_formats
when "all", "a"
@ -351,9 +392,10 @@ if generator_opts[:list]
$stdout.puts dump_encoders
$stdout.puts dump_nops
$stdout.puts dump_platforms
$stdout.puts dump_archs
$stdout.puts dump_formats
else
$stderr.puts "Invalid type (#{mod}). These are valid: payloads, encoders, nops, platforms, formats, all"
$stderr.puts "Invalid type (#{mod}). These are valid: payloads, encoders, nops, platforms, archs, formats, all"
end
end
exit(0)