fix MFP check with defines and easier logic

This commit is contained in:
iceman1001 committed 2023-04-15 20:44:52 +02:00
1 parent 1f1c1d1458
commit 1bb78e02a4
2 files changed
+11 -8

No files matched your search

+7 -6
View File
@@ -1023,8 +1023,8 @@ static int MFPKeyCheck(uint8_t startSector, uint8_t endSector, uint8_t startKeyA
keyn[1] = uKeyNum & 0xff;
for (int retry = 0; retry < 4; retry++) {
res = MifareAuth4(NULL, keyn, keyList[i], selectCard, true, false, false, true);
if (res != 2)
res = MifareAuth4(NULL, keyn, keyList[i], selectCard, true, false, false, true);
if (res == PM3_SUCCESS || PM3_EWRONGANSWER)
break;
if (verbose)
@@ -1041,7 +1041,7 @@ static int MFPKeyCheck(uint8_t startSector, uint8_t endSector, uint8_t startKeyA
PrintAndLogEx(WARNING, "\nsector %02d key %d [%s] res: %d", sector, keyAB, sprint_hex_inrow(keyList[i], 16), res);
// key for [sector,keyAB] found
if (res == 0) {
if (res == PM3_SUCCESS) {
if (verbose)
PrintAndLogEx(INFO, "\nFound key for sector %d key %s [%s]", sector, keyAB == 0 ? "A" : "B", sprint_hex_inrow(keyList[i], 16));
else
@@ -1055,9 +1055,10 @@ static int MFPKeyCheck(uint8_t startSector, uint8_t endSector, uint8_t startKeyA
break;
}
// 5 - auth error (rnd not equal)
// PM3 client says that RND not equal is -16. Corrected. Seems to work.
if (res != -16) {
// RES can be:
// PM3_ERFTRANS -7
// PM3_EWRONGANSWER -16
if (res == PM3_ERFTRANS) {
if (verbose)
PrintAndLogEx(ERR, "\nExchange error. Aborted.");
else