def command_use(self, module_path, *args, **kwargs): module_path = utils.pythonize_path(module_path) module_path = '.'.join(('routersploit', 'modules', module_path)) # module_path, _, exploit_name = module_path.rpartition('.') try: module = importlib.import_module(module_path) self.current_module = getattr(module, 'Exploit')() except (ImportError, AttributeError, KeyError): utils.print_error("Error during loading '{}' module".format(utils.humanize_path(module_path)))
def command_search(self, *args, **kwargs): keyword = args[0] if not keyword: utils.print_error("Please specify search keyword. e.g. 'search cisco'") return for module in self.modules: if keyword in module: module = utils.humanize_path(module) utils.print_info( "{}\033[31m{}\033[0m{}".format(*module.partition(keyword)) )
def command_use(self, module_path, *args, **kwargs): module_path = utils.pythonize_path(module_path) module_path = '.'.join(('routersploit', 'modules', module_path)) # module_path, _, exploit_name = module_path.rpartition('.') try: module = importlib.import_module(module_path) self.current_module = getattr(module, 'Exploit')() except (ImportError, AttributeError, KeyError): utils.print_error( "Error during loading '{}' module. " "It should be valid path to the module. " "Use <tab> key multiple times for completion.".format( utils.humanize_path(module_path)))
def command_search(self, *args, **kwargs): keyword = args[0] if not keyword: utils.print_error( "Please specify search keyword. e.g. 'search cisco'") return for module in self.modules: if keyword in module: module = utils.humanize_path(module) utils.print_info( "{}\033[31m{}\033[0m{}".format(*module.partition(keyword)))