mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-05 14:57:30 +01:00
add arch and platform filtering
git-svn-id: file:///home/svn/framework3/trunk@10088 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
09af63c1fb
commit
6d64b22c82
@ -19,14 +19,16 @@ Indent = ' '
|
||||
# Initialize the simplified framework instance.
|
||||
$framework = Msf::Simple::Framework.create(
|
||||
:module_types => [
|
||||
Msf::MODULE_PAYLOAD # , Msf::MODULE_ENCODER, Msf::MODULE_NOP
|
||||
Msf::MODULE_PAYLOAD # , Msf::MODULE_ENCODER, Msf::MODULE_NOP
|
||||
],
|
||||
#'DisableDatabase' => true
|
||||
'DisableDatabase' => true
|
||||
)
|
||||
|
||||
# Process special var/val pairs...
|
||||
Msf::Ui::Common.process_cli_arguments($framework, ARGV)
|
||||
|
||||
options = ARGV.join(',')
|
||||
|
||||
tbl = Rex::Ui::Text::Table.new(
|
||||
'Header' => 'Payload Lengths',
|
||||
'Indent' => Indent.length,
|
||||
@ -34,24 +36,33 @@ tbl = Rex::Ui::Text::Table.new(
|
||||
)
|
||||
|
||||
enc = nil
|
||||
options = ARGV.join(',')
|
||||
|
||||
$framework.payloads.each_module { |payload_name, mod|
|
||||
|
||||
len = 'Unknown error!'
|
||||
len = 'Error: Unknown error!'
|
||||
|
||||
begin
|
||||
# Create the payload instance
|
||||
payload = $framework.payloads.create(payload_name)
|
||||
payload = mod.new
|
||||
raise "Invalid payload" if not payload
|
||||
|
||||
buf = payload.generate_simple(
|
||||
'Format' => 'raw',
|
||||
'OptionStr' => options,
|
||||
'Encoder' => enc
|
||||
)
|
||||
if buf.length > 0
|
||||
len = buf.length.to_s
|
||||
# Set the variables from the cmd line
|
||||
payload.datastore.import_options_from_s(options)
|
||||
|
||||
# Skip non-specified architectures
|
||||
if (ds_arch = payload.datastore['ARCH'])
|
||||
next if not payload.arch?(ds_arch)
|
||||
end
|
||||
|
||||
# Skip non-specified platforms
|
||||
if (ds_plat = payload.datastore['PLATFORM'])
|
||||
ds_plat = Msf::Module::PlatformList.transform(ds_plat)
|
||||
next if not payload.platform.supports?(ds_plat)
|
||||
end
|
||||
|
||||
len = payload.size
|
||||
if len > 0
|
||||
len = len.to_s
|
||||
else
|
||||
len = "Error: Empty payload"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user