Module: Msf::Ui::Console::CommandDispatcher

Includes:
Rex::Ui::Text::DispatcherShell::CommandDispatcher
Included in:
Core, Db, ModuleCommandDispatcher
Defined in:
lib/msf/ui/console/command_dispatcher.rb,
lib/msf/ui/console/command_dispatcher/db.rb,
lib/msf/ui/console/command_dispatcher/nop.rb,
lib/msf/ui/console/command_dispatcher/post.rb,
lib/msf/ui/console/command_dispatcher/core.rb,
lib/msf/ui/console/command_dispatcher/exploit.rb,
lib/msf/ui/console/command_dispatcher/encoder.rb,
lib/msf/ui/console/command_dispatcher/payload.rb,
lib/msf/ui/console/command_dispatcher/auxiliary.rb

Overview

The common command dispatcher base class that is shared for component-specific command dispatching.

Defined Under Namespace

Classes: Auxiliary, Core, Db, Encoder, Exploit, Nop, Payload, Post

Instance Attribute Summary collapse

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

#shell, #tab_complete_items

Instance Method Summary collapse

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

#cmd_help, #cmd_help_help, #cmd_help_tabs, #commands, #deprecated_cmd, #deprecated_commands, #deprecated_help, #help_to_s, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #tab_complete_filenames, #update_prompt

Instance Attribute Details

#driverObject

The driver that this command dispatcher is associated with.


86
87
88
# File 'lib/msf/ui/console/command_dispatcher.rb', line 86

def driver
  @driver
end

Instance Method Details

#active_moduleObject

Returns the active module if one has been selected, otherwise nil is returned.


38
39
40
# File 'lib/msf/ui/console/command_dispatcher.rb', line 38

def active_module
  driver.active_module
end

#active_module=(mod) ⇒ Object

Sets the active module for this driver instance.


45
46
47
# File 'lib/msf/ui/console/command_dispatcher.rb', line 45

def active_module=(mod)
  driver.active_module = mod
end

#active_sessionObject

Returns the active session if one has been selected, otherwise nil is returned.


53
54
55
# File 'lib/msf/ui/console/command_dispatcher.rb', line 53

def active_session
  driver.active_session
end

#active_session=(mod) ⇒ Object

Sets the active session for this driver instance.


60
61
62
# File 'lib/msf/ui/console/command_dispatcher.rb', line 60

def active_session=(mod)
  driver.active_session = mod
end

#defanged?Boolean

Checks to see if the driver is defanged.

Returns:

  • (Boolean)

66
67
68
# File 'lib/msf/ui/console/command_dispatcher.rb', line 66

def defanged?
  driver.defanged?
end

#frameworkObject

Returns the framework instance associated with this command dispatcher.


30
31
32
# File 'lib/msf/ui/console/command_dispatcher.rb', line 30

def framework
  return driver.framework
end

#initialize(driver) ⇒ Object

Initializes a command dispatcher instance.


20
21
22
23
24
25
# File 'lib/msf/ui/console/command_dispatcher.rb', line 20

def initialize(driver)
  super

  self.driver = driver
  self.driver.on_command_proc = Proc.new { |command| framework.events.on_ui_command(command) }
end

#log_error(err) ⇒ Object

Logs an error message to the screen and the log file. The callstack is also printed.


74
75
76
77
78
79
80
81
# File 'lib/msf/ui/console/command_dispatcher.rb', line 74

def log_error(err)
  print_error(err)

  wlog(err)

  # If it's a syntax error, log the call stack that it originated from.
  dlog("Call stack:\n#{[email protected].join("\n")}", 'core', LEV_1)
end