mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
only print uid types in 14a info, and skip decoding of bad ATS
This commit is contained in:
parent
3efe3d9f85
commit
ed60d26808
2 changed files with 206 additions and 190 deletions
|
@ -419,30 +419,38 @@ static int CmdHf14AConfig(const char *Cmd) {
|
|||
return hf14a_setconfig(&config, verbose);
|
||||
}
|
||||
|
||||
static void PrintUidType(iso14a_card_select_t *card) {
|
||||
static const char* get_uid_type(iso14a_card_select_t *card) {
|
||||
|
||||
static char s[60] = {0};
|
||||
memset(s, 0, sizeof(s));
|
||||
|
||||
switch (card->uidlen) {
|
||||
case 4:
|
||||
case 4: {
|
||||
if (card->uid[0] == 0x08) {
|
||||
PrintAndLogEx(SUCCESS, " UID type: " _GREEN_("RID") " (random ID)");
|
||||
sprintf(s, " ( RID - random ID )");
|
||||
} else if ((card->uid[0] & 0xF) == 0xF) {
|
||||
PrintAndLogEx(SUCCESS, " UID type: " _GREEN_("FNUID") " (fixed but non-unique ID)");
|
||||
sprintf(s, " ( FNUID, fixed, non-unique ID )");
|
||||
} else if (card->uid[0] == 0x88) {
|
||||
PrintAndLogEx(WARNING, " UID type: " _YELLOW_("Cascade tag") " (not final UID)");
|
||||
sprintf(s, " ( Cascade tag - not final )");
|
||||
} else if (card->uid[0] == 0xF8) {
|
||||
PrintAndLogEx(WARNING, " UID type: " _YELLOW_("RFU"));
|
||||
sprintf(s, " ( RFU )");
|
||||
} else {
|
||||
PrintAndLogEx(SUCCESS, " UID type: " _GREEN_("ONUID") " (re-used UID)");
|
||||
sprintf(s, " ( ONUID, re-used )");
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
PrintAndLogEx(SUCCESS, " UID type: " _GREEN_("Double Size UID"));
|
||||
}
|
||||
case 7: {
|
||||
sprintf(s, " ( double )");
|
||||
break;
|
||||
case 10:
|
||||
PrintAndLogEx(SUCCESS, " UID type: " _GREEN_("Triple Size UID"));
|
||||
}
|
||||
case 10: {
|
||||
sprintf(s, " ( triple )");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
PrintAndLogEx(ERR, " UID type: " _RED_("wrong UID length"));
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
int Hf14443_4aGetCardData(iso14a_card_select_t *card) {
|
||||
|
@ -476,7 +484,6 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card) {
|
|||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(card->uid, card->uidlen));
|
||||
PrintUidType(card);
|
||||
PrintAndLogEx(SUCCESS, "ATQA: %02X %02X", card->atqa[1], card->atqa[0]);
|
||||
PrintAndLogEx(SUCCESS, " SAK: %02X [%" PRIu64 "]", card->sak, resp.oldarg[0]);
|
||||
|
||||
|
@ -643,7 +650,6 @@ static int CmdHF14AReader(const char *Cmd) {
|
|||
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(card.uid, card.uidlen));
|
||||
|
||||
if (!(silent && continuous)) {
|
||||
PrintUidType(&card);
|
||||
PrintAndLogEx(SUCCESS, "ATQA: " _GREEN_("%02X %02X"), card.atqa[1], card.atqa[0]);
|
||||
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%" PRIu64 "]"), card.sak, resp.oldarg[0]);
|
||||
|
||||
|
@ -2081,8 +2087,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
|||
PrintAndLogEx(INFO, "--- " _CYAN_("ISO14443-a Information") "---------------------");
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(card.uid, card.uidlen));
|
||||
PrintUidType(&card);
|
||||
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s") " %s", sprint_hex(card.uid, card.uidlen), get_uid_type(&card));
|
||||
PrintAndLogEx(SUCCESS, "ATQA: " _GREEN_("%02X %02X"), card.atqa[1], card.atqa[0]);
|
||||
PrintAndLogEx(SUCCESS, " SAK: " _GREEN_("%02X [%" PRIu64 "]"), card.sak, resp.oldarg[0]);
|
||||
|
||||
|
@ -2272,14 +2277,18 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
|||
PrintAndLogEx(INFO, "--> SAK incorrectly claims that card doesn't support RATS <--");
|
||||
}
|
||||
|
||||
bool bad_ats = false;
|
||||
if (card.ats[0] != card.ats_len - 2) {
|
||||
PrintAndLogEx(WARNING, _RED_("ATS may be corrupted."));
|
||||
PrintAndLogEx(INFO, "Length of ATS (%d bytes incl. 2 Bytes CRC) doesn't match TL", card.ats_len);
|
||||
bad_ats = true;
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, "ATS: " _YELLOW_("%s")"[ %02X %02X ]", sprint_hex(card.ats, card.ats_len - 2), card.ats[card.ats_len - 2], card.ats[card.ats_len - 1]);
|
||||
PrintAndLogEx(INFO, " " _YELLOW_("%02X") "............... TL length is " _GREEN_("%d") " bytes", card.ats[0], card.ats[0]);
|
||||
|
||||
if (bad_ats == false) {
|
||||
|
||||
if ((card.ats[0] > 1) && (card.ats_len > 3)) { // there is a format byte (T0)
|
||||
ta1 = (card.ats[1] & 0x10) == 0x10;
|
||||
tb1 = (card.ats[1] & 0x20) == 0x20;
|
||||
|
@ -2479,6 +2488,8 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (do_aid_search) {
|
||||
|
||||
PrintAndLogEx(INFO, "-------------------- " _CYAN_("AID Search") " --------------------");
|
||||
|
@ -2558,6 +2569,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
|||
PrintAndLogEx(INFO, "----------------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (isISO18092) {
|
||||
|
|
|
@ -1507,6 +1507,10 @@ uint16_t detect_mf_magic(bool is_mfc, uint8_t key_type, uint64_t key) {
|
|||
isMagic = MemLeToUint2byte(resp.data.asBytes);
|
||||
}
|
||||
|
||||
if (isMagic) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
}
|
||||
|
||||
if ((isMagic & MAGIC_FLAG_GEN_1A) == MAGIC_FLAG_GEN_1A) {
|
||||
PrintAndLogEx(SUCCESS, "Magic capabilities... " _GREEN_("Gen 1a"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue