Sha256: d88434ea7fb560cb3f241fa249ffa7f697d724c960d7104b545d48b994e6c184

Contents?: true

Size: 1.34 KB

Versions: 43

Compression:

Stored size: 1.34 KB

Contents

#!/usr/bin/env ruby

module Rex
module Post
module Meterpreter

###
#
# Mixin for classes that wish to have object aliases but do not
# really need to inherit from the ObjectAliases class.
#
###
module ObjectAliasesContainer

	#
	# Initialize the instance's aliases.
	#
	def initialize_aliases(aliases = {})
		self.aliases = aliases
	end

	#
	# Pass-thru aliases.
	#
	def method_missing(symbol, *args)
		self.aliases[symbol.to_s]
	end

	#
	# Recursively dumps all of the aliases registered with a class that
	# is kind_of? ObjectAliases.
	#
	def dump_alias_tree(parent_path, current = nil)
		items = []

		if (current == nil)
			current = self
		end

		# If the current object may have object aliases...
		if (current.kind_of?(Rex::Post::Meterpreter::ObjectAliases))
			current.aliases.each_key { |x|
				current_path = parent_path + '.' + x

				items << current_path

				items.concat(dump_alias_tree(current_path, 
					current.aliases[x]))
			}
		end

		return items
	end

	#
	# The hash of aliases.
	#
	attr_accessor :aliases
end

###
#
# Generic object aliases from a class instance referenced symbol to an 
# associated object of an arbitrary type
#
###
class ObjectAliases
	include Rex::Post::Meterpreter::ObjectAliasesContainer
	
	##
	#
	# Constructor
	#
	##
	
	# An instance
	def initialize(aliases = {})
		initialize_aliases(aliases)
	end
end


end; end; end

Version data entries

43 entries across 43 versions & 1 rubygems

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