fix info, add there desfire light tests

This commit is contained in:
merlokk 2021-08-25 13:57:35 +03:00
commit 81343f0ec1
2 changed files with 14 additions and 11 deletions

View file

@ -688,15 +688,20 @@ static int CmdHF14ADesInfo(const char *Cmd) {
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("Desfire Light info")); PrintAndLogEx(INFO, "--- " _CYAN_("Desfire Light info"));
if (DesfireSelect(&dctx, ISWIsoID, 0xdf01, NULL) == PM3_SUCCESS) if (DesfireSelect(&dctx, ISWIsoID, 0xdf01, NULL) == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, " Card have " _GREEN_("default (0xdf01)") " iso id for application"); PrintAndLogEx(SUCCESS, " Card have " _GREEN_("default (0xdf01)") " iso id for application");
else
PrintAndLogEx(SUCCESS, " Card have " _RED_("not a default") " iso id for application");
if (DesfireCheckAuthCmd(ISWIsoID, 0x3f00, 1, MFDES_AUTHENTICATE_EV2F, false)) { if (DesfireCheckAuthCmd(ISWIsoID, 0xdf01, 0, MFDES_AUTHENTICATE_EV2F, false)) {
PrintAndLogEx(SUCCESS, " Card in the " _GREEN_("AES") " mode"); PrintAndLogEx(SUCCESS, " Card in the " _GREEN_("AES") " mode");
} else if (DesfireCheckAuthCmd(ISWIsoID, 0x3f00, 1, MFDES_AUTHENTICATE_EV2F, true)) { } else if (DesfireCheckAuthCmd(ISWIsoID, 0xdf01, 0, MFDES_AUTHENTICATE_EV2F, true)) {
PrintAndLogEx(SUCCESS, " Card in the " _GREEN_("LRP") " mode"); PrintAndLogEx(SUCCESS, " Card in the " _GREEN_("LRP") " mode");
}
} else {
PrintAndLogEx(SUCCESS, " Card have " _RED_("not a default") " iso id for application");
}
if (DesfireCheckAuthCmd(ISWIsoID, 0x3f00, 1, MFDES_AUTHENTICATE_EV2F, true)) {
PrintAndLogEx(SUCCESS, " Card have " _GREEN_("LRP") " key in the MF/key1");
} }
} }

View file

@ -1579,7 +1579,7 @@ bool DesfireCheckAuthCmd(DesfireISOSelectWay way, uint32_t appID, uint8_t keyNum
DesfireContext_t dctx = {0}; DesfireContext_t dctx = {0};
dctx.keyNum = keyNum; dctx.keyNum = keyNum;
dctx.commMode = DCMPlain; dctx.commMode = DCMPlain;
dctx.cmdSet = (checklrp) ? DCCNativeISO : DCCNative; dctx.cmdSet = (checklrp || way != ISW6bAID) ? DCCNativeISO : DCCNative;
// if cant select - return false // if cant select - return false
int res = DesfireSelect(&dctx, way, appID, NULL); int res = DesfireSelect(&dctx, way, appID, NULL);
@ -1587,9 +1587,7 @@ bool DesfireCheckAuthCmd(DesfireISOSelectWay way, uint32_t appID, uint8_t keyNum
return false; return false;
uint8_t data[] = {keyNum, 0x01, (checklrp) ? 0x02 : 0x00}; uint8_t data[] = {keyNum, 0x01, (checklrp) ? 0x02 : 0x00};
uint8_t datalen = (authcmd == MFDES_AUTHENTICATE_EV2F) ? 2 : 1; uint8_t datalen = (authcmd == MFDES_AUTHENTICATE_EV2F) ? 3 : 1;
if (checklrp)
datalen = 3;
res = DesfireExchangeEx(false, &dctx, authcmd, data, datalen, &respcode, recv_data, &recv_len, false, 0); res = DesfireExchangeEx(false, &dctx, authcmd, data, datalen, &respcode, recv_data, &recv_len, false, 0);
DropField(); DropField();