From 984a26370d0a8d08efa81d42c9eaee2e2be82fe5 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 5 Dec 2017 11:53:42 +0100 Subject: [PATCH] chg: 'hf mf nack' better output --- armsrc/iso14443a.c | 7 ++----- client/cmdhfmf.c | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index d1a2a10f9..ef7b42415 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -2758,13 +2758,10 @@ void DetectNACKbug() { consecutive_resyncs = 0; } // end for loop - Dbprintf("Num of sent auth requestes : %u", i); - Dbprintf("Num of received NACK : %u", num_nacks); - - if ( num_nacks == 3) + if (num_nacks == 3) isOK = 1; - cmd_send(CMD_ACK, isOK, num_nacks, 0, 0, 0 ); + cmd_send(CMD_ACK, isOK, num_nacks, i, 0, 0 ); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); LEDsoff(); diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 9048d2f1b..d3f3b280d 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -2867,10 +2867,20 @@ int CmdHf14AMfNack(const char *Cmd) { } if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) { - uint8_t ok = resp.arg[0] & 0xff; - PrintAndLog("isOk:%02x", ok); - if (!ok) { - PrintAndLog("Failed."); + int32_t ok = resp.arg[0] & 0xff; + uint32_t nacks = resp.arg[1]; + uint32_t auths = resp.arg[2]; + + PrintAndLog("Three different nonces used, expecting three nacks"); + PrintAndLog("Num of sent auth requestes : %u", auths); + PrintAndLog("Num of received NACK : %u", num_nacks); + switch( ok ) { + case -1 : PrintAndLog("Button pressed. Aborted."); return 1; + case -3 : PrintAndLog("Card random number generator is not predictable)."); return 1; + case -4 : PrintAndLog("Card random number generator seems to be based on the wellknown"); + PrintAndLog("generating polynomial with 16 effective bits only, but shows unexpected behaviour."); return 1; + case 1 : PrintAndLog("Card has NACK bug."); return 1; + case 0 : PrintAndLog("Card may have NACK bug. inconclusive result"); return 1; } break; }