def recv_task(self): """ Receive and decrypt incoming task from server :returns dict task: :attr str uid: task ID assigned by server :attr str session: client ID assigned by server :attr str task: task assigned by server :attr str result: task result completed by client :attr datetime issued: time task was issued by server :attr datetime completed: time task was completed by client """ try: header_size = struct.calcsize('!L') header = self.connection.recv(header_size) if len(header) == 4: msg_size = struct.unpack('!L', header)[0] msg = self.connection.recv(msg_size) data = security.decrypt_aes(msg, self.key) return json.loads(data) else: # empty header; peer down, scan or recon. Drop. return 0 except Exception as e: return str(e)
def client_info(self): """ Get information about the client host machine to identify the session """ header_size = struct.calcsize("!L") header = self.connection.recv(header_size) msg_size = struct.unpack("!L", header)[0] msg = self.connection.recv(msg_size) data = security.decrypt_aes(msg, self.key) info = json.loads(data) return info
def client_info(self): """ Get information about the client host machine to identify the session """ header_size = struct.calcsize("!L") header = self.connection.recv(header_size) msg_size = struct.unpack("!L", header)[0] msg = self.connection.recv(msg_size) data = security.decrypt_aes(msg, self.key) info = json.loads(data) return info
def client_info(self): """ Get information about the client host machine to identify the session """ header_size = struct.calcsize("!L") header = self.connection.recv(header_size) msg_size = struct.unpack("!L", header)[0] msg = self.connection.recv(msg_size) data = security.decrypt_aes(msg, self.key) info = json.loads(data) for item in [item for item in info if "_b64" in str(info[item])[0:5]]: info[item] = base64.b64decode(bytes(info[item][6:])).decode('ascii') return info
def client_info(self): """ Get information about the client host machine to identify the session """ header_size = struct.calcsize("!L") header = self.connection.recv(header_size) msg_size = struct.unpack("!L", header)[0] msg = self.connection.recv(msg_size) data = security.decrypt_aes(msg, self.key) info = json.loads(data) for item in [item for item in info if info[item].startswith("_b64")]: info[item] = base64.decodebytes(info[item].decode('ascii')) return info
def client_info(self): """ Get information about the client host machine to identify the session """ header_size = struct.calcsize("!L") header = self.connection.recv(header_size) msg_size = struct.unpack("!L", header)[0] msg = self.connection.recv(msg_size) data = security.decrypt_aes(msg, self.key) info = json.loads(data) for key, val in info.items(): if str(val).startswith("_b64"): info[key] = base64.b64decode(str(val[6:])).decode('ascii') return info
def recv_task(self): """ Receive and decrypt incoming task from server :returns dict task: :attr str uid: task ID assigned by server :attr str session: client ID assigned by server :attr str task: task assigned by server :attr str result: task result completed by client :attr datetime issued: time task was issued by server :attr datetime completed: time task was completed by client """ header_size = struct.calcsize('!L') header = self.connection.recv(header_size) msg_size = struct.unpack('!L', header)[0] msg = self.connection.recv(msg_size) data = security.decrypt_aes(msg, self.key) return json.loads(data)
def recv_task(self): """ Receive and decrypt incoming task from server :returns dict task: :attr str uid: task ID assigned by server :attr str session: client ID assigned by server :attr str task: task assigned by server :attr str result: task result completed by client :attr datetime issued: time task was issued by server :attr datetime completed: time task was completed by client """ header_size = struct.calcsize('!L') header = self.connection.recv(header_size) msg_size = struct.unpack('!L', header)[0] msg = self.connection.recv(msg_size) data = security.decrypt_aes(msg, self.key) return json.loads(data)