From 63dc6a8d7df70f0ec278a5022485a758ce4c1e42 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 9 Nov 2026 15:11:37 +0700 Subject: [PATCH] trace extract: find the DESFire EV2 auth challenge in any framing extractChall_ev2() only took a 21 byte tag reply, ie wrapped framing without CID, so a native EV2 First / Non First auth, or one with a CID, printed no challenge. Locate it like the AES branch does. Co-Authored-By: Claude Opus 5.5 --- client/src/cmdtrace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/cmdtrace.c b/client/src/cmdtrace.c index 64322ac9b..e2dd4ae26 100644 --- a/client/src/cmdtrace.c +++ b/client/src/cmdtrace.c @@ -199,13 +199,17 @@ static uint8_t extract_epurse[8] = {0}; static uint32_t extractChall_ev2(uint32_t tracepos, uint32_t traceLen, uint8_t *trace, uint8_t cmdpos, uint8_t long_jmp) { const tracelog_hdr_t *next_hdr = get_record(tracepos, traceLen, trace); - if ((next_hdr == NULL) || (next_hdr->data_len != 21)) { + if ((next_hdr == NULL) || (next_hdr->isResponse == false)) { return 0; } + uint8_t cpos = mfdes_chall_pos(next_hdr->frame, long_jmp); + if (next_hdr->data_len < cpos + 16 + 2) { + return 0; + } tracepos += TRACELOG_HDR_LEN + next_hdr->data_len + TRACELOG_PARITY_LEN(next_hdr); - PrintAndLogEx(INFO, "1499999999 %s " NOLF, sprint_hex_inrow(next_hdr->frame + 1, 16)); + PrintAndLogEx(INFO, "1499999999 %s " NOLF, sprint_hex_inrow(next_hdr->frame + cpos, 16)); next_hdr = get_record(tracepos, traceLen, trace); if (next_hdr == NULL) {