Module: Rex::Post::Meterpreter::ObjectAliasesContainer

Included in:
Extensions::Stdapi::Sys::Process, Extensions::Stdapi::Sys::Thread, Extensions::Stdapi::UI, ObjectAliases
Defined in:
lib/rex/post/meterpreter/object_aliases.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object

Pass-thru aliases.



26
27
28
# File 'lib/rex/post/meterpreter/object_aliases.rb', line 26

def method_missing(symbol, *args)
	self.aliases[symbol.to_s]
end

Instance Attribute Details

#aliasesObject

The hash of aliases.



59
60
61
# File 'lib/rex/post/meterpreter/object_aliases.rb', line 59

def aliases
  @aliases
end

Instance Method Details

#dump_alias_tree(parent_path, current = nil) ⇒ Object

Recursively dumps all of the aliases registered with a class that is kind_of? ObjectAliases.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rex/post/meterpreter/object_aliases.rb', line 34

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

#initialize_aliases(aliases = {}) ⇒ Object

Initialize the instance’s aliases.



19
20
21
# File 'lib/rex/post/meterpreter/object_aliases.rb', line 19

def initialize_aliases(aliases = {})
	self.aliases = aliases
end