diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index ac99ea229..33ce1a28d 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -2358,7 +2358,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { tc1 = (card.ats[1] & 0x40) == 0x40; int16_t fsci = card.ats[1] & 0x0f; - PrintAndLogEx(INFO, " " _YELLOW_("%02X") "............ T0 TA1 is%s present, TB1 is%s present, " + PrintAndLogEx(INFO, " ..." _YELLOW_("%02X") "............ T0 TA1 is%s present, TB1 is%s present, " "TC1 is%s present, FSCI is %d (FSC = %d)", card.ats[1], (ta1 ? "" : _RED_(" NOT")), @@ -2380,7 +2380,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { if (card.ats[pos] & 0x04) strcat(dr, "8, "); if (strlen(ds) != 0) ds[strlen(ds) - 2] = '\0'; if (strlen(dr) != 0) dr[strlen(dr) - 2] = '\0'; - PrintAndLogEx(INFO, " " _YELLOW_("%02X") "......... TA1 different divisors are%s supported, " + PrintAndLogEx(INFO, " ......" _YELLOW_("%02X") "......... TA1 different divisors are%s supported, " "DR: [%s], DS: [%s]", card.ats[pos], ((card.ats[pos] & 0x80) ? _RED_(" NOT") : ""), @@ -2395,7 +2395,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { uint32_t sfgi = card.ats[pos] & 0x0F; uint32_t fwi = card.ats[pos] >> 4; - PrintAndLogEx(INFO, " " _YELLOW_("%02X") "...... TB1 SFGI = %d (SFGT = %s%d/fc), FWI = " _YELLOW_("%d") " (FWT = %d/fc)", + PrintAndLogEx(INFO, " ........." _YELLOW_("%02X") "...... TB1 SFGI = %d (SFGT = %s%d/fc), FWI = " _YELLOW_("%d") " (FWT = %d/fc)", card.ats[pos], (sfgi), sfgi ? "" : "(not needed) ", @@ -2407,7 +2407,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { } if (tc1 && (card.ats_len > pos + 2)) { - PrintAndLogEx(INFO, " " _YELLOW_("%02X") "... TC1 NAD is%s supported, CID is%s supported", + PrintAndLogEx(INFO, " ............" _YELLOW_("%02X") "... TC1 NAD is%s supported, CID is%s supported", card.ats[pos], (card.ats[pos] & 0x01) ? "" : _RED_(" NOT"), (card.ats[pos] & 0x02) ? "" : _RED_(" NOT") @@ -2546,11 +2546,8 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { , sprint_ascii(card.ats + pos, calen) ); } - - PrintAndLogEx(NORMAL, ""); } } - } if (do_aid_search) { diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 492403344..b08b7ba8c 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -66,8 +66,6 @@ static uint8_t empty[PICOPASS_BLOCK_SIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, static uint8_t zeros[PICOPASS_BLOCK_SIZE] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static int CmdHelp(const char *Cmd); -static void print_iclass_sio(uint8_t *iclass_dump, size_t dump_len); - static uint8_t iClass_Key_Table[ICLASS_KEYS_MAX][PICOPASS_BLOCK_SIZE] = { { 0xAE, 0xA6, 0x84, 0xA6, 0xDA, 0xB2, 0x32, 0x78 }, { 0xFD, 0xCB, 0x5A, 0x52, 0xEA, 0x8F, 0x30, 0x90 }, @@ -3184,7 +3182,7 @@ static void detect_credential(uint8_t *iclass_dump, size_t dump_len, bool *is_le picopass_hdr_t *hdr = (picopass_hdr_t *)iclass_dump; - if (!memcmp(hdr->app_issuer_area, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", PICOPASS_BLOCK_SIZE)) { + if (memcmp(hdr->app_issuer_area, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", PICOPASS_BLOCK_SIZE) == 0) { // Legacy AIA *is_legacy = true; @@ -3206,7 +3204,7 @@ static void detect_credential(uint8_t *iclass_dump, size_t dump_len, bool *is_le } } } - } else if (!memcmp(hdr->app_issuer_area, "\xFF\xFF\xFF\x00\x06\xFF\xFF\xFF", PICOPASS_BLOCK_SIZE)) { + } else if (memcmp(hdr->app_issuer_area, "\xFF\xFF\xFF\x00\x06\xFF\xFF\xFF", PICOPASS_BLOCK_SIZE) == 0) { // SE AIA *is_se = true; @@ -3238,7 +3236,8 @@ static void detect_credential(uint8_t *iclass_dump, size_t dump_len, bool *is_le } // print ASN1 decoded array in TLV view -static void print_iclass_sio(uint8_t *iclass_dump, size_t dump_len) { +void print_iclass_sio(uint8_t *iclass_dump, size_t dump_len, bool verbose) { + bool is_legacy, is_se, is_sr; uint8_t *sio_start; size_t sio_length; @@ -3249,7 +3248,7 @@ static void print_iclass_sio(uint8_t *iclass_dump, size_t dump_len) { } if (dump_len < sio_length + (sio_start - iclass_dump)) { - // SIO length exceeds the size of the dump we have, bail + // SIO length exceeds the size of the dump return; } @@ -3257,9 +3256,11 @@ static void print_iclass_sio(uint8_t *iclass_dump, size_t dump_len) { PrintAndLogEx(INFO, "---------------------------- " _CYAN_("SIO - RAW") " ----------------------------"); print_hex_noascii_break(sio_start, sio_length, 32); PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "------------------------- " _CYAN_("SIO - ASN1 TLV") " --------------------------"); + if (verbose) { + PrintAndLogEx(INFO, "----------------------- " _CYAN_("SIO - ASN1 TLV") " ---------------------------"); asn1_print(sio_start, sio_length, " "); PrintAndLogEx(NORMAL, ""); + } } void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t endblock, size_t filesize, bool dense_output) { @@ -3457,8 +3458,9 @@ void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t e if (is_legacy) PrintAndLogEx(HINT, _YELLOW_("yellow") " = legacy credential"); - if (is_se) + if (is_se) { PrintAndLogEx(HINT, _CYAN_("cyan") " = SIO / SE credential"); + } if (is_sr) PrintAndLogEx(HINT, _CYAN_("cyan") " = SIO / SR credential"); diff --git a/client/src/cmdhficlass.h b/client/src/cmdhficlass.h index 6fac5cee5..b4fcd0524 100644 --- a/client/src/cmdhficlass.h +++ b/client/src/cmdhficlass.h @@ -43,4 +43,5 @@ uint32_t picopass_elite_rng(void); uint32_t picopass_elite_lcg(void); uint8_t picopass_elite_nextByte(void); void generate_key_block_inverted(const uint8_t *startingKey, uint64_t index, uint8_t *keyBlock); +void print_iclass_sio(uint8_t *iclass_dump, size_t dump_len, bool verbose); #endif