Path: blob/master/tools/modules/module_count.rb
19516 views
#!/usr/bin/env ruby12##3# This module requires Metasploit: https://metasploit.com/download4# Current source: https://github.com/rapid7/metasploit-framework5##67#8# Lists the current count of modules, by type, and outputs a bare CSV.9#1011msfbase = __FILE__12while File.symlink?(msfbase)13msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))14end1516$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib')))17require 'msfenv'1819$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']2021require 'rex'2223# Always disable the database (we never need it just to list module24# information).25framework_opts = { 'DisableDatabase' => true }2627# Initialize the simplified framework instance.28$framework = Msf::Simple::Framework.create(framework_opts)29Indent = ' '3031i = 032module_types = {33:exploit => 0,34:auxiliary => 0,35:post => 0,36:payload => 0,37:encoder => 0,38:nop => 039}4041$framework.modules.each do |name, mod|42this_mod = mod.new43[:exploit, :auxiliary, :post, :payload, :encoder, :nop].each do |meth|44interrogative = "#{meth}?".intern45if this_mod.send(interrogative)46module_types[meth] += 147end48end49end5051puts module_types.keys.map {|k| k.to_s}.join(",")52puts module_types.values.join(",")535455