From 5396524dc41a0a344d8e4a09b4776443c54cdca3 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 25 Apr 2024 08:02:11 +0200 Subject: [PATCH] the change to download the anticollision signal trace to "hf 14b reader" made it slow. Making it optional instead improves performance in "hf search" --- CHANGELOG.md | 1 + client/src/cmdhf.c | 2 +- client/src/cmdhf14b.c | 18 +++++++++++------- client/src/cmdhf14b.h | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70dd969d0..d01f6fdf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Changed `hf 14b reader --plot` - made the anticollision signal trace download optional (@iceman1001) - Added `lf_hitag_crypto.trace` - trace file of a complete read out of a Hitag2 in crypto mode (@iceman1001) - Fix `lf cmdread` - uninitialised memory usage (@iceman1001) - Changed `hf st info` - now tries to check signature if available (@iceman1001) diff --git a/client/src/cmdhf.c b/client/src/cmdhf.c index 86d1e5c99..d3134eaf3 100644 --- a/client/src/cmdhf.c +++ b/client/src/cmdhf.c @@ -176,7 +176,7 @@ int CmdHFSearch(const char *Cmd) { PROMPT_CLEARLINE; PrintAndLogEx(INPLACE, " Searching for ISO14443-B tag..."); if (IfPm3Iso14443b()) { - if (readHF14B(false, false) == PM3_SUCCESS) { + if (readHF14B(false, false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 14443-B tag") " found\n"); success[ISO_14443B] = true; res = PM3_SUCCESS; diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index 7f3066b50..0f621d8d9 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -1503,13 +1503,15 @@ static int CmdHF14BReader(const char *Cmd) { void *argtable[] = { arg_param_begin, + arg_lit0(NULL, "plot", "show anticollision signal trace in plot window"), arg_lit0("v", "verbose", "verbose output"), arg_lit0("@", NULL, "optional - continuous reader mode"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); - bool verbose = arg_get_lit(ctx, 1); - bool cm = arg_get_lit(ctx, 2); + bool read_plot = arg_get_lit(ctx, 1); + bool verbose = arg_get_lit(ctx, 2); + bool cm = arg_get_lit(ctx, 3); CLIParserFree(ctx); if (cm) { @@ -1518,7 +1520,7 @@ static int CmdHF14BReader(const char *Cmd) { clear_trace_14b(); - return readHF14B(cm, verbose); + return readHF14B(cm, verbose, read_plot); } // Read SRI512|SRIX4K block @@ -2928,7 +2930,7 @@ int infoHF14B(bool verbose, bool do_aid_search) { } // get and print general info about all known 14b chips -int readHF14B(bool loop, bool verbose) { +int readHF14B(bool loop, bool verbose, bool read_plot) { bool found = false; int res = PM3_SUCCESS; do { @@ -2960,9 +2962,11 @@ int readHF14B(bool loop, bool verbose) { if (found) goto plot; plot: - res = handle_hf_plot(verbose); - if (res != PM3_SUCCESS) { - PrintAndLogEx(DEBUG, "plot failed"); + if (read_plot) { + res = handle_hf_plot(verbose); + if (res != PM3_SUCCESS) { + PrintAndLogEx(DEBUG, "plot failed"); + } } } while (loop && kbd_enter_pressed() == false); diff --git a/client/src/cmdhf14b.h b/client/src/cmdhf14b.h index e66f5d19b..009395ba2 100644 --- a/client/src/cmdhf14b.h +++ b/client/src/cmdhf14b.h @@ -30,5 +30,5 @@ int exchange_14b_apdu(uint8_t *datain, int datainlen, bool activate_field, bool int select_card_14443b_4(bool disconnect, iso14b_card_select_t *card); int infoHF14B(bool verbose, bool do_aid_search); -int readHF14B(bool loop, bool verbose); +int readHF14B(bool loop, bool verbose, bool read_plot); #endif