From 068aa5eaa3f11372864d415a95a228c43d4519d8 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sun, 23 Jun 2024 22:09:56 -0400 Subject: [PATCH] prevent setting chipid if it's 0x04030201 --- core/aimedb.py | 6 +++--- titles/pokken/base.py | 5 +++-- titles/sao/base.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/aimedb.py b/core/aimedb.py index c6887d3..ab400c2 100644 --- a/core/aimedb.py +++ b/core/aimedb.py @@ -194,9 +194,9 @@ class AimedbServlette(): if user_id and user_id > 0: await self.data.card.update_card_last_login(req.access_code) - if req.access_code.startswith("010") or req.access_code.startswith("3"): + if req.access_code.startswith("010") or req.access_code.startswith("3") and req.serial_number != 0x04030201: # Default segatools sn await self.data.card.set_chip_id_by_access_code(req.access_code, req.serial_number) - self.logger.info(f"Attempt to set chip id to {req.serial_number} for access code {req.access_code}") + self.logger.info(f"Attempt to set chip id to {req.serial_number:08X} for access code {req.access_code}") return ret async def handle_lookup_ex(self, data: bytes, resp_code: int) -> ADBBaseResponse: @@ -370,7 +370,7 @@ class AimedbServlette(): ) if user_id > 0: - if req.access_code.startswith("010") or req.access_code.startswith("3"): + if req.access_code.startswith("010") or req.access_code.startswith("3") and req.serial_number != 0x04030201: # Default segatools sn: await self.data.card.set_chip_id_by_access_code(req.access_code, req.serial_number) self.logger.info(f"Attempt to set chip id to {req.serial_number} for access code {req.access_code}") diff --git a/titles/pokken/base.py b/titles/pokken/base.py index ee0d134..78ca863 100644 --- a/titles/pokken/base.py +++ b/titles/pokken/base.py @@ -165,7 +165,8 @@ class PokkenBase: f"Register new card {access_code} (UserId {user_id}, CardId {card_id})" ) - await self.data.card.set_chip_id_by_access_code(access_code, int(request.load_user.chip_id[:8], 16)) + if int(request.load_user.chip_id[:8], 16) != 0x04030201: + await self.data.card.set_chip_id_by_access_code(access_code, int(request.load_user.chip_id[:8], 16)) elif card is None: self.logger.info(f"Registration of card {access_code} blocked!") @@ -175,7 +176,7 @@ class PokkenBase: else: user_id = card['user'] card_id = card['id'] - if not card['chip_id']: + if not card['chip_id'] and int(request.load_user.chip_id[:8], 16) != 0x04030201: # Default segatools sn: await self.data.card.set_chip_id_by_access_code(access_code, int(request.load_user.chip_id[:8], 16)) """ diff --git a/titles/sao/base.py b/titles/sao/base.py index 76a1def..da982d8 100644 --- a/titles/sao/base.py +++ b/titles/sao/base.py @@ -85,7 +85,7 @@ class SaoBase: card_id = await self.data.card.create_card(user_id, req.access_code) if req.access_code.startswith("5"): await self.data.card.set_idm_by_access_code(card_id, req.chip_id[:16]) - elif req.access_code.startswith("010") or req.access_code.startswith("3"): + elif req.access_code.startswith("010") or req.access_code.startswith("3") and int(req.chip_id[:8], 16) != 0x04030201: await self.data.card.set_chip_id_by_access_code(card_id, int(req.chip_id[:8], 16)) if card_id is None: