Sha256: 7485617f3cde7d2ec692cb587aede2fc68123efe4377c06183f48d546a794e63

Contents?: true

Size: 1.58 KB

Versions: 15

Compression:

Stored size: 1.58 KB

Contents

# -*- coding: binary -*-
require 'rex/logging'

module Rex
module Post
module Meterpreter
module Ui

###
#
# Base class for all command dispatchers within the meterpreter console user
# interface.
#
###
module Console::CommandDispatcher

  include Rex::Ui::Text::DispatcherShell::CommandDispatcher

  #
  # The hash of file names to class names after a module has already been
  # loaded once on the client side.
  #
  @@file_hash = {}

  #
  # Checks the file name to hash association to see if the module being
  # requested has already been loaded once.
  #
  def self.check_hash(name)
    @@file_hash[name]
  end

  #
  # Sets the file path to class name association for future reference.
  #
  def self.set_hash(name, klass)
    @@file_hash[name] = klass
  end

  def initialize(shell)
    @msf_loaded = nil
    super
  end

  #
  # Returns the meterpreter client context.
  #
  def client
    shell.client
  end

  #
  # Returns true if the client has a framework object.
  #
  # Used for firing framework session events
  #
  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

  #
  # Log that an error occurred.
  #
  def log_error(msg)
    print_error(msg)

    elog(msg, 'meterpreter')

    dlog("Call stack:\n#{$@.join("\n")}", 'meterpreter')
  end

end

end
end
end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
rex-2.0.13 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.12 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.11 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.10 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.9 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.8 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.7 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.5 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.4 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
dstruct-0.0.1 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.3 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.999 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
rex-2.0.2 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.71 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.70 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb