Merge pull request #3103 from aaronjamt/patch-14a-sniff-enter-stop

[14a sniff] Stop sniff with Enter key
This commit is contained in:
Iceman
2026-02-26 11:12:50 +01:00
committed by GitHub
2 changed files with 29 additions and 3 deletions
+9
View File
@@ -852,11 +852,20 @@ void RAMFUNC SniffIso14443a(uint8_t param) {
uint32_t rx_samples = 0;
uint16_t checker = 12000;
// loop and listen
while (BUTTON_PRESS() == false) {
WDT_HIT();
LED_A_ON();
if (checker-- == 0) {
if (data_available()) {
break;
}
checker = 12000;
}
register int readBufDataP = data - dma->buf;
register int dmaBufDataP = DMA_BUFFER_SIZE - AT91C_BASE_PDC_SSC->PDC_RCR;
if (readBufDataP <= dmaBufDataP) {
+20 -3
View File
@@ -1105,14 +1105,31 @@ int CmdHF14ASniff(const char *Cmd) {
clearCommandBuffer();
SendCommandNG(CMD_HF_ISO14443A_SNIFF, (uint8_t *)&param, sizeof(uint8_t));
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " to abort sniffing");
if (interactive) {
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " or " _GREEN_("<Enter>") " to abort sniffing");
PacketResponseNG resp;
WaitForResponse(CMD_HF_ISO14443A_SNIFF, &resp);
bool keypress = kbd_enter_pressed();
while (keypress == false) {
keypress = kbd_enter_pressed();
if (WaitForResponseTimeout(CMD_HF_ISO14443A_SNIFF, &resp, 500)) {
break;
}
}
if (keypress) {
// inform device to break the sim loop since client has exited
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
WaitForResponse(CMD_HF_ISO14443A_SNIFF, &resp);
}
PrintAndLogEx(INFO, "Done!");
PrintAndLogEx(HINT, "Hint: Try `" _YELLOW_("hf 14a list")"` to view captured tracelog");
PrintAndLogEx(HINT, "Hint: Try `" _YELLOW_("trace save -h") "` to save tracelog for later analysing");
} else {
PrintAndLogEx(INFO, "Press " _GREEN_("pm3 button") " to abort sniffing");
}
return PM3_SUCCESS;
}