CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/tools/modules/module_description.rb
Views: 11766
1
#!/usr/bin/env ruby
2
3
##
4
# This module requires Metasploit: https://metasploit.com/download
5
# Current source: https://github.com/rapid7/metasploit-framework
6
##
7
8
#
9
# This script lists each module with its description
10
#
11
12
msfbase = __FILE__
13
while File.symlink?(msfbase)
14
msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
15
end
16
17
$:.unshift(File.expand_path(File.join(File.dirname(msfbase), '..', '..', 'lib')))
18
require 'msfenv'
19
20
$:.unshift(ENV['MSF_LOCAL_LIB']) if ENV['MSF_LOCAL_LIB']
21
22
require 'rex'
23
24
sort = 0
25
filter= 'All'
26
filters = ['all','exploit','payload','post','nop','encoder','auxiliary']
27
28
opts = Rex::Parser::Arguments.new(
29
"-h" => [ false, "Help menu." ],
30
"-f" => [ true, "Filter based on Module Type [#{filters.map{|f|f.capitalize}.join(", ")}] (Default = All)."],
31
)
32
33
opts.parse(ARGV) { |opt, idx, val|
34
case opt
35
when "-h"
36
puts "\nMetasploit Script for Displaying Module Descriptions."
37
puts "=========================================================="
38
puts opts.usage
39
exit
40
when "-f"
41
unless filters.include?(val.downcase)
42
puts "Invalid Filter Supplied: #{val}"
43
puts "Please use one of these: #{filters.map{|f|f.capitalize}.join(", ")}"
44
exit
45
end
46
puts "Module Filter: #{val}"
47
filter = val
48
49
end
50
51
}
52
53
54
Indent = ' '
55
56
# Always disable the database (we never need it just to list module
57
# information).
58
framework_opts = { 'DisableDatabase' => true }
59
60
# If the user only wants a particular module type, no need to load the others
61
if filter.downcase != 'all'
62
framework_opts[:module_types] = [ filter.downcase ]
63
end
64
65
# Initialize the simplified framework instance.
66
$framework = Msf::Simple::Framework.create(framework_opts)
67
68
69
tbl = Rex::Text::Table.new(
70
'Header' => 'Module Descriptions',
71
'Indent' => Indent.length,
72
'Columns' => [ 'Module', 'Description' ]
73
)
74
75
$framework.modules.each { |name, mod|
76
x = mod.new
77
tbl << [ x.fullname, x.description ]
78
}
79
80
if sort == 1
81
tbl.sort_rows(1)
82
end
83
84
puts tbl.to_s
85
86