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

GSoC/Meterpreter_Web_Console
Wei Chen 2018-08-27 13:52:50 -05:00
commit f38d1569b0
No known key found for this signature in database
GPG Key ID: 6E162ED2C01D9AAC
1 changed files with 26 additions and 4 deletions

View File

@ -69,7 +69,7 @@ def parse_args(args)
opt.separator('') opt.separator('')
opt.separator('Options:') opt.separator('Options:')
opt.on('-l', '--list <type>', Array, 'List all modules for [type]. Types are: payloads, encoders, nops, platforms, encrypt, formats, all') do |l| opt.on('-l', '--list <type>', Array, 'List all modules for [type]. Types are: payloads, encoders, nops, platforms, archs, encrypt, formats, all') do |l|
if l.to_s.empty? if l.to_s.empty?
l = ["all"] l = ["all"]
end end
@ -113,7 +113,7 @@ def parse_args(args)
opts[:encryption_iv] = e opts[:encryption_iv] = e
end 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 opts[:arch] = a
end end
@ -239,7 +239,26 @@ def dump_platforms
]) ])
supported_platforms.sort.each do |name| 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 end
"\n" + tbl.to_s + "\n" "\n" + tbl.to_s + "\n"
@ -371,6 +390,8 @@ if generator_opts[:list]
$stdout.puts dump_nops $stdout.puts dump_nops
when "platforms", "dump_platform" when "platforms", "dump_platform"
$stdout.puts dump_platforms $stdout.puts dump_platforms
when "archs", "dump_arch"
$stdout.puts dump_archs
when "encrypts", "encrypt", "encryption" when "encrypts", "encrypt", "encryption"
$stdout.puts dump_encrypt $stdout.puts dump_encrypt
when "formats", "format", "f" when "formats", "format", "f"
@ -383,10 +404,11 @@ if generator_opts[:list]
$stdout.puts dump_encoders $stdout.puts dump_encoders
$stdout.puts dump_nops $stdout.puts dump_nops
$stdout.puts dump_platforms $stdout.puts dump_platforms
$stdout.puts dump_archs
$stdout.puts dump_encrypt $stdout.puts dump_encrypt
$stdout.puts dump_formats $stdout.puts dump_formats
else else
$stderr.puts "Invalid type (#{mod}). These are valid: payloads, encoders, nops, platforms, encrypt, formats, all" $stderr.puts "Invalid type (#{mod}). These are valid: payloads, encoders, nops, platforms, archs, encrypt, formats, all"
end end
end end
exit(0) exit(0)