Sha256: dc69b91c391113db6e4e9a59eb129cb091d979ac3c388a71e43cc212c6320f0e

Contents?: true

Size: 1.48 KB

Versions: 27

Compression:

Stored size: 1.48 KB

Contents

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

27 entries across 27 versions & 1 rubygems

Version Path
librex-0.0.65 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.63 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.54 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.53 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.52 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.51 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.50 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.49 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.48 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.47 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.46 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.44 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.43 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.42 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.41 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.40 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.39 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.38 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.37 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb
librex-0.0.36 lib/rex/post/meterpreter/ui/console/command_dispatcher.rb