CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/auxiliary/example.rb
Views: 1904
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
###
7
#
8
# This sample auxiliary module simply displays the selected action and
9
# registers a custom command that will show up when the module is used.
10
#
11
###
12
class MetasploitModule < Msf::Auxiliary
13
def initialize(info = {})
14
super(
15
update_info(
16
info,
17
'Name' => 'Sample Auxiliary Module',
18
# The description can be multiple lines, but does not preserve formatting.
19
'Description' => 'Sample Auxiliary Module',
20
'Author' => ['Joe Module <[email protected]>'],
21
'License' => MSF_LICENSE,
22
'Actions' => [
23
[ 'Default Action', { 'Description' => 'This does something' } ],
24
[ 'Another Action', { 'Description' => 'This does a different thing' } ]
25
],
26
# The action(s) that will run as background job
27
'PassiveActions' => [
28
'Another Action'
29
],
30
# https://docs.metasploit.com/docs/development/developing-modules/module-metadata/definition-of-module-reliability-side-effects-and-stability.html
31
'Notes' => {
32
'Stability' => [],
33
'Reliability' => [],
34
'SideEffects' => []
35
},
36
'DefaultAction' => 'Default Action'
37
)
38
)
39
end
40
41
def run
42
print_status("Running the simple auxiliary module with action #{action.name}")
43
end
44
45
# Framework automatically registers `cmd_*` methods to be dispatched when the
46
# corresponding command is used. For example, here this method will be called
47
# when entering the `aux_extra_command` command in the console.
48
def cmd_aux_extra_command(*args)
49
print_status("Running inside aux_extra_command(#{args.join(' ')})")
50
end
51
end
52
53