mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-27 09:23:03 +03:00
perform dfc checks before spad decryption
This commit is contained in:
@@ -112,13 +112,22 @@ async function readAmusementICCardContents(idm: string): Promise<AmusementICCard
|
||||
return null;
|
||||
}
|
||||
|
||||
const accessCode = performDecrypt(new Uint8Array(response.slice(12, 28)));
|
||||
const dfcValue = response[37] | (response[36] << 8);
|
||||
|
||||
if (dfcValue in AmusementICVendor && dfcValue !== AmusementICVendor.Unknown) {
|
||||
const accessCode = performDecrypt(new Uint8Array(response.slice(12, 28)));
|
||||
return {
|
||||
type: ICType.Amusement,
|
||||
accessCode: [...accessCode.accessCodeBytes].map(x => x.toString(16).padStart(2, '0')).join(''),
|
||||
vendor: dfcValue,
|
||||
idm
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
type: ICType.Amusement,
|
||||
accessCode: [...accessCode.accessCodeBytes].map(x => x.toString(16).padStart(2, '0')).join(''),
|
||||
vendor: dfcValue in AmusementICVendor ? dfcValue : AmusementICVendor.Unknown,
|
||||
accessCode: icCard0008Number(idm),
|
||||
vendor: AmusementICVendor.Unknown,
|
||||
idm
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user