module Rex::Post::Meterpreter::Ui::Console::CommandDispatcher

Base class for all command dispatchers within the meterpreter console user interface.

Public Class Methods

check_hash(name) click to toggle source

Checks the file name to hash association to see if the module being requested has already been loaded once.

# File lib/rex/post/meterpreter/ui/console/command_dispatcher.rb, line 28
def self.check_hash(name)
  @@file_hash[name]
end
new(shell) click to toggle source
# File lib/rex/post/meterpreter/ui/console/command_dispatcher.rb, line 39
def initialize(shell)
  @msf_loaded = nil
  super
end
set_hash(name, klass) click to toggle source

Sets the file path to class name association for future reference.

# File lib/rex/post/meterpreter/ui/console/command_dispatcher.rb, line 35
def self.set_hash(name, klass)
  @@file_hash[name] = klass
end

Public Instance Methods

client() click to toggle source

Returns the meterpreter client context.

# File lib/rex/post/meterpreter/ui/console/command_dispatcher.rb, line 47
def client
  shell.client
end
log_error(msg) click to toggle source

Log that an error occurred.

# File lib/rex/post/meterpreter/ui/console/command_dispatcher.rb, line 72
def log_error(msg)
  print_error(msg)

  elog(msg, 'meterpreter')

  dlog("Call stack:\n#{$@.join("\n")}", 'meterpreter')
end
msf_loaded?() click to toggle source

Returns true if the client has a framework object.

Used for firing framework session events

# File lib/rex/post/meterpreter/ui/console/command_dispatcher.rb, line 56
def msf_loaded?
  return @msf_loaded unless @msf_loaded.nil?
  # if we get here we must not have initialized yet

  if client.framework
    # We have a framework instance so the msf libraries should be
    # available.  Load up the ones we're going to use
    require 'msf/base/serializer/readable_text'
  end
  @msf_loaded = !!(client.framework)
  @msf_loaded
end