idz: try-catch for userdb request decryption

This commit is contained in:
Hay1tsme 2023-05-18 21:20:28 -04:00
parent 013e83420b
commit 97892d6a7d

View File

@ -83,7 +83,13 @@ class IDZUserDBProtocol(Protocol):
def dataReceived(self, data: bytes) -> None:
self.logger.debug(f"Receive data {data.hex()}")
crypt = AES.new(self.static_key, AES.MODE_ECB)
try:
data_dec = crypt.decrypt(data)
except Exception as e:
self.logger.error(f"Failed to decrypt UserDB request from {self.transport.getPeer().host} because {e} - {data.hex()}")
self.logger.debug(f"Decrypt data {data_dec.hex()}")
magic = struct.unpack_from("<I", data_dec, 0)[0]