mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-10-29 18:07:27 +01:00
b863978028
MSP-11368 MSP-11143 Remove fastlib as it slows down the code loading process. From the previous commit, the mean loading for `METASPLOIT_FRAMEWORK_PROFILE=true msfconsole -q -x exit` was 27.9530±0.3485 seconds (N=10). The mean after removal of fastlib was 17.9820±0.6497 seconds (N=10). This means an average 35.67% reduction in boot time.
88 lines
1.7 KiB
Ruby
Executable File
88 lines
1.7 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
#
|
|
# $Id$
|
|
#
|
|
# This script lists all modules with their targets
|
|
#
|
|
# $Revision$
|
|
#
|
|
|
|
msfbase = __FILE__
|
|
while File.symlink?(msfbase)
|
|
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
|
|
end
|
|
|
|
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', 'lib')))
|
|
require 'msfenv'
|
|
|
|
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
|
|
|
|
require 'rex'
|
|
require 'msf/ui'
|
|
require 'msf/base'
|
|
|
|
sort=0
|
|
fil = 0
|
|
filter = ""
|
|
|
|
opts = Rex::Parser::Arguments.new(
|
|
"-h" => [ false, "Help menu." ],
|
|
"-s" => [ false, "Sort by Target instead of Module Type."],
|
|
"-r" => [ false, "Reverse Sort"],
|
|
"-x" => [ true, "String or RegEx to try and match against the Targets field"]
|
|
)
|
|
|
|
opts.parse(ARGV) { |opt, idx, val|
|
|
case opt
|
|
when "-h"
|
|
puts "\nMetasploit Script for Displaying Module Target information."
|
|
puts "=========================================================="
|
|
puts opts.usage
|
|
exit
|
|
when "-s"
|
|
puts "Sorting by Target"
|
|
sort = 1
|
|
when "-r"
|
|
puts "Reverse Sorting"
|
|
sort = 2
|
|
when "-x"
|
|
puts "Filter: #{val}"
|
|
filter = val
|
|
fil=1
|
|
end
|
|
}
|
|
|
|
Indent = ' '
|
|
|
|
# Initialize the simplified framework instance.
|
|
$framework = Msf::Simple::Framework.create('DisableDatabase' => true)
|
|
|
|
tbl = Rex::Ui::Text::Table.new(
|
|
'Header' => 'Module Targets',
|
|
'Indent' => Indent.length,
|
|
'Columns' => [ 'Module name','Target' ]
|
|
)
|
|
|
|
all_modules = $framework.exploits
|
|
|
|
all_modules.each_module { |name, mod|
|
|
x = mod.new
|
|
x.targets.each do |targ|
|
|
if fil==0 or targ.name=~/#{filter}/
|
|
tbl << [ x.fullname, targ.name ]
|
|
end
|
|
end
|
|
}
|
|
|
|
if sort == 1
|
|
tbl.sort_rows(1)
|
|
end
|
|
|
|
|
|
if sort == 2
|
|
tbl.sort_rows(1)
|
|
tbl.rows.reverse
|
|
end
|
|
|
|
puts tbl.to_s
|