From 97892d6a7d1c10754ad0e92c91daf5028aed8661 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Thu, 18 May 2023 21:20:28 -0400 Subject: [PATCH] idz: try-catch for userdb request decryption --- titles/idz/userdb.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/titles/idz/userdb.py b/titles/idz/userdb.py index 2f70ba4..2ac765e 100644 --- a/titles/idz/userdb.py +++ b/titles/idz/userdb.py @@ -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) - data_dec = crypt.decrypt(data) + + 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("