From d480cbd1d0f679cf009887e6d533ab469a1b71e3 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 26 Apr 2023 00:10:15 +0200 Subject: [PATCH] hf 14b dump now supports the no save parameter --- CHANGELOG.md | 1 + client/src/cmdhf14b.c | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4d075061..c73f7641a 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 dump --ns` - now supports `no save` of card memory (@iceman1001) - Changed `hf mfu dump --ns` - now supports `no save` of card memory (@iceman1001) - Changed the PM3 client to honor the preferences dump/trace paths. experimental support (@iceman1001) - Added the possibility to load `.MCT` dump files (@iceman1001) diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index 12440c676..d0083fbb5 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -1359,6 +1359,7 @@ static int CmdHF14BDump(const char *Cmd) { void *argtable[] = { arg_param_begin, arg_str0("f", "file", "", "(optional) filename, if no UID will be used as filename"), + arg_lit0(NULL, "ns", "no save to file"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -1366,6 +1367,7 @@ static int CmdHF14BDump(const char *Cmd) { int fnlen = 0; char filename[FILE_PATH_SIZE] = {0}; CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen); + bool nosave = arg_get_lit(ctx, 2); CLIParserFree(ctx); @@ -1514,15 +1516,17 @@ static int CmdHF14BDump(const char *Cmd) { print_sr_blocks(data, cardsize, card.uid); - // save to file - if (fnlen < 1) { - PrintAndLogEx(INFO, "using UID as filename"); - char *fptr = filename + snprintf(filename, sizeof(filename), "hf-14b-"); - FillFileNameByUID(fptr, SwapEndian64(card.uid, card.uidlen, 8), "-dump", card.uidlen); - } + if (nosave == false) { + // save to file + if (fnlen < 1) { + PrintAndLogEx(INFO, "using UID as filename"); + char *fptr = filename + snprintf(filename, sizeof(filename), "hf-14b-"); + FillFileNameByUID(fptr, SwapEndian64(card.uid, card.uidlen, 8), "-dump", card.uidlen); + } - size_t datalen = (lastblock + 2) * ST25TB_SR_BLOCK_SIZE; - pm3_save_dump(filename, data, datalen, jsf14b, ST25TB_SR_BLOCK_SIZE); + size_t datalen = (lastblock + 2) * ST25TB_SR_BLOCK_SIZE; + pm3_save_dump(filename, data, datalen, jsf14b, ST25TB_SR_BLOCK_SIZE); + } } return switch_off_field_14b();