def jitter(self, guid, max, min): try: session = self.get_session(guid) if min: session.jobs.add(Job(command=('Jitter', [int(max), int(min)]))) else: session.jobs.add(Job(command=('Jitter', [int(max)]))) except SessionNotFoundError: raise CmdError(f"No session named: {guid}")
def kill(self, guid): try: session = self.get_session(guid) session.jobs.add(Job(command=('Exit', []))) return {'guid': guid, 'status': 'Tasked to exit'} except SessionNotFoundError: raise CmdError(f"No session named: {guid}")
def checkin(self, guid): try: session = self.get_session(guid) session.jobs.add(Job(command=('CheckIn', []))) except SessionNotFoundError: raise CmdError(f"No session named: {guid}")
def sleep(self, guid, interval): try: session = self.get_session(guid) session.jobs.add(Job(command=('Sleep', [int(interval)]))) except SessionNotFoundError: raise CmdError(f"No session named: {guid}")
def run(self, guids): for guid in guids: ipc_server.publish_event(Events.NEW_JOB, (guid, Job(module=self.selected)))
def __init__(self, session): self.session = session self.jobs = [] self.jobs.append(Job(command=('CheckIn', [])))