Module: Rex::Post::HWBridge::Ui::Console::CommandDispatcher
- Included in:
- Automotive, Core, CustomMethods, RFtransceiver, Zigbee
- Defined in:
- lib/rex/post/hwbridge/ui/console/command_dispatcher.rb
Overview
Base class for all command dispatchers within the hwbridge console user interface.
Defined Under Namespace
Classes: Automotive, Core, CustomMethods, RFtransceiver, Zigbee
Constant Summary collapse
- @@file_hash =
The hash of file names to class names after a module has already been loaded once on the client side.
{}
Instance Attribute Summary
Attributes included from Ui::Text::DispatcherShell::CommandDispatcher
Class Method Summary collapse
-
.check_hash(name) ⇒ Object
Checks the file name to hash association to see if the module being requested has already been loaded once.
-
.set_hash(name, klass) ⇒ Object
Sets the file path to class name association for future reference.
Instance Method Summary collapse
-
#client ⇒ Object
Returns the hwbridge client context.
- #initialize(shell) ⇒ Object
-
#log_error(msg) ⇒ Object
Log that an error occurred.
-
#msf_loaded? ⇒ Boolean
Returns true if the client has a framework object.
Methods included from Ui::Text::DispatcherShell::CommandDispatcher
#cmd_help, #cmd_help_help, #cmd_help_tabs, #commands, #deprecated_cmd, #deprecated_commands, #deprecated_help, #docs_dir, #help_to_s, included, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #tab_complete_directory, #tab_complete_filenames, #tab_complete_generic, #tab_complete_source_address, #unknown_command, #update_prompt
Class Method Details
.check_hash(name) ⇒ Object
Checks the file name to hash association to see if the module being requested has already been loaded once.
28 29 30 |
# File 'lib/rex/post/hwbridge/ui/console/command_dispatcher.rb', line 28 def self.check_hash(name) @@file_hash[name] end |
.set_hash(name, klass) ⇒ Object
Sets the file path to class name association for future reference.
35 36 37 |
# File 'lib/rex/post/hwbridge/ui/console/command_dispatcher.rb', line 35 def self.set_hash(name, klass) @@file_hash[name] = klass end |
Instance Method Details
#client ⇒ Object
Returns the hwbridge client context.
47 48 49 |
# File 'lib/rex/post/hwbridge/ui/console/command_dispatcher.rb', line 47 def client shell.client end |
#initialize(shell) ⇒ Object
39 40 41 42 |
# File 'lib/rex/post/hwbridge/ui/console/command_dispatcher.rb', line 39 def initialize(shell) @msf_loaded = nil super end |
#log_error(msg) ⇒ Object
Log that an error occurred.
67 68 69 70 71 |
# File 'lib/rex/post/hwbridge/ui/console/command_dispatcher.rb', line 67 def log_error(msg) print_error(msg) elog(msg, 'hwbridge', error: $!) end |
#msf_loaded? ⇒ Boolean
Returns true if the client has a framework object.
Used for firing framework session events
56 57 58 59 60 61 62 |
# File 'lib/rex/post/hwbridge/ui/console/command_dispatcher.rb', line 56 def msf_loaded? return @msf_loaded unless @msf_loaded.nil? # if we get here we must not have initialized yet @msf_loaded = !!(client.framework) @msf_loaded end |