diff --git a/armsrc/em4x50.c b/armsrc/em4x50.c index 32862ab97..4c443dbc5 100644 --- a/armsrc/em4x50.c +++ b/armsrc/em4x50.c @@ -1490,7 +1490,7 @@ void em4x50_chk(uint32_t *offset) { // check passwords from dictionary content in flash memory - bool bsuccess = false; + int status = 0; uint8_t counter[2] = {0x00, 0x00}; uint16_t isok = 0; uint16_t pwd_count = 0; @@ -1530,14 +1530,16 @@ void em4x50_chk(uint32_t *offset) { for (int i = 0; i < pwd_count; i++) { // manual interruption - if (BUTTON_PRESS()) - goto OUT; + if (BUTTON_PRESS()) { + status = BUTTON_SINGLE_CLICK; + break; + } // get next password from flash memory pwd = get_pwd(pwds, i); - bsuccess = login(pwd); - if (bsuccess) + status = login(pwd); + if (status == 1) break; } } @@ -1545,5 +1547,5 @@ void em4x50_chk(uint32_t *offset) { OUT: lf_finalize(); - reply_ng(CMD_LF_EM4X50_CHK, bsuccess, (uint8_t *)&pwd, 32); + reply_ng(CMD_LF_EM4X50_CHK, status, (uint8_t *)&pwd, 32); } diff --git a/client/src/cmdlfem4x50.c b/client/src/cmdlfem4x50.c index 2ce7d7985..2a1513cac 100644 --- a/client/src/cmdlfem4x50.c +++ b/client/src/cmdlfem4x50.c @@ -1228,7 +1228,7 @@ int CmdEM4x50Chk(const char *Cmd) { // upload passwords from dictionary to flash memory and start password check - bool key_found = false; + int status = 0; int res = 0, slen = 0; int keys_remain = 0; int block_count = 1; @@ -1277,7 +1277,9 @@ int CmdEM4x50Chk(const char *Cmd) { PrintAndLogEx(FAILED, "error, filesize is larger than available memory"); return PM3_EOVFLOW; } - + + PrintAndLogEx(INFO, "You can cancel this operation by pressing the pm3 button"); + if (datalen > CARD_MEMORY_SIZE) { // we have to use more than one block of passwords @@ -1324,13 +1326,13 @@ int CmdEM4x50Chk(const char *Cmd) { SendCommandNG(CMD_LF_EM4X50_CHK, (uint8_t *)&offset, sizeof(offset)); WaitForResponseTimeoutW(CMD_LF_EM4X50_CHK, &resp, -1, false); - key_found = (bool)resp.status; - if (key_found) + status = resp.status; + if (status != false) break; } // print response - if (key_found) + if (status == 1) PrintAndLogEx(SUCCESS, "Password " _GREEN_("found: %02x %02x %02x %02x"), resp.data.asBytes[3], resp.data.asBytes[2],