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/ffautoregen.rb
Views: 11705
module Msf1###2#3# This plugin reloads and re-executes a file-format exploit module once it has changed.4#5###6class Plugin::FFAutoRegen < Msf::Plugin78###9#10# This class implements a single edit command.11#12###13class FFAutoRegenCommandDispatcher14include Msf::Ui::Console::CommandDispatcher1516#17# The dispatcher's name.18#19def name20'FFAutoRegen'21end2223#24# Returns the hash of commands supported by this dispatcher.25#26def commands27{28'ffautoregen' => 'Automatically regenerate the document when the exploit source changes'29}30end3132#33# This method handles the command.34#35def cmd_ffautoregen(*_args)36if !active_module || !(path = active_module.file_path)37print_line('Error: No active module selected')38return nil39end4041last = mt = File.stat(path).mtime4243loop do44sleep(1)45mt = File.stat(path).mtime4647next unless (mt != last)4849last = mt5051nmod = framework.modules.reload_module(active_module)52if !nmod53print_line('Error: Failed to reload module, trying again on next change...')54next55end5657jobify = false58payload = nmod.datastore['PAYLOAD']59encoder = nmod.datastore['ENCODER']60target = nmod.datastore['TARGET']61nop = nmod.datastore['NOP']6263nmod.exploit_simple(64'Encoder' => encoder,65'Payload' => payload,66'Target' => target,67'Nop' => nop,68# 'OptionStr' => opt_str,69'LocalInput' => driver.input,70'LocalOutput' => driver.output,71'RunAsJob' => jobify72)73end74end75end7677def initialize(framework, opts)78super7980# console dispatcher commands.81add_console_dispatcher(FFAutoRegenCommandDispatcher)82end8384def cleanup85remove_console_dispatcher('FFAutoRegen')86end8788def name89'ffautoregen'90end9192def desc93'This plugin reloads and re-executes a file-format exploit module once it has changed'94end9596end97end9899100