def command_use(self, module_path, *args, **kwargs): if module_path.startswith("extra_"): module_path = utils.pythonize_path(module_path) else: module_path = utils.pythonize_path(module_path) module_path = '.'.join(('icssploit', 'modules', module_path)) try: self.current_module = utils.import_exploit(module_path)() except icssploitException as err: utils.print_error(err.message)
def available_modules_completion(self, text): """ Looking for tab completion hints using setup.py entry_points. May need optimization in the future! :param text: argument of 'use' command :return: list of tab completion hints """ text = utils.pythonize_path(text) all_possible_matches = filter(lambda x: x.startswith(text), self.modules) matches = set() for match in all_possible_matches: head, sep, tail = match[len(text):].partition('.') if not tail: sep = "" matches.add("".join((text, head, sep))) return list(map(utils.humanize_path, matches)) # humanize output, replace dots to forward slashes