fix hf 14b dump command not lock up every other call and modified the output.

This commit is contained in:
iceman1001 2024-01-09 10:22:27 +01:00
commit 1efb38ba98
2 changed files with 12 additions and 10 deletions

View file

@ -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

View file

@ -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