lib/rex/post/meterpreter/ui/console/command_dispatcher.rb in librex-0.0.28 vs lib/rex/post/meterpreter/ui/console/command_dispatcher.rb in librex-0.0.29
- old
+ new
@@ -34,18 +34,41 @@
#
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)
@@ -57,6 +80,6 @@
end
end
end
end
-end
\ No newline at end of file
+end