Class: Msf::Plugin::FFAutoRegen::FFAutoRegenCommandDispatcher

Inherits:
Object
  • Object
show all
Includes:
Ui::Console::CommandDispatcher
Defined in:
plugins/ffautoregen.rb

Overview

This class implements a single edit command.

Instance Attribute Summary

Attributes included from Ui::Console::CommandDispatcher

#driver

Attributes included from Rex::Ui::Text::DispatcherShell::CommandDispatcher

#shell, #tab_complete_items

Instance Method Summary collapse

Methods included from Ui::Console::CommandDispatcher

#active_module, #active_module=, #active_session, #active_session=, #build_range_array, #docs_dir, #framework, #initialize, #log_error, #remove_lines

Methods included from Rex::Ui::Text::DispatcherShell::CommandDispatcher

#cmd_help, #cmd_help_help, #cmd_help_tabs, #deprecated_cmd, #deprecated_commands, #deprecated_help, #docs_dir, #help_to_s, #initialize, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #tab_complete_directory, #tab_complete_filenames, #tab_complete_generic, #tab_complete_source_address, #update_prompt

Instance Method Details

#cmd_ffautoregen(*args) ⇒ Object

This method handles the command.


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'plugins/ffautoregen.rb', line 42

def cmd_ffautoregen(*args)
  if (not active_module) or (not (path = active_module.file_path))
    print_line("Error: No active module selected")
    return nil
  end

  last = mt = File.stat(path).mtime

  loop {
    sleep(1)
    mt = File.stat(path).mtime

    if (mt != last)
      last = mt

      omod = active_module
      nmod = framework.modules.reload_module(active_module)
      if not nmod
        print_line("Error: Failed to reload module, trying again on next change...")
        next
      end

      active_module = nmod

      jobify  = false
      payload = nmod.datastore['PAYLOAD']
      encoder = nmod.datastore['ENCODER']
      target  = nmod.datastore['TARGET']
      nop     = nmod.datastore['NOP']

      nmod.exploit_simple(
        'Encoder'        => encoder,
        'Payload'        => payload,
        'Target'         => target,
        'Nop'            => nop,
#						'OptionStr'      => opt_str,
        'LocalInput'     => driver.input,
        'LocalOutput'    => driver.output,
        'RunAsJob'       => jobify)
    end
  }
end

#commandsObject

Returns the hash of commands supported by this dispatcher.


33
34
35
36
37
# File 'plugins/ffautoregen.rb', line 33

def commands
  {
    "ffautoregen" => "Automatically regenerate the document when the exploit source changes"
  }
end

#nameObject

The dispatcher's name.


26
27
28
# File 'plugins/ffautoregen.rb', line 26

def name
  "FFAutoRegen"
end