Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/plugins/sample.rb
Views: 11705
module Msf1###2#3# This class illustrates a sample plugin. Plugins can change the behavior of4# the framework by adding new features, new user interface commands, or5# through any other arbitrary means. They are designed to have a very loose6# definition in order to make them as useful as possible.7#8###9class Plugin::Sample < Msf::Plugin1011###12#13# This class implements a sample console command dispatcher.14#15###16class ConsoleCommandDispatcher17include Msf::Ui::Console::CommandDispatcher1819#20# The dispatcher's name.21#22def name23'Sample'24end2526#27# Returns the hash of commands supported by this dispatcher.28#29def commands30{31'sample' => 'A sample command added by the sample plugin'32}33end3435#36# This method handles the sample command.37#38def cmd_sample(*args)39print_line("You passed: #{args.join(' ')}")40end41end4243#44# The constructor is called when an instance of the plugin is created. The45# framework instance that the plugin is being associated with is passed in46# the framework parameter. Plugins should call the parent constructor when47# inheriting from Msf::Plugin to ensure that the framework attribute on48# their instance gets set.49#50def initialize(framework, opts)51super5253# If this plugin is being loaded in the context of a console application54# that uses the framework's console user interface driver, register55# console dispatcher commands.56add_console_dispatcher(ConsoleCommandDispatcher)5758print_status('Sample plugin loaded.')59end6061#62# The cleanup routine for plugins gives them a chance to undo any actions63# they may have done to the framework. For instance, if a console64# dispatcher was added, then it should be removed in the cleanup routine.65#66def cleanup67# If we had previously registered a console dispatcher with the console,68# deregister it now.69remove_console_dispatcher('Sample')70end7172#73# This method returns a short, friendly name for the plugin.74#75def name76'sample'77end7879#80# This method returns a brief description of the plugin. It should be no81# more than 60 characters, but there are no hard limits.82#83def desc84'Demonstrates using framework plugins'85end8687end88end899091