add payload length tool
git-svn-id: file:///home/svn/framework3/trunk@10085 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
57b48314a6
commit
9c69e3c670
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/env ruby
|
||||
#
|
||||
# $Id$
|
||||
# $Revision$
|
||||
#
|
||||
# This script lists each payload module along with its length
|
||||
# NOTE: No encoding or BadChar handling is performed
|
||||
#
|
||||
|
||||
msfbase = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__
|
||||
$:.unshift(File.join(File.dirname(msfbase), '..', 'lib'))
|
||||
|
||||
require 'rex'
|
||||
require 'msf/ui'
|
||||
require 'msf/base'
|
||||
|
||||
Indent = ' '
|
||||
|
||||
# Initialize the simplified framework instance.
|
||||
$framework = Msf::Simple::Framework.create(
|
||||
:module_types => [
|
||||
Msf::MODULE_PAYLOAD # , Msf::MODULE_ENCODER, Msf::MODULE_NOP
|
||||
],
|
||||
#'DisableDatabase' => true
|
||||
)
|
||||
|
||||
# Process special var/val pairs...
|
||||
Msf::Ui::Common.process_cli_arguments($framework, ARGV)
|
||||
|
||||
tbl = Rex::Ui::Text::Table.new(
|
||||
'Header' => 'Payload Lengths',
|
||||
'Indent' => Indent.length,
|
||||
'Columns' => [ 'Payload', 'Length' ]
|
||||
)
|
||||
|
||||
enc = nil
|
||||
options = ARGV.join(',')
|
||||
|
||||
$framework.payloads.each_module { |payload_name, mod|
|
||||
|
||||
len = 'Unknown error!'
|
||||
|
||||
begin
|
||||
# Create the payload instance
|
||||
payload = $framework.payloads.create(payload_name)
|
||||
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
|
||||
else
|
||||
len = "Error: Empty payload"
|
||||
end
|
||||
rescue
|
||||
len = "Error: #{$!}"
|
||||
end
|
||||
|
||||
tbl << [ payload_name, len ]
|
||||
}
|
||||
|
||||
puts tbl.to_s
|
Loading…
Reference in New Issue