From c05ff818ddfc3ab97a11b582fb0c6ce979dc5c69 Mon Sep 17 00:00:00 2001 From: Tod Beardsley Date: Thu, 18 Nov 2010 16:40:33 +0000 Subject: [PATCH] Incrementally more useful survey of mixins already in use in Metasploit. Current results, for fun:
Msf::Exploit::Remote::Tcp                    | 268
Msf::Auxiliary::Report                       | 238
Msf::Exploit::Remote::TcpServer              | 183
Msf::Exploit::Remote::HttpServer             | 147
Msf::Exploit::Remote::HttpServer::HTML       | 141
Msf::Exploit::Seh                            | 109
Msf::Exploit::Remote::HttpClient             | 95
Msf::Exploit::FILEFORMAT                     | 70
Msf::Exploit::EXE                            | 40
Msf::Exploit::Remote::Udp                    | 33
Msf::Exploit::Remote::DCERPC                 | 32
Msf::Exploit::Remote::DCERPC_EPM             | 32
Msf::Exploit::Remote::DCERPC_LSA             | 32
Msf::Exploit::Remote::DCERPC_MGMT            | 32
Msf::Exploit::Remote::SMB                    | 31
Msf::Exploit::Remote::Ftp                    | 27
Msf::Exploit::Egghunter                      | 21
Msf::Exploit::Brute                          | 20
Msf::Exploit::Remote::BrowserAutopwn         | 16
Msf::Exploit::Remote::Imap                   | 13
Msf::Exploit::Remote::FtpServer              | 12
Msf::Exploit::BruteTargets                   | 7
Msf::Exploit::Remote::SunRPC                 | 6
Msf::Exploit::Remote::SMTPDeliver            | 6
Msf::Exploit::Remote::MSSQL                  | 5
Msf::Exploit::KernelMode                     | 5
Msf::Exploit::Remote::MSSQL_COMMANDS         | 5
Msf::Exploit::FormatString                   | 4
Msf::Exploit::CmdStager                      | 4
Msf::Exploit::Lorcon2                        | 4
Msf::Exploit::Remote::HttpServer::PHPInclude | 3
Msf::Exploit::CmdStagerVBS                   | 3
Msf::Exploit::Remote::TNS                    | 3
Msf::Exploit::Remote::Smtp                   | 2
Msf::Exploit::Remote::Dialup                 | 2
Msf::Exploit::Java                           | 2
Msf::Exploit::Remote::NDMP                   | 2
Msf::Exploit::Remote::Arkeia                 | 2
Msf::Exploit::PDF_Parse                      | 1
Msf::Exploit::CmdStagerTFTP                  | 1
Msf::Exploit::Omelet                         | 1
Msf::Exploit::TFTPServer                     | 1
Msf::Exploit::RIFF                           | 1
Msf::Exploit::Remote::SMB::Authenticated     | 1
Msf::Exploit::Capture                        | 1
Msf::Exploit::Remote::SMBServer              | 1

git-svn-id: file:///home/svn/framework3/trunk@11064 4d416f70-5f16-0410-b530-b9f4589650da --- tools/module_mixins.rb | 48 ++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/tools/module_mixins.rb b/tools/module_mixins.rb index a324a2ce58..9e875e1a8a 100755 --- a/tools/module_mixins.rb +++ b/tools/module_mixins.rb @@ -14,10 +14,9 @@ require 'rex' require 'msf/ui' require 'msf/base' - def do_want(klass) return false if klass.class != Module - return false if [ Kernel, ERB::Util, SNMP::BER].include?(klass) + return false if [ Kernel, ERB::Util, SNMP::BER, Racket].include?(klass) return false if klass.to_s.match(/^Rex::Ui::Subscriber/) return true @@ -28,18 +27,35 @@ $framework = Msf::Simple::Framework.create('DisableDatabase' => true) all_modules = $framework.exploits -# Tables kind of suck for this. -results = [] -longest_name = 0 - -all_modules.each_module do |name, mod| - x = mod.new - mixins = x.class.ancestors.select {|y| do_want(y) } - results << [x.fullname, mixins.sort {|a,b| a.to_s <=> b.to_s}.join(", ")] - longest_name = x.fullname.size if longest_name < x.fullname.size -end - -# name | module1, module1, etc. -results.each do |r| - puts "%-#{longest_name}s | %s" % r +# If you give an argument (any argument will do), you really want a sorted +# list of mixins, regardles of the module they're in. +if ARGV[0] + mod_hash = {} + longest_name = 0 + all_modules.each_module do |name, mod| + x = mod.new + mixins = x.class.ancestors.select {|y| do_want(y) } + mixins.each do |m| + mod_hash[m] ||= 0 + mod_hash[m] += 1 + longest_name = m.to_s.size unless m.to_s.size < longest_name + end + end + mod_hash.sort_by {|a| a[1]}.reverse.each do |arr| + puts "%-#{longest_name}s | %d" % arr + end +else + # Tables kind of suck for this. + results = [] + longest_name = 0 + all_modules.each_module do |name, mod| + x = mod.new + mixins = x.class.ancestors.select {|y| do_want(y) } + results << [x.fullname, mixins.sort {|a,b| a.to_s <=> b.to_s}.join(", ")] + longest_name = x.fullname.size if longest_name < x.fullname.size + end + # name | module1, module1, etc. + results.each do |r| + puts "%-#{longest_name}s | %s" % r + end end