def __init__(self, prompt_session): self.name = 'sessions' self.prompt = HTML('ST (<ansired>sessions</ansired>) ≫ ') self.completer = WordCompleter(['info', 'list', 'stagers', 'listeners', 'modules', 'exit']) self.prompt_session = prompt_session self.sessions = [] ipc_server.attach(NEW_SESSION, self.__add_session) ipc_server.attach(SESSION_STAGED, self.__notify_session_staged) ipc_server.attach(SESSION_CHECKIN, self.__session_checked_in) ipc_server.attach(NEW_JOB, self.__add_job) ipc_server.attach(JOB_RESULT, self.__job_result)
def __init__(self, prompt_session): self.name = 'sessions' self.prompt = HTML('ST (<ansired>sessions</ansired>) ≫ ') self.completer = STCompleter(self) self.prompt_session = prompt_session self.selected = None self.sessions = [] ipc_server.attach(NEW_SESSION, self.__add_session) ipc_server.attach(SESSION_STAGED, self.__notify_session_staged) ipc_server.attach(SESSION_CHECKIN, self.__session_checked_in) ipc_server.attach(NEW_JOB, self.__add_job) ipc_server.attach(JOB_RESULT, self.__job_result)
def __init__(self, prompt_session): Loader.__init__(self) self.type = "listener" self.paths = ["listeners/"] self.listeners = [] self.name = 'listeners' self.prompt = HTML('ST (<ansired>listeners</ansired>) ≫ ') self.completer = WordCompleter(['start', 'set', 'sessions', 'modules', 'stagers', 'options', 'use', 'exit', 'list'], ignore_case=True) self.prompt_session = prompt_session self.selected = None ipc_server.attach(GET_LISTENERS, self.__get_running_listeners) self.get_loadables()
def __init__(self, prompt_session): Loader.__init__(self) self.type = "listener" self.paths = ["listeners/"] self.listeners = [] self.name = 'listeners' self.prompt = HTML('ST (<ansired>listeners</ansired>) ≫ ') self.completer = STCompleter(self) self.prompt_session = prompt_session self.selected = None ipc_server.attach(GET_LISTENERS, self.__get_running_listeners) self.get_loadables()
def __init__(self, prompt_session): Loader.__init__(self) self.type = "stager" self.paths = ["stagers/"] self.name = 'stagers' self.description = 'Stager menu' self.prompt = HTML('ST (<ansired>stagers</ansired>) ≫ ') self.completer = STCompleter(self) self.prompt_session = prompt_session self.selected = None ipc_server.attach(events.GET_STAGERS, self.get_stagers) self.get_loadables()
def __init__(self, prompt_session): Loader.__init__(self) self.type = "listener" self.paths = ["listeners/"] self.listeners = [] self.name = 'listeners' self.description = 'Listener menu' self.prompt = HTML('ST (<ansired>listeners</ansired>) ≫ ') self.completer = STCompleter(self) self.prompt_session = prompt_session self.selected = None ipc_server.attach(events.GET_LISTENERS, self.get_listeners) self.get_loadables()
def __init__(self, prompt_session): self.name = 'sessions' self.description = 'Session menu' self.prompt = HTML('ST (<ansired>sessions</ansired>) ≫ ') self.completer = STCompleter(self) self.prompt_session = prompt_session self.selected = None self.sessions = set() """ The following code sucks. We can probably pull some really fancy stuff here like registring functions using decorators in each Session object so when an event is published it gets routed directly to the right session with the appropriate GUID. This would be ideal as it would remove almost all of these helper functions. I've tried doing this but it resulted in me drinking a lot with very little success. """ ipc_server.attach(events.KEX, self.kex) ipc_server.attach(events.ENCRYPT_STAGE, self.gen_encrypted_stage) ipc_server.attach(events.SESSION_STAGED, self.notify_session_staged) ipc_server.attach(events.SESSION_CHECKIN, self.session_checked_in) ipc_server.attach(events.NEW_JOB, self.add_job) ipc_server.attach(events.JOB_RESULT, self.job_result)
def register_event_subscriptions(cls): for methodname in dir(cls): method = getattr(cls, methodname) if hasattr(method, '_subscription'): ipc_server.attach(method._subscription, method) return cls