the change to download the anticollision signal trace to "hf 14b reader" made it slow. Making it optional instead improves performance in "hf search"

This commit is contained in:
iceman1001 2024-04-25 08:02:11 +02:00
commit 5396524dc4
4 changed files with 14 additions and 9 deletions

View file

@ -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... 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] ## [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) - 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) - Fix `lf cmdread` - uninitialised memory usage (@iceman1001)
- Changed `hf st info` - now tries to check signature if available (@iceman1001) - Changed `hf st info` - now tries to check signature if available (@iceman1001)

View file

@ -176,7 +176,7 @@ int CmdHFSearch(const char *Cmd) {
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, " Searching for ISO14443-B tag..."); PrintAndLogEx(INPLACE, " Searching for ISO14443-B tag...");
if (IfPm3Iso14443b()) { 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"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 14443-B tag") " found\n");
success[ISO_14443B] = true; success[ISO_14443B] = true;
res = PM3_SUCCESS; res = PM3_SUCCESS;

View file

@ -1503,13 +1503,15 @@ static int CmdHF14BReader(const char *Cmd) {
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_lit0(NULL, "plot", "show anticollision signal trace in plot window"),
arg_lit0("v", "verbose", "verbose output"), arg_lit0("v", "verbose", "verbose output"),
arg_lit0("@", NULL, "optional - continuous reader mode"), arg_lit0("@", NULL, "optional - continuous reader mode"),
arg_param_end arg_param_end
}; };
CLIExecWithReturn(ctx, Cmd, argtable, true); CLIExecWithReturn(ctx, Cmd, argtable, true);
bool verbose = arg_get_lit(ctx, 1); bool read_plot = arg_get_lit(ctx, 1);
bool cm = arg_get_lit(ctx, 2); bool verbose = arg_get_lit(ctx, 2);
bool cm = arg_get_lit(ctx, 3);
CLIParserFree(ctx); CLIParserFree(ctx);
if (cm) { if (cm) {
@ -1518,7 +1520,7 @@ static int CmdHF14BReader(const char *Cmd) {
clear_trace_14b(); clear_trace_14b();
return readHF14B(cm, verbose); return readHF14B(cm, verbose, read_plot);
} }
// Read SRI512|SRIX4K block // 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 // 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; bool found = false;
int res = PM3_SUCCESS; int res = PM3_SUCCESS;
do { do {
@ -2960,10 +2962,12 @@ int readHF14B(bool loop, bool verbose) {
if (found) if (found)
goto plot; goto plot;
plot: plot:
if (read_plot) {
res = handle_hf_plot(verbose); res = handle_hf_plot(verbose);
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "plot failed"); PrintAndLogEx(DEBUG, "plot failed");
} }
}
} while (loop && kbd_enter_pressed() == false); } while (loop && kbd_enter_pressed() == false);

View file

@ -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 select_card_14443b_4(bool disconnect, iso14b_card_select_t *card);
int infoHF14B(bool verbose, bool do_aid_search); int infoHF14B(bool verbose, bool do_aid_search);
int readHF14B(bool loop, bool verbose); int readHF14B(bool loop, bool verbose, bool read_plot);
#endif #endif