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, #load_config, #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, included, #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, #unknown_command, #update_prompt

Instance Method Details

#cmd_ffautoregen(*_args) ⇒ Object

This method handles the command.



36
37
38
39
40
41
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
# File 'plugins/ffautoregen.rb', line 36

def cmd_ffautoregen(*_args)
  if !active_module || !(path = active_module.file_path)
    print_line('Error: No active module selected')
    return nil
  end

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

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

    next unless (mt != last)

    last = mt

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

    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.



27
28
29
30
31
# File 'plugins/ffautoregen.rb', line 27

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

#nameObject

The dispatcher’s name.



20
21
22
# File 'plugins/ffautoregen.rb', line 20

def name
  'FFAutoRegen'
end