Mifare1ksim logic closer to SimulateIso14443aTag and keep running when using mfkey32v2
This commit is contained in:
1 parent
c1a038aa56
commit
3b91624ea6
4 files changed
+86
-88
No files matched your search
@@ -912,11 +912,6 @@ int CmdHF14ASim(const char *Cmd) {
|
||||
// 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)) {
|
||||
//iceman: readerAttack call frees k_sector , this call is useless.
|
||||
showSectorTable(k_sector, k_sectors_cnt);
|
||||
}
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "Done!");
|
||||
@@ -3799,9 +3794,6 @@ int CmdHF14AAIDSim(const char *Cmd) {
|
||||
SendCommandNG(CMD_HF_ISO14443A_SIM_AID, (uint8_t *)&payload, sizeof(payload));
|
||||
PacketResponseNG resp = {0};
|
||||
|
||||
sector_t *k_sector = NULL;
|
||||
size_t k_sectors_cnt = MIFARE_4K_MAXSECTOR;
|
||||
|
||||
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " to abort simulation");
|
||||
bool keypress = kbd_enter_pressed();
|
||||
while (keypress == false) {
|
||||
@@ -3823,11 +3815,6 @@ int CmdHF14AAIDSim(const char *Cmd) {
|
||||
// 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)) {
|
||||
//iceman: readerAttack call frees k_sector , this call is useless.
|
||||
showSectorTable(k_sector, k_sectors_cnt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+39
-26
@@ -4251,36 +4251,49 @@ static int CmdHF14AMfSim(const char *Cmd) {
|
||||
payload.sak = sak[0];
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_MIFARE_SIMULATE, (uint8_t *)&payload, sizeof(payload));
|
||||
PacketResponseNG resp;
|
||||
|
||||
if (flags & FLAG_INTERACTIVE) {
|
||||
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or send another cmd to abort simulation");
|
||||
|
||||
sector_t *k_sector = NULL;
|
||||
|
||||
while (kbd_enter_pressed() == 0) {
|
||||
|
||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false)
|
||||
continue;
|
||||
|
||||
if ((flags & FLAG_NR_AR_ATTACK) != FLAG_NR_AR_ATTACK)
|
||||
break;
|
||||
|
||||
if ((resp.oldarg[0] & 0xffff) != CMD_HF_MIFARE_SIMULATE)
|
||||
break;
|
||||
|
||||
nonces_t data[1];
|
||||
memcpy(data, resp.data.asBytes, sizeof(data));
|
||||
readerAttack(k_sector, k_sectors_cnt, data[0], setEmulatorMem, verbose);
|
||||
break;
|
||||
}
|
||||
//iceman: readerAttack call frees k_sector. this call below is useless.
|
||||
showSectorTable(k_sector, k_sectors_cnt);
|
||||
|
||||
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or a key to abort simulation");
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " to abort simulation");
|
||||
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or send another cmd to abort simulation");
|
||||
}
|
||||
bool cont;
|
||||
do {
|
||||
cont = false;
|
||||
SendCommandNG(CMD_HF_MIFARE_SIMULATE, (uint8_t *)&payload, sizeof(payload));
|
||||
if (flags & FLAG_INTERACTIVE) {
|
||||
PacketResponseNG resp;
|
||||
sector_t *k_sector = NULL;
|
||||
|
||||
bool keypress = kbd_enter_pressed();
|
||||
while (keypress == false) {
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_MIFARE_SIMULATE, &resp, 1500) == 0) {
|
||||
keypress = kbd_enter_pressed();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (resp.status != PM3_SUCCESS)
|
||||
break;
|
||||
|
||||
if ((flags & FLAG_NR_AR_ATTACK) != FLAG_NR_AR_ATTACK)
|
||||
break;
|
||||
|
||||
const nonces_t *data = (nonces_t *)resp.data.asBytes;
|
||||
readerAttack(k_sector, k_sectors_cnt, data[0], setEmulatorMem, verbose);
|
||||
cont = true;
|
||||
break;
|
||||
}
|
||||
if (keypress) {
|
||||
if ((flags & FLAG_NR_AR_ATTACK) == FLAG_NR_AR_ATTACK) {
|
||||
// inform device to break the sim loop since client has exited
|
||||
PrintAndLogEx(INFO, "Key pressed, please wait a few seconds for the pm3 to stop...");
|
||||
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while (cont);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user