14
14
end
15
15
16
16
module Msf
17
- ###
18
- #
19
- # This class illustrates a fuzzy_use plugin. Plugins can change the behavior of
20
- # the framework by adding new features, new user interface commands, or
21
- # through any other arbitrary means. They are designed to have a very loose
22
- # definition in order to make them as useful as possible.
23
- #
24
- ###
25
17
class Plugin ::FuzzyUse < Msf ::Plugin
26
-
27
- ###
28
- #
29
- # This class implements a fuzzy_use console command dispatcher.
30
- #
31
- ###
32
18
class ConsoleCommandDispatcher
33
19
include Msf ::Ui ::Console ::CommandDispatcher
34
20
@@ -56,9 +42,6 @@ def initialize(driver)
56
42
@module_dispatcher = Msf ::Ui ::Console ::CommandDispatcher ::Modules . new ( driver )
57
43
end
58
44
59
- #
60
- # The dispatcher's name.
61
- #
62
45
def name
63
46
'FuzzyUse'
64
47
end
@@ -68,7 +51,7 @@ def name
68
51
#
69
52
def commands
70
53
{
71
- 'fzuse' => 'A fuzzy_use command added by the fuzzy_use plugin'
54
+ 'fzuse' => 'A fuzzy use command added by the FuzzyUse plugin'
72
55
}
73
56
end
74
57
@@ -100,7 +83,7 @@ def pipe_server(socket_path)
100
83
end
101
84
102
85
#
103
- # This method handles the fuzzy_use command.
86
+ # This method handles the fzuse command.
104
87
#
105
88
def cmd_fzuse ( *args )
106
89
selection = nil
@@ -134,13 +117,6 @@ def cmd_fzuse(*args)
134
117
end
135
118
end
136
119
137
- #
138
- # The constructor is called when an instance of the plugin is created. The
139
- # framework instance that the plugin is being associated with is passed in
140
- # the framework parameter. Plugins should call the parent constructor when
141
- # inheriting from Msf::Plugin to ensure that the framework attribute on
142
- # their instance gets set.
143
- #
144
120
def initialize ( framework , opts )
145
121
super
146
122
@@ -153,38 +129,21 @@ def initialize(framework, opts)
153
129
return
154
130
end
155
131
156
- # If this plugin is being loaded in the context of a console application
157
- # that uses the framework's console user interface driver, register
158
- # console dispatcher commands.
159
132
add_console_dispatcher ( ConsoleCommandDispatcher )
160
133
161
134
print_status ( 'FuzzyUse plugin loaded.' )
162
135
end
163
136
164
- #
165
- # The cleanup routine for plugins gives them a chance to undo any actions
166
- # they may have done to the framework. For instance, if a console
167
- # dispatcher was added, then it should be removed in the cleanup routine.
168
- #
169
137
def cleanup
170
- # If we had previously registered a console dispatcher with the console,
171
- # deregister it now.
172
138
remove_console_dispatcher ( 'FuzzyUse' )
173
139
end
174
140
175
- #
176
- # This method returns a short, friendly name for the plugin.
177
- #
178
141
def name
179
142
'fuzzy_use'
180
143
end
181
144
182
- #
183
- # This method returns a brief description of the plugin. It should be no
184
- # more than 60 characters, but there are no hard limits.
185
- #
186
145
def desc
187
- 'Demonstrates using framework plugins '
146
+ 'A plugin offering a fuzzy use command '
188
147
end
189
148
190
149
end
0 commit comments