From 2235d96486c7265d4459de36af9f7760ce7c51da Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 12 Oct 2020 19:54:50 +0200 Subject: [PATCH] textual --- client/src/cmdhfmfu.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index a24b2b57f..d1f2792f1 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -3083,12 +3083,27 @@ static int CmdHF14AMfuEv1CounterTearoff(const char *Cmd) { PrintAndLogEx(WARNING, "Counter must 0, 1 or 2"); return PM3_EINVARG; } + cnt_no = (uint8_t)counter; + + iso14a_card_select_t card; + + if (ul_select(&card) == 0) { + PrintAndLogEx(WARNING, "Failed to select card"); + return PM3_ESOFT; + } + uint8_t inital_cnt[3] = {0, 0, 0}; + int len = ulev1_readCounter(cnt_no, inital_cnt, sizeof(inital_cnt)); + DropField(); + if ( len != sizeof(inital_cnt) ) { + PrintAndLogEx(WARNING, "Failed to read counter"); + return PM3_ESOFT; + } PrintAndLogEx(INFO, "----------------- " _CYAN_("MFU Ev1 Counter Tear off") " ---------------------"); - PrintAndLogEx(INFO, "Starting counter tear-off test"); - PrintAndLogEx(INFO, "Target counter no: %u", counter); + PrintAndLogEx(INFO, "Target counter no " _GREEN_("%u"), counter); + PrintAndLogEx(INFO, "Target initial value " _GREEN_("%s"), sprint_hex_inrow(inital_cnt, sizeof(inital_cnt))); PrintAndLogEx(INFO, "----------------------------------------------------"); bool got_pre = false, got_post = false; @@ -3096,8 +3111,6 @@ static int CmdHF14AMfuEv1CounterTearoff(const char *Cmd) { uint8_t post[3] = {0}; uint32_t actual_time = start_time; - iso14a_card_select_t card; - while (actual_time <= (time_limit - interval)) { if (kbd_enter_pressed()) {