From 7c8e9db822280e5b1731ec0af6396361c1dc673b Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 30 May 2023 13:46:52 +0200 Subject: [PATCH] allow user abort when wiping --- client/src/cmdhfmf.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 7487088dd..6d017a849 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -5919,8 +5919,9 @@ int CmdHFMFNDEFRead(const char *Cmd) { CLIParserFree(ctx); uint16_t ndef_aid = NDEF_MFC_AID; - if (aidlen == 2) + if (aidlen == 2){ ndef_aid = (aid[0] << 8) + aid[1]; + } uint8_t ndefkey[6] = {0}; memcpy(ndefkey, g_mifare_ndef_key, 6); @@ -7007,6 +7008,7 @@ static int CmdHF14AMfWipe(const char *Cmd) { PrintAndLogEx(INFO, "Forcing overwrite of sector 0 / block 0 "); else PrintAndLogEx(INFO, "Skipping sector 0 / block 0"); + PrintAndLogEx(NORMAL, ""); uint8_t zeros[MFBLOCK_SIZE] = {0}; @@ -7018,7 +7020,12 @@ static int CmdHF14AMfWipe(const char *Cmd) { for (uint8_t b = 0; b < mfNumBlocksPerSector(s); b++) { - // Skipp write to manufacture block if not enforced + if (kbd_enter_pressed()) { + PrintAndLogEx(WARNING, "\naborted via keyboard!\n"); + goto out; + } + + // Skip write to manufacture block if not enforced if (s == 0 && b == 0 && gen2 == false) { continue; }