From ff765f569f679e2bd9daf6b870da7cb5619054ed Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 4 Oct 2024 10:01:50 +0200 Subject: [PATCH] change out some non-breaking wait for response from some command which shouldnt have it. Sniff / simulate / bruteforce should have it. and some minor text / style --- client/src/cmdflashmemspiffs.c | 13 ++++++----- client/src/cmdhf.c | 2 +- client/src/cmdhf14a.c | 34 ++++++++++++++++++++--------- client/src/cmdhf15.c | 4 +++- client/src/cmdhfepa.c | 2 -- client/src/cmdhfgallagher.c | 4 ++-- client/src/cmdhficlass.c | 1 - client/src/cmdhfmfdes.c | 10 +++++---- client/src/cmdhfmfp.c | 5 ++++- client/src/cmdhfmfu.c | 11 ++++++++-- client/src/cmdlfawid.c | 2 +- client/src/cmdlfdestron.c | 2 +- client/src/cmdlfem410x.c | 7 ++++-- client/src/cmdlfem4x50.c | 5 ++++- client/src/cmdlffdxb.c | 2 +- client/src/cmdlfgallagher.c | 2 +- client/src/cmdlfguard.c | 2 +- client/src/cmdlfhid.c | 13 ++++++----- client/src/cmdlfidteck.c | 2 +- client/src/cmdlfindala.c | 2 +- client/src/cmdlfio.c | 2 +- client/src/cmdlfjablotron.c | 2 +- client/src/cmdlfkeri.c | 2 +- client/src/cmdlfmotorola.c | 2 +- client/src/cmdlfnedap.c | 2 +- client/src/cmdlfnexwatch.c | 2 +- client/src/cmdlfnoralsy.c | 2 +- client/src/cmdlfpac.c | 2 +- client/src/cmdlfparadox.c | 2 +- client/src/cmdlfpcf7931.c | 2 +- client/src/cmdlfpresco.c | 2 +- client/src/cmdlfpyramid.c | 2 +- client/src/cmdlfsecurakey.c | 2 +- client/src/cmdlfti.c | 2 +- client/src/cmdlfverichip_disabled.c | 2 +- client/src/cmdlfviking.c | 2 +- client/src/cmdlfvisa2000.c | 2 +- client/src/mifare/desfirecore.c | 5 ++++- common_arm/flashmem.c | 12 +++++----- doc/commands.json | 2 +- 40 files changed, 109 insertions(+), 69 deletions(-) diff --git a/client/src/cmdflashmemspiffs.c b/client/src/cmdflashmemspiffs.c index 8fbb9b2de..fef35bb4d 100644 --- a/client/src/cmdflashmemspiffs.c +++ b/client/src/cmdflashmemspiffs.c @@ -262,9 +262,9 @@ static int CmdFlashMemSpiFFSRemove(const char *Cmd) { clearCommandBuffer(); SendCommandNG(CMD_SPIFFS_REMOVE, (uint8_t *)&payload, sizeof(payload)); WaitForResponse(CMD_SPIFFS_REMOVE, &resp); - if (resp.status == PM3_SUCCESS) + if (resp.status == PM3_SUCCESS) { PrintAndLogEx(INFO, "Done!"); - + } return PM3_SUCCESS; } @@ -310,8 +310,9 @@ static int CmdFlashMemSpiFFSRename(const char *Cmd) { clearCommandBuffer(); SendCommandNG(CMD_SPIFFS_RENAME, (uint8_t *)&payload, sizeof(payload)); WaitForResponse(CMD_SPIFFS_RENAME, &resp); - if (resp.status == PM3_SUCCESS) + if (resp.status == PM3_SUCCESS) { PrintAndLogEx(INFO, "Done!"); + } PrintAndLogEx(HINT, "Try `" _YELLOW_("mem spiffs tree") "` to verify"); return PM3_SUCCESS; @@ -358,8 +359,9 @@ static int CmdFlashMemSpiFFSCopy(const char *Cmd) { clearCommandBuffer(); SendCommandNG(CMD_SPIFFS_COPY, (uint8_t *)&payload, sizeof(payload)); WaitForResponse(CMD_SPIFFS_COPY, &resp); - if (resp.status == PM3_SUCCESS) + if (resp.status == PM3_SUCCESS) { PrintAndLogEx(INFO, "Done!"); + } PrintAndLogEx(HINT, "Try `" _YELLOW_("mem spiffs tree") "` to verify"); return PM3_SUCCESS; @@ -474,8 +476,9 @@ static int CmdFlashMemSpiFFSWipe(const char *Cmd) { clearCommandBuffer(); SendCommandNG(CMD_SPIFFS_WIPE, NULL, 0); WaitForResponse(CMD_SPIFFS_WIPE, &resp); - if (resp.status == PM3_SUCCESS) + if (resp.status == PM3_SUCCESS) { PrintAndLogEx(INFO, "Done!"); + } PrintAndLogEx(HINT, "Try `" _YELLOW_("mem spiffs tree") "` to verify"); return PM3_SUCCESS; diff --git a/client/src/cmdhf.c b/client/src/cmdhf.c index 9414f1be7..c38e6da03 100644 --- a/client/src/cmdhf.c +++ b/client/src/cmdhf.c @@ -516,7 +516,7 @@ int CmdHFSniff(const char *Cmd) { } } } - PrintAndLogEx(INFO, "Done."); + PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; } diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index 00ff1952a..686fb5067 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -457,23 +457,27 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card) { SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; - WaitForResponse(CMD_ACK, &resp); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } + memcpy(card, (iso14a_card_select_t *)resp.data.asBytes, sizeof(iso14a_card_select_t)); uint64_t select_status = resp.oldarg[0]; // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision if (select_status == 0) { - PrintAndLogEx(ERR, "E->iso14443a card select failed"); + PrintAndLogEx(ERR, "iso14443a card select failed"); return PM3_EFAILED; } if (select_status == 2) { - PrintAndLogEx(ERR, "E->Card doesn't support iso14443-4 mode"); + PrintAndLogEx(ERR, "Card doesn't support iso14443-4 mode"); return PM3_EFAILED; } if (select_status == 3) { - PrintAndLogEx(INFO, "E->Card doesn't support standard iso14443-3 anticollision"); + PrintAndLogEx(INFO, "Card doesn't support standard iso14443-3 anticollision"); // identify TOPAZ if (card->atqa[1] == 0x0C && card->atqa[0] == 0x00) { PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf topaz info`")); @@ -489,7 +493,7 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card) { // a valid ATS consists of at least the length byte (TL) and 2 CRC bytes if (card->ats_len < 3) { - PrintAndLogEx(INFO, "E-> Error ATS length(%d) : %s", card->ats_len, sprint_hex(card->ats, card->ats_len)); + PrintAndLogEx(INFO, "Error ATS length(%d) : %s", card->ats_len, sprint_hex(card->ats, card->ats_len)); return PM3_ECARDEXCHANGE; } @@ -754,9 +758,12 @@ static int CmdHF14ACUIDs(const char *Cmd) { // execute anticollision procedure SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0); - PacketResponseNG resp; - WaitForResponse(CMD_ACK, &resp); + + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } iso14a_card_select_t *card = (iso14a_card_select_t *) resp.data.asBytes; @@ -773,7 +780,7 @@ static int CmdHF14ACUIDs(const char *Cmd) { } } PrintAndLogEx(SUCCESS, "end: %" PRIu64 " seconds", (msclock() - t1) / 1000); - return 1; + return PM3_SUCCESS; } // ## simulate iso14443a tag @@ -2217,7 +2224,11 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { // reconnect for further tests clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0); - WaitForResponse(CMD_ACK, &resp); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + DropField(); + return PM3_ETIMEOUT; + } memcpy(&card, (iso14a_card_select_t *)resp.data.asBytes, sizeof(iso14a_card_select_t)); @@ -2273,7 +2284,10 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) { uint8_t rats[] = { 0xE0, 0x80 }; // FSDI=8 (FSD=256), CID=0 clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, 2, 0, rats, sizeof(rats)); - WaitForResponse(CMD_ACK, &resp); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } memcpy(card.ats, resp.data.asBytes, resp.oldarg[0]); card.ats_len = resp.oldarg[0]; // note: ats_len includes CRC Bytes diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 7dd35ef64..b5d886382 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -1179,7 +1179,9 @@ static void hf15EmlClear(void) { clearCommandBuffer(); SendCommandNG(CMD_HF_ISO15693_EML_CLEAR, NULL, 0); PacketResponseNG resp; - WaitForResponse(CMD_HF_ISO15693_EML_CLEAR, &resp); + if (WaitForResponseTimeout(CMD_HF_ISO15693_EML_CLEAR, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + } } static int hf15EmlSetMem(const uint8_t *data, uint16_t count, size_t offset) { diff --git a/client/src/cmdhfepa.c b/client/src/cmdhfepa.c index 4c6c67f72..6332130ad 100644 --- a/client/src/cmdhfepa.c +++ b/client/src/cmdhfepa.c @@ -73,7 +73,6 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) { PacketResponseNG resp; clearCommandBuffer(); SendCommandNG(CMD_HF_EPA_COLLECT_NONCE, (uint8_t *)&payload, sizeof(payload)); - WaitForResponse(CMD_HF_EPA_COLLECT_NONCE, &resp); // check if command failed @@ -241,7 +240,6 @@ static int CmdHFEPAPACESimulate(const char *Cmd) { clearCommandBuffer(); SendCommandMIX(CMD_HF_EPA_PACE_SIMULATE, 0, 0, 0, pwd, plen); - PacketResponseNG resp; WaitForResponse(CMD_ACK, &resp); diff --git a/client/src/cmdhfgallagher.c b/client/src/cmdhfgallagher.c index 7f70e3245..b83bfd455 100644 --- a/client/src/cmdhfgallagher.c +++ b/client/src/cmdhfgallagher.c @@ -1088,7 +1088,7 @@ static int CmdGallagherClone(const char *cmd) { PM3_RET_IF_ERR_WITH_MSG(res, "Failed creating Gallagher credential file"); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf gallagher reader`") " to verify"); return PM3_SUCCESS; } @@ -1169,7 +1169,7 @@ static int CmdGallagherDelete(const char *cmd) { PM3_RET_IF_ERR_WITH_MSG(res, "Failed deleting Gallagher application"); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf gallagher reader`") " to verify"); return PM3_SUCCESS; } diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index f6dd33384..cfe76e07b 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -3900,7 +3900,6 @@ static int iclass_recover(uint8_t key[8], uint32_t index_start, uint32_t loop, u PacketResponseNG resp; clearCommandBuffer(); SendCommandNG(CMD_HF_ICLASS_RECOVER, (uint8_t *)payload, payload_size); - WaitForResponse(CMD_HF_ICLASS_RECOVER, &resp); if (resp.status == PM3_SUCCESS) { diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index 1bc929459..dc5caa94b 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -1465,9 +1465,11 @@ static int CmdHF14aDesChk(const char *Cmd) { DropField(); // MIFARE DESFire info SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); - PacketResponseNG resp; - WaitForResponse(CMD_ACK, &resp); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } iso14a_card_select_t card; memcpy(&card, (iso14a_card_select_t *)resp.data.asBytes, sizeof(iso14a_card_select_t)); @@ -2173,7 +2175,7 @@ static int CmdHF14ADesBruteApps(const char *Cmd) { } PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(SUCCESS, _GREEN_("Done")); + PrintAndLogEx(SUCCESS, _GREEN_("Done!")); DropField(); return PM3_SUCCESS; } @@ -2923,7 +2925,7 @@ static int CmdHF14ADesFormatPICC(const char *Cmd) { return PM3_ESOFT; } - PrintAndLogEx(SUCCESS, "Desfire format: " _GREEN_("done")); + PrintAndLogEx(SUCCESS, "Desfire format: " _GREEN_("done!")); DropField(); return PM3_SUCCESS; diff --git a/client/src/cmdhfmfp.c b/client/src/cmdhfmfp.c index 0879b89e8..e6fcf55f9 100644 --- a/client/src/cmdhfmfp.c +++ b/client/src/cmdhfmfp.c @@ -1677,7 +1677,10 @@ static int CmdHFMFPChk(const char *Cmd) { SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; - WaitForResponse(CMD_ACK, &resp); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } iso14a_card_select_t card; memcpy(&card, (iso14a_card_select_t *)resp.data.asBytes, sizeof(iso14a_card_select_t)); diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index de61e7995..154146c12 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -307,7 +307,10 @@ int ul_read_uid(uint8_t *uid) { clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0); PacketResponseNG resp; - WaitForResponse(CMD_ACK, &resp); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } iso14a_card_select_t card; memcpy(&card, (iso14a_card_select_t *)resp.data.asBytes, sizeof(iso14a_card_select_t)); @@ -4213,7 +4216,11 @@ static int CmdHF14AMfUKeyGen(const char *Cmd) { clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_RATS, 0, 0, NULL, 0); PacketResponseNG resp; - WaitForResponse(CMD_ACK, &resp); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } + iso14a_card_select_t card; memcpy(&card, (iso14a_card_select_t *)resp.data.asBytes, sizeof(iso14a_card_select_t)); diff --git a/client/src/cmdlfawid.c b/client/src/cmdlfawid.c index 51a0eea11..07504195a 100644 --- a/client/src/cmdlfawid.c +++ b/client/src/cmdlfawid.c @@ -433,7 +433,7 @@ static int CmdAWIDClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf awid reader`") " to verify"); return res; } diff --git a/client/src/cmdlfdestron.c b/client/src/cmdlfdestron.c index 52a0b736b..b5e1b10d9 100644 --- a/client/src/cmdlfdestron.c +++ b/client/src/cmdlfdestron.c @@ -212,7 +212,7 @@ static int CmdDestronClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf destron reader`") " to verify"); return res; } diff --git a/client/src/cmdlfem410x.c b/client/src/cmdlfem410x.c index 1c20254da..8b051ade9 100644 --- a/client/src/cmdlfem410x.c +++ b/client/src/cmdlfem410x.c @@ -799,12 +799,15 @@ static int CmdEM410xClone(const char *Cmd) { payload.low = (uint32_t)id; SendCommandNG(CMD_LF_EM410X_CLONE, (uint8_t *)&payload, sizeof(payload)); - WaitForResponse(CMD_LF_EM410X_CLONE, &resp); + if (WaitForResponseTimeout(CMD_LF_EM410X_CLONE, &resp, 2000) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } } switch (resp.status) { case PM3_SUCCESS: { - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 410x reader`") " to verify"); break; } diff --git a/client/src/cmdlfem4x50.c b/client/src/cmdlfem4x50.c index bb9b1d162..34ffa1bdc 100644 --- a/client/src/cmdlfem4x50.c +++ b/client/src/cmdlfem4x50.c @@ -340,7 +340,10 @@ static int CmdEM4x50Login(const char *Cmd) { clearCommandBuffer(); PacketResponseNG resp; SendCommandNG(CMD_LF_EM4X50_LOGIN, (uint8_t *)&password, sizeof(password)); - WaitForResponse(CMD_LF_EM4X50_LOGIN, &resp); + if (WaitForResponseTimeout(CMD_LF_EM4X50_LOGIN, &resp, 2000) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } // print response if (resp.status == PM3_SUCCESS) diff --git a/client/src/cmdlffdxb.c b/client/src/cmdlffdxb.c index a7478e43b..f7b6742c6 100644 --- a/client/src/cmdlffdxb.c +++ b/client/src/cmdlffdxb.c @@ -802,7 +802,7 @@ static int CmdFdxBClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf fdxb reader`") " to verify"); return res; } diff --git a/client/src/cmdlfgallagher.c b/client/src/cmdlfgallagher.c index f2bd45af3..5617d90a8 100644 --- a/client/src/cmdlfgallagher.c +++ b/client/src/cmdlfgallagher.c @@ -276,7 +276,7 @@ static int CmdGallagherClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf gallagher reader`") " to verify"); return res; } diff --git a/client/src/cmdlfguard.c b/client/src/cmdlfguard.c index fcf1f2c6c..ea567499a 100644 --- a/client/src/cmdlfguard.c +++ b/client/src/cmdlfguard.c @@ -331,7 +331,7 @@ static int CmdGuardClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf gproxii reader`") " to verify"); return res; } diff --git a/client/src/cmdlfhid.c b/client/src/cmdlfhid.c index ab41f3798..204505972 100644 --- a/client/src/cmdlfhid.c +++ b/client/src/cmdlfhid.c @@ -58,8 +58,9 @@ static int sendPing(void) { SendCommandNG(CMD_PING, NULL, 0); clearCommandBuffer(); PacketResponseNG resp; - if (!WaitForResponseTimeout(CMD_PING, &resp, 1000)) + if (WaitForResponseTimeout(CMD_PING, &resp, 1000) == false) { return PM3_ETIMEOUT; + } return PM3_SUCCESS; } static int sendTry(uint8_t format_idx, wiegand_card_t *card, uint32_t delay, bool verbose) { @@ -470,15 +471,17 @@ static int CmdHIDClone(const char *Cmd) { clearCommandBuffer(); SendCommandNG(CMD_LF_HID_CLONE, (uint8_t *)&payload, sizeof(payload)); - PacketResponseNG resp; - WaitForResponse(CMD_LF_HID_CLONE, &resp); + if (WaitForResponseTimeout(CMD_LF_HID_CLONE, &resp, 2000) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } + if (resp.status == PM3_SUCCESS) { + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf hid reader`") " to verify"); - PrintAndLogEx(INFO, "Done!"); } else { PrintAndLogEx(FAILED, "cloning ( " _RED_("fail") " )"); - } return resp.status; } diff --git a/client/src/cmdlfidteck.c b/client/src/cmdlfidteck.c index 6ac9c0695..0fb4242fc 100644 --- a/client/src/cmdlfidteck.c +++ b/client/src/cmdlfidteck.c @@ -226,7 +226,7 @@ static int CmdIdteckClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf idteck reader`") " to verify"); return res; } diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 89922c0ac..80a7b5fbb 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -945,7 +945,7 @@ static int CmdIndalaClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf indala reader`") " to verify"); return res; } diff --git a/client/src/cmdlfio.c b/client/src/cmdlfio.c index ad4517732..6e92ce362 100644 --- a/client/src/cmdlfio.c +++ b/client/src/cmdlfio.c @@ -358,7 +358,7 @@ static int CmdIOProxClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf io reader`") " to verify"); return res; } diff --git a/client/src/cmdlfjablotron.c b/client/src/cmdlfjablotron.c index 2651ebe51..b584d8187 100644 --- a/client/src/cmdlfjablotron.c +++ b/client/src/cmdlfjablotron.c @@ -240,7 +240,7 @@ static int CmdJablotronClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf jablotron reader`") " to verify"); return res; } diff --git a/client/src/cmdlfkeri.c b/client/src/cmdlfkeri.c index 1a390fa45..16f7d07c9 100644 --- a/client/src/cmdlfkeri.c +++ b/client/src/cmdlfkeri.c @@ -309,7 +309,7 @@ static int CmdKeriClone(const char *Cmd) { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf keri read`") " to verify"); return res; } diff --git a/client/src/cmdlfmotorola.c b/client/src/cmdlfmotorola.c index 52c70c832..00f22cad3 100644 --- a/client/src/cmdlfmotorola.c +++ b/client/src/cmdlfmotorola.c @@ -253,7 +253,7 @@ static int CmdMotorolaClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf motorola reader`") " to verify"); return res; } diff --git a/client/src/cmdlfnedap.c b/client/src/cmdlfnedap.c index 4d51116e8..e5f857a03 100644 --- a/client/src/cmdlfnedap.c +++ b/client/src/cmdlfnedap.c @@ -472,7 +472,7 @@ static int CmdLFNedapClone(const char *Cmd) { } else { PrintAndLogEx(NORMAL, ""); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf nedap reader`") " to verify"); return res; } diff --git a/client/src/cmdlfnexwatch.c b/client/src/cmdlfnexwatch.c index 06a1dce44..6977f5593 100644 --- a/client/src/cmdlfnexwatch.c +++ b/client/src/cmdlfnexwatch.c @@ -447,7 +447,7 @@ static int CmdNexWatchClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf nexwatch reader`") " to verify"); return res; } diff --git a/client/src/cmdlfnoralsy.c b/client/src/cmdlfnoralsy.c index 562cca539..7eaf22f7d 100644 --- a/client/src/cmdlfnoralsy.c +++ b/client/src/cmdlfnoralsy.c @@ -220,7 +220,7 @@ static int CmdNoralsyClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf noralsy reader`") " to verify"); return res; } diff --git a/client/src/cmdlfpac.c b/client/src/cmdlfpac.c index c1f6247f7..0ba92534b 100644 --- a/client/src/cmdlfpac.c +++ b/client/src/cmdlfpac.c @@ -304,7 +304,7 @@ static int CmdPacClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf pac reader`") " to verify"); return res; } diff --git a/client/src/cmdlfparadox.c b/client/src/cmdlfparadox.c index 70906b58d..8c5e0cf8e 100644 --- a/client/src/cmdlfparadox.c +++ b/client/src/cmdlfparadox.c @@ -383,7 +383,7 @@ static int CmdParadoxClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf paradox read`") " to verify"); return res; } diff --git a/client/src/cmdlfpcf7931.c b/client/src/cmdlfpcf7931.c index 067fecde2..53bc19f03 100644 --- a/client/src/cmdlfpcf7931.c +++ b/client/src/cmdlfpcf7931.c @@ -193,7 +193,7 @@ static int CmdLFPCF7931Write(const char *Cmd) { clearCommandBuffer(); SendCommandMIX(CMD_LF_PCF7931_WRITE, block, idx, data[0], buf, sizeof(buf)); - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf pcf7931 reader`") " to verify"); return PM3_SUCCESS; } diff --git a/client/src/cmdlfpresco.c b/client/src/cmdlfpresco.c index 2fd78c724..c566c9c4b 100644 --- a/client/src/cmdlfpresco.c +++ b/client/src/cmdlfpresco.c @@ -264,7 +264,7 @@ static int CmdPrescoClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf presco reader`") " to verify"); return res; } diff --git a/client/src/cmdlfpyramid.c b/client/src/cmdlfpyramid.c index 470d0e697..dcc87e1fa 100644 --- a/client/src/cmdlfpyramid.c +++ b/client/src/cmdlfpyramid.c @@ -355,7 +355,7 @@ static int CmdPyramidClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf pyramid reader`") " to verify"); return res; } diff --git a/client/src/cmdlfsecurakey.c b/client/src/cmdlfsecurakey.c index e20968a5e..3d61887e5 100644 --- a/client/src/cmdlfsecurakey.c +++ b/client/src/cmdlfsecurakey.c @@ -232,7 +232,7 @@ static int CmdSecurakeyClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf securakey reader`") " to verify"); return res; } diff --git a/client/src/cmdlfti.c b/client/src/cmdlfti.c index 4a5dcc18a..2c28bab8b 100644 --- a/client/src/cmdlfti.c +++ b/client/src/cmdlfti.c @@ -369,7 +369,7 @@ static int CmdTIWrite(const char *Cmd) { clearCommandBuffer(); SendCommandNG(CMD_LF_TI_WRITE, (uint8_t *)&payload, sizeof(payload)); - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf ti reader`") " to verify"); return PM3_SUCCESS; } diff --git a/client/src/cmdlfverichip_disabled.c b/client/src/cmdlfverichip_disabled.c index 3a69b3a92..fe9dc438f 100644 --- a/client/src/cmdlfverichip_disabled.c +++ b/client/src/cmdlfverichip_disabled.c @@ -137,7 +137,7 @@ static int CmdVerichipClone(const char *Cmd) { print_blocks(blocks, ARRAYLEN(blocks)); int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf verichip read`") " to verify"); return res; } diff --git a/client/src/cmdlfviking.c b/client/src/cmdlfviking.c index 3ed4c83fb..d2f3b4e39 100644 --- a/client/src/cmdlfviking.c +++ b/client/src/cmdlfviking.c @@ -176,7 +176,7 @@ static int CmdVikingClone(const char *Cmd) { PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf viking reader`") " to verify"); return resp.status; } diff --git a/client/src/cmdlfvisa2000.c b/client/src/cmdlfvisa2000.c index 5e473fcf3..c7b9c8393 100644 --- a/client/src/cmdlfvisa2000.c +++ b/client/src/cmdlfvisa2000.c @@ -244,7 +244,7 @@ static int CmdVisa2kClone(const char *Cmd) { } else { res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); } - PrintAndLogEx(SUCCESS, "Done"); + PrintAndLogEx(SUCCESS, "Done!"); PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf visa2000 reader`") " to verify"); return res; } diff --git a/client/src/mifare/desfirecore.c b/client/src/mifare/desfirecore.c index 1376fce57..7bf692184 100644 --- a/client/src/mifare/desfirecore.c +++ b/client/src/mifare/desfirecore.c @@ -3052,7 +3052,10 @@ int DesfireGetCardUID(DesfireContext_t *ctx) { SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT, 0, 0, NULL, 0); PacketResponseNG resp; - WaitForResponse(CMD_ACK, &resp); + if (WaitForResponseTimeout(CMD_ACK, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "timeout while waiting for reply."); + return PM3_ETIMEOUT; + } memcpy(&card, (iso14a_card_select_t *)resp.data.asBytes, sizeof(iso14a_card_select_t)); uint64_t select_status = resp.oldarg[0]; diff --git a/common_arm/flashmem.c b/common_arm/flashmem.c index b08d1b725..85a4c8f6d 100644 --- a/common_arm/flashmem.c +++ b/common_arm/flashmem.c @@ -49,12 +49,12 @@ void FlashmemSetSpiBaudrate(uint32_t baudrate) { } // read ID out -bool Flash_ReadID(flash_device_type_t *result, bool read_jedec ) { +bool Flash_ReadID(flash_device_type_t *result, bool read_jedec) { if (Flash_CheckBusy(BUSY_TIMEOUT)) return false; - if ( read_jedec) { + if (read_jedec) { // 0x9F JEDEC FlashSendByte(JEDECID); @@ -382,10 +382,10 @@ void Flashmem_print_status(void) { } if (Flash_ReadID(&device_type, true)) { Dbprintf(" JEDEC Mfr ID / Dev ID... " _YELLOW_("%02X / %02X%02X"), - device_type.manufacturer_id, - device_type.device_id, - device_type.device_id2 - ); + device_type.manufacturer_id, + device_type.device_id, + device_type.device_id2 + ); } } diff --git a/doc/commands.json b/doc/commands.json index 79df23101..7641f4e04 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -12956,6 +12956,6 @@ "metadata": { "commands_extracted": 747, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2024-10-01T08:14:57" + "extracted_on": "2024-10-04T07:43:15" } }