fix decrypted output

This commit is contained in:
iceman1001
2023-12-05 12:08:09 +01:00
parent 8f4b42e78d
commit 75d0601318
+24 -14
View File
@@ -912,22 +912,32 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
size_t mfDataLen = 0;
if (DecodeMifareData(frame, data_len, parityBytes, hdr->isResponse, mfData, &mfDataLen, mfDicKeys, mfDicKeysCount)) {
memset(explanation, 0x00, sizeof(explanation));
annotateIso14443a(explanation, sizeof(explanation), mfData, mfDataLen, hdr->isResponse);
if (protocol == PROTO_MFPLUS) {
annotateMfPlus(explanation, sizeof(explanation), mfData, mfDataLen);
} else {
annotateIso14443a(explanation, sizeof(explanation), mfData, mfDataLen, hdr->isResponse);
}
uint8_t crcc = iso14443A_CRC_check(hdr->isResponse, mfData, mfDataLen);
//iceman: colorise crc bytes here will need a refactor of code from above.
if (hdr->isResponse) {
PrintAndLogEx(NORMAL, " | | * |%-*s | %-4s| %s",
str_padder,
sprint_hex_inrow_spaces(mfData, mfDataLen, 2),
(crcc == 0 ? _RED_(" !! ") : (crcc == 1 ? _GREEN_(" ok ") : " ")),
explanation);
} else {
PrintAndLogEx(NORMAL, " | | * |" _YELLOW_("%-*s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
str_padder,
sprint_hex_inrow_spaces(mfData, mfDataLen, 2),
(crcc == 0 ? _RED_(" !! ") : (crcc == 1 ? _GREEN_(" ok ") : " ")),
explanation);
// iceman: colorise crc bytes here will need a refactor of code from above.
for (int j = 0; j < mfDataLen; j += TRACE_MAX_HEX_BYTES) {
int plen = MIN((mfDataLen - j), TRACE_MAX_HEX_BYTES);
if (hdr->isResponse) {
PrintAndLogEx(NORMAL, " | | * |%-*s | %-4s| %s",
str_padder,
sprint_hex_inrow_spaces(mfData + j, plen, 2),
(crcc == 0 ? _RED_(" !! ") : (crcc == 1 ? _GREEN_(" ok ") : " ")),
explanation);
} else {
PrintAndLogEx(NORMAL, " | | * |" _YELLOW_("%-*s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
str_padder,
sprint_hex_inrow_spaces(mfData + j, plen, 2),
(crcc == 0 ? _RED_(" !! ") : (crcc == 1 ? _GREEN_(" ok ") : " ")),
explanation);
}
}
}
}