1
0
mirror of synced 2024-11-14 09:47:46 +01:00

aimedb: add warning for all-zero access code/idm

This commit is contained in:
Hay1tsme 2024-07-18 13:30:46 -04:00
parent 02cee4198d
commit 68bbde209a

View File

@ -177,6 +177,7 @@ class AimedbServlette():
async def handle_lookup(self, data: bytes, resp_code: int) -> ADBBaseResponse: async def handle_lookup(self, data: bytes, resp_code: int) -> ADBBaseResponse:
req = ADBLookupRequest(data) req = ADBLookupRequest(data)
if req.access_code == "00000000000000000000": if req.access_code == "00000000000000000000":
self.logger.warn(f"All-zero access code from {req.head.keychip_id}")
ret = ADBLookupResponse.from_req(req.head, -1) ret = ADBLookupResponse.from_req(req.head, -1)
ret.head.status = ADBStatus.BAN_SYS ret.head.status = ADBStatus.BAN_SYS
return ret return ret
@ -207,6 +208,7 @@ class AimedbServlette():
async def handle_lookup_ex(self, data: bytes, resp_code: int) -> ADBBaseResponse: async def handle_lookup_ex(self, data: bytes, resp_code: int) -> ADBBaseResponse:
req = ADBLookupRequest(data) req = ADBLookupRequest(data)
if req.access_code == "00000000000000000000": if req.access_code == "00000000000000000000":
self.logger.warn(f"All-zero access code from {req.head.keychip_id}")
ret = ADBLookupExResponse.from_req(req.head, -1) ret = ADBLookupExResponse.from_req(req.head, -1)
ret.head.status = ADBStatus.BAN_SYS ret.head.status = ADBStatus.BAN_SYS
return ret return ret
@ -252,6 +254,7 @@ class AimedbServlette():
req = ADBFelicaLookupRequest(data) req = ADBFelicaLookupRequest(data)
idm = req.idm.zfill(16) idm = req.idm.zfill(16)
if idm == "0000000000000000": if idm == "0000000000000000":
self.logger.warn(f"All-zero IDm from {req.head.keychip_id}")
ret = ADBFelicaLookupResponse.from_req(req.head, "00000000000000000000") ret = ADBFelicaLookupResponse.from_req(req.head, "00000000000000000000")
ret.head.status = ADBStatus.BAN_SYS ret.head.status = ADBStatus.BAN_SYS
return ret return ret
@ -280,6 +283,7 @@ class AimedbServlette():
idm = req.idm.zfill(16) idm = req.idm.zfill(16)
if idm == "0000000000000000": if idm == "0000000000000000":
self.logger.warn(f"All-zero IDm from {req.head.keychip_id}")
ret = ADBFelicaLookupResponse.from_req(req.head, "00000000000000000000") ret = ADBFelicaLookupResponse.from_req(req.head, "00000000000000000000")
ret.head.status = ADBStatus.BAN_SYS ret.head.status = ADBStatus.BAN_SYS
return ret return ret
@ -319,6 +323,7 @@ class AimedbServlette():
idm = req.idm.zfill(16) idm = req.idm.zfill(16)
if idm == "0000000000000000": if idm == "0000000000000000":
self.logger.warn(f"All-zero IDm from {req.head.keychip_id}")
ret = ADBFelicaLookupExResponse.from_req(req.head, -1, "00000000000000000000") ret = ADBFelicaLookupExResponse.from_req(req.head, -1, "00000000000000000000")
ret.head.status = ADBStatus.BAN_SYS ret.head.status = ADBStatus.BAN_SYS
return ret return ret
@ -377,6 +382,7 @@ class AimedbServlette():
user_id = -1 user_id = -1
if req.access_code == "00000000000000000000": if req.access_code == "00000000000000000000":
self.logger.warn(f"All-zero access code from {req.head.keychip_id}")
ret = ADBLookupResponse.from_req(req.head, -1) ret = ADBLookupResponse.from_req(req.head, -1)
ret.head.status = ADBStatus.BAN_SYS ret.head.status = ADBStatus.BAN_SYS
return ret return ret