Class: Msf::Plugin::ThreadTest
- Inherits:
-
Msf::Plugin
- Object
- Msf::Plugin
- Msf::Plugin::ThreadTest
- Defined in:
- plugins/thread.rb
Overview
This class illustrates a sample plugin. Plugins can change the behavior of the framework by adding new features, new user interface commands, or through any other arbitrary means. They are designed to have a very loose definition in order to make them as useful as possible.
Defined Under Namespace
Classes: ConsoleCommandDispatcher
Instance Attribute Summary
Attributes inherited from Msf::Plugin
Attributes included from Framework::Offspring
Instance Method Summary collapse
-
#cleanup ⇒ Object
The cleanup routine for plugins gives them a chance to undo any actions they may have done to the framework.
-
#desc ⇒ Object
This method returns a brief description of the plugin.
-
#initialize(framework, opts) ⇒ ThreadTest
constructor
The constructor is called when an instance of the plugin is created.
-
#name ⇒ Object
This method returns a short, friendly name for the plugin.
Methods inherited from Msf::Plugin
#add_console_dispatcher, create, #flush, #input, #output, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #remove_console_dispatcher
Constructor Details
#initialize(framework, opts) ⇒ ThreadTest
The constructor is called when an instance of the plugin is created. The framework instance that the plugin is being associated with is passed in the framework parameter. Plugins should call the parent constructor when inheriting from Msf::Plugin to ensure that the framework attribute on their instance gets set.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'plugins/thread.rb', line 85 def initialize(framework, opts) super # If this plugin is being loaded in the context of a console application # that uses the framework's console user interface driver, register # console dispatcher commands. add_console_dispatcher(ConsoleCommandDispatcher) # Extend the thread to track the calling source Thread.class_eval(" attr_accessor :tsource alias initialize_old initialize def initialize(&block) self.tsource = caller(1) initialize_old(&block) end ") print_status("ThreadTest plugin loaded.") end |
Instance Method Details
#cleanup ⇒ Object
The cleanup routine for plugins gives them a chance to undo any actions they may have done to the framework. For instance, if a console dispatcher was added, then it should be removed in the cleanup routine.
113 114 115 116 117 |
# File 'plugins/thread.rb', line 113 def cleanup # If we had previously registered a console dispatcher with the console, # deregister it now. remove_console_dispatcher('ThreadTest') end |
#desc ⇒ Object
This method returns a brief description of the plugin. It should be no more than 60 characters, but there are no hard limits.
130 131 132 |
# File 'plugins/thread.rb', line 130 def desc "Thread testing plugin" end |
#name ⇒ Object
This method returns a short, friendly name for the plugin.
122 123 124 |
# File 'plugins/thread.rb', line 122 def name "threadtest" end |