prevent setting chipid if it's 0x04030201
This commit is contained in:
parent
f252b8e322
commit
068aa5eaa3
@ -194,9 +194,9 @@ class AimedbServlette():
|
|||||||
|
|
||||||
if user_id and user_id > 0:
|
if user_id and user_id > 0:
|
||||||
await self.data.card.update_card_last_login(req.access_code)
|
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)
|
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
|
return ret
|
||||||
|
|
||||||
async def handle_lookup_ex(self, data: bytes, resp_code: int) -> ADBBaseResponse:
|
async def handle_lookup_ex(self, data: bytes, resp_code: int) -> ADBBaseResponse:
|
||||||
@ -370,7 +370,7 @@ class AimedbServlette():
|
|||||||
)
|
)
|
||||||
|
|
||||||
if user_id > 0:
|
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)
|
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} for access code {req.access_code}")
|
||||||
|
|
||||||
|
@ -165,7 +165,8 @@ class PokkenBase:
|
|||||||
f"Register new card {access_code} (UserId {user_id}, CardId {card_id})"
|
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:
|
elif card is None:
|
||||||
self.logger.info(f"Registration of card {access_code} blocked!")
|
self.logger.info(f"Registration of card {access_code} blocked!")
|
||||||
@ -175,7 +176,7 @@ class PokkenBase:
|
|||||||
else:
|
else:
|
||||||
user_id = card['user']
|
user_id = card['user']
|
||||||
card_id = card['id']
|
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))
|
await self.data.card.set_chip_id_by_access_code(access_code, int(request.load_user.chip_id[:8], 16))
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -85,7 +85,7 @@ class SaoBase:
|
|||||||
card_id = await self.data.card.create_card(user_id, req.access_code)
|
card_id = await self.data.card.create_card(user_id, req.access_code)
|
||||||
if req.access_code.startswith("5"):
|
if req.access_code.startswith("5"):
|
||||||
await self.data.card.set_idm_by_access_code(card_id, req.chip_id[:16])
|
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))
|
await self.data.card.set_chip_id_by_access_code(card_id, int(req.chip_id[:8], 16))
|
||||||
|
|
||||||
if card_id is None:
|
if card_id is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user