mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
Fix EMV flow for cards without usable READ RECORD
Capture Track 2 (tag 57) from the GPO response when available and avoid sending the fixed READ RECORD APDU if the token was already found. This prevents unnecessary 6A83 responses and improves compatibility with cards that return the required data during GPO.
This commit is contained in:
@@ -301,9 +301,14 @@ void RunMod(void) {
|
||||
if (iso14443a_select_card(NULL, &card_a_info, NULL, true, 0, false)) {
|
||||
|
||||
DbpString(_YELLOW_("+") "Found ISO 14443 Type A!");
|
||||
|
||||
|
||||
chktoken = false;
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
chktoken = false;
|
||||
|
||||
if (i == 3 && chktoken) {
|
||||
break; // já achei a 57 no GPO, não preciso de READ RECORD
|
||||
}
|
||||
|
||||
LED_C_OFF();
|
||||
LED_B_ON();
|
||||
uint8_t apdulen = iso14_apdu(apdus[i], (uint16_t) apduslen[i], false, apdubuffer, sizeof(apdubuffer), NULL);
|
||||
@@ -331,13 +336,13 @@ void RunMod(void) {
|
||||
}
|
||||
|
||||
|
||||
} else if (i == 3) {
|
||||
} else if (i == 2 || i == 3) {
|
||||
|
||||
|
||||
// find track 2
|
||||
if (apdubuffer[u] == 0x57 && apdubuffer[u + 1] == 0x13 && !chktoken) {
|
||||
// find track 2 in GPO or READ RECORD
|
||||
if (u + 20 < apdulen && apdubuffer[u] == 0x57 && apdubuffer[u + 1] == 0x13 && !chktoken) {
|
||||
chktoken = true;
|
||||
memcpy(&token, &apdubuffer[u + 2], 19);
|
||||
memcpy(token, &apdubuffer[u + 2], 19);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user