diff --git a/CHANGELOG.md b/CHANGELOG.md index 19799efcd..5a20f8bf4 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] +- Added `-t` / `--timeout` option for `hf 15 sim` (@recursivenomad) - Added `--aid` parameter to `hf seos` commands (@kormax) - Added `hf iclass blacktears` command to perform an automated tearoff of block 1 to set non-secure page mode(@antiklesys) - Changed wiegand encoding to use shared helpers and have unified parameters (--raw, --bin, --new, --wiegand, etc.) (@cindersocket) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 2637ce8e7..93d44bffc 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -1489,6 +1489,7 @@ static int CmdHF15Sim(const char *Cmd) { arg_param_begin, arg_str0("u", "uid", "", "UID, 8 hex bytes"), arg_int0("b", "blocksize", "", "block size (def 4)"), + arg_int0("t", "timeout", "", "timeout in ms (def -1, ie. until button press)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -1502,6 +1503,7 @@ static int CmdHF15Sim(const char *Cmd) { int uidlen = 0; CLIGetHexWithReturn(ctx, 1, payload.uid, &uidlen); payload.block_size = arg_get_int_def(ctx, 2, 4); + size_t timeout = arg_get_int_def(ctx, 3, -1); CLIParserFree(ctx); // sanity checks @@ -1541,7 +1543,10 @@ static int CmdHF15Sim(const char *Cmd) { clearCommandBuffer(); SendCommandNG(CMD_HF_ISO15693_SIMULATE, (uint8_t *)&payload, sizeof(payload)); - WaitForResponse(CMD_HF_ISO15693_SIMULATE, &resp); + WaitForResponseTimeout(CMD_HF_ISO15693_SIMULATE, &resp, timeout); + if (timeout != (size_t) - 1) { + SendCommandNG(CMD_BREAK_LOOP, NULL, 0); + } PrintAndLogEx(INFO, "Done!"); return PM3_SUCCESS; }