chg: hf 14a sim x - device simulation loop exited when client exits

This commit is contained in:
iceman1001 2019-11-19 12:01:04 +01:00
parent 051e008f11
commit 290c6f6c31

View file

@ -512,8 +512,9 @@ int CmdHF14ASim(const char *Cmd) {
PacketResponseNG resp;
PrintAndLogEx(SUCCESS, "press pm3-button to abort simulation");
bool keypress = kbd_enter_pressed();
while (!keypress) {
while (!kbd_enter_pressed()) {
if (WaitForResponseTimeout(CMD_HF_MIFARE_SIMULATE, &resp, 1500) == 0) continue;
if (resp.status != PM3_SUCCESS) break;
@ -521,7 +522,15 @@ int CmdHF14ASim(const char *Cmd) {
nonces_t *data = (nonces_t *)resp.data.asBytes;
readerAttack(data[0], setEmulatorMem, verbose);
keypress = kbd_enter_pressed();
}
if (keypress && (flags & FLAG_NR_AR_ATTACK) == FLAG_NR_AR_ATTACK) {
// inform device to break the sim loop since client has exited
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
}
if (resp.status == PM3_EOPABORTED && ((flags & FLAG_NR_AR_ATTACK) == FLAG_NR_AR_ATTACK))
showSectorTable();