hf mf ecfill: wait for execution and return status

This commit is contained in:
Philippe Teuwen 2024-10-13 22:17:48 +02:00
commit e7ff2ad1ca
3 changed files with 21 additions and 2 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 mf ecfill` to wait for execution and return status (@doegox)
- Added option to wait for a card to `hf 14a reader` (@doegox) - Added option to wait for a card to `hf 14a reader` (@doegox)
- Added support for quick dump via backdoor auth to `hf mf ecfill` (@doegox) - Added support for quick dump via backdoor auth to `hf mf ecfill` (@doegox)
- Fixed `hf mf restore` - really skip strict ACLs unless --force (@doegox) - Fixed `hf mf restore` - really skip strict ACLs unless --force (@doegox)

View file

@ -2377,6 +2377,14 @@ int MifareECardLoad(uint8_t sectorcnt, uint8_t keytype, uint8_t *key) {
if (have_uid == false) { // need a full select cycle to get the uid first if (have_uid == false) { // need a full select cycle to get the uid first
iso14a_card_select_t card_info; iso14a_card_select_t card_info;
if (iso14443a_select_card(uid, &card_info, &cuid, true, 0, true) == 0) { if (iso14443a_select_card(uid, &card_info, &cuid, true, 0, true) == 0) {
if (s == 0) {
// first attempt, if no card let's stop directly
retval = PM3_EFAILED;
if (g_dbglevel >= DBG_ERROR) {
Dbprintf("Card not found");
}
goto out;
}
continue; continue;
} }

View file

@ -4999,8 +4999,18 @@ static int CmdHF14AMfECFill(const char *Cmd) {
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_HF_MIFARE_EML_LOAD, (uint8_t *)&payload, sizeof(payload)); SendCommandNG(CMD_HF_MIFARE_EML_LOAD, (uint8_t *)&payload, sizeof(payload));
// 2021, iceman: should get a response from device when its done. PacketResponseNG resp;
return PM3_SUCCESS; if (WaitForResponseTimeout(CMD_HF_MIFARE_EML_LOAD, &resp, 1500) == false) {
PrintAndLogEx(WARNING, "command execution time out");
return PM3_ETIMEOUT;
}
if (resp.status == PM3_SUCCESS)
PrintAndLogEx(SUCCESS, "Fill ( " _GREEN_("ok") " )");
else
PrintAndLogEx(FAILED, "Fill ( " _RED_("fail") " )");
return resp.status;
} }
static int CmdHF14AMfEKeyPrn(const char *Cmd) { static int CmdHF14AMfEKeyPrn(const char *Cmd) {