From 1efb38ba98beac949b5efc93551b203d16087b2a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 9 Jan 2024 10:22:27 +0100 Subject: [PATCH] fix hf 14b dump command not lock up every other call and modified the output. --- armsrc/iso14443b.c | 7 ++++--- client/src/cmdhf14b.c | 15 ++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/armsrc/iso14443b.c b/armsrc/iso14443b.c index 7549b6b7d..51ec78eab 100644 --- a/armsrc/iso14443b.c +++ b/armsrc/iso14443b.c @@ -1686,9 +1686,7 @@ int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, void if (len >= 3 && (check_crc(CRC_14443_B, data_bytes, len) == false)) { return PM3_ECRC; } - } - if (len) { // cut frame byte len -= 1; @@ -2148,7 +2146,10 @@ out: // Set up ISO 14443 Type B communication (similar to iso14443a_setup) // field is setup for "Sending as Reader" void iso14443b_setup(void) { - LEDsoff(); + + switch_off(); // disconnect raw + SpinDelay(20); + FpgaDownloadAndGo(FPGA_BITSTREAM_HF); // allocate command receive buffer diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index b534e18d4..5141b216b 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -847,12 +847,13 @@ static void print_ct_general_info(void *vcard) { } static void print_hdr(void) { + PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, " block# | data |lck| ascii"); - PrintAndLogEx(INFO, "---------+--------------+---+----------"); + PrintAndLogEx(INFO, "---------+--------------+---+------"); } static void print_footer(void) { - PrintAndLogEx(INFO, "---------+--------------+---+----------"); + PrintAndLogEx(INFO, "---------+--------------+---+------"); PrintAndLogEx(NORMAL, ""); } @@ -882,10 +883,11 @@ static void print_sr_blocks(uint8_t *data, size_t len, const uint8_t *uid) { size_t blocks = (len / ST25TB_SR_BLOCK_SIZE) - 1 ; uint8_t *systemblock = data + blocks * ST25TB_SR_BLOCK_SIZE ; uint8_t chipid = get_st_chipid(uid); - PrintAndLogEx(SUCCESS, _GREEN_("%s") " tag", get_st_chip_model(chipid)); - PrintAndLogEx(DEBUG, "systemblock : %s", sprint_hex(systemblock, ST25TB_SR_BLOCK_SIZE)); - PrintAndLogEx(DEBUG, " otp lock : %02x %02x", *systemblock, *(systemblock + 1)); + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "-------- " _CYAN_("%s tag memory") " ---------", get_st_chip_model(chipid)); + PrintAndLogEx(DEBUG, "systemblock... " _YELLOW_("%s"), sprint_hex(systemblock, ST25TB_SR_BLOCK_SIZE)); + PrintAndLogEx(DEBUG, " otp lock... " _YELLOW_("%02x %02x"), *systemblock, *(systemblock + 1)); print_hdr(); @@ -1476,7 +1478,7 @@ static int CmdHF14BDump(const char *Cmd) { PrintAndLogEx(SUCCESS, "found a " _GREEN_("%s") " tag", get_st_chip_model(chipid)); // detect blocksize from card :) - PrintAndLogEx(INFO, "reading tag memory from UID " _GREEN_("%s"), sprint_hex_inrow(SwapEndian64(card.uid, card.uidlen, 8), card.uidlen)); + PrintAndLogEx(INFO, "reading tag memory"); iso14b_raw_cmd_t *packet = (iso14b_raw_cmd_t *)calloc(1, sizeof(iso14b_raw_cmd_t) + 2); if (packet == NULL) { @@ -1530,7 +1532,6 @@ static int CmdHF14BDump(const char *Cmd) { continue; } - // last read if (blocknum == 0xFF) { // we reserved space for this block after 0x0F and 0x7F, ie 0x10, 0x80