mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
make hf search robust to various HF configurations
This commit is contained in:
parent
4a3fb3ccf1
commit
25f358955b
7 changed files with 63 additions and 39 deletions
|
@ -1090,6 +1090,12 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// always available
|
||||||
|
case CMD_HF_DROPFIELD: {
|
||||||
|
hf_field_off();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WITH_ISO14443a
|
#ifdef WITH_ISO14443a
|
||||||
case CMD_HF_ISO14443A_SNIFF: {
|
case CMD_HF_ISO14443A_SNIFF: {
|
||||||
SniffIso14443a(packet->data.asBytes[0]);
|
SniffIso14443a(packet->data.asBytes[0]);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#define MAX_ISO14A_TIMEOUT 524288
|
#define MAX_ISO14A_TIMEOUT 524288
|
||||||
static uint32_t iso14a_timeout;
|
static uint32_t iso14a_timeout;
|
||||||
// if iso14443a not active - transmit/receive dont try to execute
|
// if iso14443a not active - transmit/receive dont try to execute
|
||||||
static bool iso14443a_active = false;
|
static bool hf_field_active = false;
|
||||||
|
|
||||||
uint8_t colpos = 0;
|
uint8_t colpos = 0;
|
||||||
int rsamples = 0;
|
int rsamples = 0;
|
||||||
|
@ -1629,7 +1629,7 @@ void PrepareDelayedTransfer(uint16_t delay) {
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
static void TransmitFor14443a(const uint8_t *cmd, uint16_t len, uint32_t *timing) {
|
static void TransmitFor14443a(const uint8_t *cmd, uint16_t len, uint32_t *timing) {
|
||||||
|
|
||||||
if (!iso14443a_active)
|
if (!hf_field_active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_ISO14443A | FPGA_HF_ISO14443A_READER_MOD);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_ISO14443A | FPGA_HF_ISO14443A_READER_MOD);
|
||||||
|
@ -2014,7 +2014,7 @@ bool EmLogTrace(uint8_t *reader_data, uint16_t reader_len, uint32_t reader_Start
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool GetIso14443aAnswerFromTag_Thinfilm(uint8_t *receivedResponse, uint8_t *received_len) {
|
bool GetIso14443aAnswerFromTag_Thinfilm(uint8_t *receivedResponse, uint8_t *received_len) {
|
||||||
|
|
||||||
if (!iso14443a_active)
|
if (!hf_field_active)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set FPGA mode to "reader listen mode", no modulation (listen
|
// Set FPGA mode to "reader listen mode", no modulation (listen
|
||||||
|
@ -2063,7 +2063,7 @@ bool GetIso14443aAnswerFromTag_Thinfilm(uint8_t *receivedResponse, uint8_t *rec
|
||||||
static int GetIso14443aAnswerFromTag(uint8_t *receivedResponse, uint8_t *receivedResponsePar, uint16_t offset) {
|
static int GetIso14443aAnswerFromTag(uint8_t *receivedResponse, uint8_t *receivedResponsePar, uint16_t offset) {
|
||||||
uint32_t c = 0;
|
uint32_t c = 0;
|
||||||
|
|
||||||
if (!iso14443a_active)
|
if (!hf_field_active)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Set FPGA mode to "reader listen mode", no modulation (listen
|
// Set FPGA mode to "reader listen mode", no modulation (listen
|
||||||
|
@ -2504,14 +2504,14 @@ void iso14443a_setup(uint8_t fpga_minor_mode) {
|
||||||
NextTransferTime = 2 * DELAY_ARM2AIR_AS_READER;
|
NextTransferTime = 2 * DELAY_ARM2AIR_AS_READER;
|
||||||
iso14a_set_timeout(1060); // 106 * 10ms default
|
iso14a_set_timeout(1060); // 106 * 10ms default
|
||||||
|
|
||||||
iso14443a_active = true;
|
hf_field_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void iso14443a_off(void) {
|
void hf_field_off(void) {
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
iso14443a_active = false;
|
hf_field_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Peter Fillmore 2015
|
/* Peter Fillmore 2015
|
||||||
|
@ -2716,7 +2716,7 @@ void ReaderIso14443a(PacketCommandNG *c) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OUT:
|
OUT:
|
||||||
iso14443a_off();
|
hf_field_off();
|
||||||
set_tracing(false);
|
set_tracing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3011,7 +3011,7 @@ void ReaderMifare(bool first_try, uint8_t block, uint8_t keytype) {
|
||||||
|
|
||||||
reply_mix(CMD_ACK, isOK, 0, 0, buf, sizeof(buf));
|
reply_mix(CMD_ACK, isOK, 0, 0, buf, sizeof(buf));
|
||||||
|
|
||||||
iso14443a_off();
|
hf_field_off();
|
||||||
set_tracing(false);
|
set_tracing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3250,6 +3250,6 @@ void DetectNACKbug(void) {
|
||||||
|
|
||||||
//reply_mix(CMD_ACK, isOK, num_nacks, i, 0, 0);
|
//reply_mix(CMD_ACK, isOK, num_nacks, i, 0, 0);
|
||||||
BigBuf_free();
|
BigBuf_free();
|
||||||
iso14443a_off();
|
hf_field_off();
|
||||||
set_tracing(false);
|
set_tracing(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, bool send_chaining, void *data, u
|
||||||
int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats);
|
int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats);
|
||||||
int iso14443a_fast_select_card(uint8_t *uid_ptr, uint8_t num_cascades);
|
int iso14443a_fast_select_card(uint8_t *uid_ptr, uint8_t num_cascades);
|
||||||
void iso14a_set_trigger(bool enable);
|
void iso14a_set_trigger(bool enable);
|
||||||
void iso14443a_off(void);
|
void hf_field_off(void);
|
||||||
|
|
||||||
int EmSendCmd14443aRaw(uint8_t *resp, uint16_t respLen);
|
int EmSendCmd14443aRaw(uint8_t *resp, uint16_t respLen);
|
||||||
int EmSend4bit(uint8_t resp);
|
int EmSend4bit(uint8_t resp);
|
||||||
|
|
|
@ -32,7 +32,7 @@ void ReadThinFilm(void) {
|
||||||
bool status = GetIso14443aAnswerFromTag_Thinfilm(buf, &len);
|
bool status = GetIso14443aAnswerFromTag_Thinfilm(buf, &len);
|
||||||
reply_ng(CMD_HF_THINFILM_READ, status ? PM3_SUCCESS : PM3_ENODATA, buf, len);
|
reply_ng(CMD_HF_THINFILM_READ, status ? PM3_SUCCESS : PM3_ENODATA, buf, len);
|
||||||
|
|
||||||
iso14443a_off();
|
hf_field_off();
|
||||||
set_tracing(false);
|
set_tracing(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,42 +54,59 @@ int CmdHFSearch(const char *Cmd) {
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Checking for known tags...\n");
|
PrintAndLogEx(INFO, "Checking for known tags...\n");
|
||||||
|
|
||||||
if (infoThinFilm(false) == PM3_SUCCESS) {
|
if (IfPm3NfcBarcode()) {
|
||||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") " found\n");
|
if (infoThinFilm(false) == PM3_SUCCESS) {
|
||||||
return 1;
|
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") " found\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (IfPm3Iso14443a()) {
|
||||||
if (infoHF14A(false, false) > 0) {
|
if (infoHF14A(false, false) > 0) {
|
||||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-A tag") " found\n");
|
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-A tag") " found\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (readHF15Uid(false) == 1) {
|
if (IfPm3Iso15693()) {
|
||||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO15693 tag") " found\n");
|
if (readHF15Uid(false) == 1) {
|
||||||
return 1;
|
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO15693 tag") " found\n");
|
||||||
|
DropField();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
DropField();
|
||||||
}
|
}
|
||||||
if (readLegicUid(false) == 0) {
|
if (IfPm3Legicrf()) {
|
||||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC tag") " found\n");
|
if (readLegicUid(false) == 0) {
|
||||||
return 1;
|
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC tag") " found\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (readTopazUid() == 0) {
|
if (IfPm3Iso14443a()) {
|
||||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") " found\n");
|
if (readTopazUid() == 0) {
|
||||||
return 1;
|
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") " found\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 14b and iclass is the longest test (put last)
|
// 14b and iclass is the longest test (put last)
|
||||||
if (readHF14B(false) == 1) {
|
if (IfPm3Iso14443a()) {
|
||||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-B tag") " found\n");
|
if (readHF14B(false) == 1) {
|
||||||
return 1;
|
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-B tag") " found\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (readIclass(false, false) == 1) {
|
if (IfPm3Iclass()) {
|
||||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iClass tag / PicoPass tag") " found\n");
|
if (readIclass(false, false) == 1) {
|
||||||
return 1;
|
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iClass tag / PicoPass tag") " found\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ans = CmdHFFelicaReader("s");
|
if (IfPm3Felica()) {
|
||||||
if (ans) {
|
ans = CmdHFFelicaReader("s");
|
||||||
PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") " found\n");
|
if (ans) {
|
||||||
return ans;
|
PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") " found\n");
|
||||||
|
return ans;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
#ifndef DropField
|
#ifndef DropField
|
||||||
#define DropField() { \
|
#define DropField() { \
|
||||||
clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, 0, 0, 0, NULL, 0); \
|
clearCommandBuffer(); SendCommandNG(CMD_HF_DROPFIELD, NULL, 0); \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -425,6 +425,7 @@ typedef struct {
|
||||||
#define CMD_MEASURE_ANTENNA_TUNING 0x0400
|
#define CMD_MEASURE_ANTENNA_TUNING 0x0400
|
||||||
#define CMD_MEASURE_ANTENNA_TUNING_HF 0x0401
|
#define CMD_MEASURE_ANTENNA_TUNING_HF 0x0401
|
||||||
#define CMD_LISTEN_READER_FIELD 0x0420
|
#define CMD_LISTEN_READER_FIELD 0x0420
|
||||||
|
#define CMD_HF_DROPFIELD 0x0430
|
||||||
|
|
||||||
// For direct FPGA control
|
// For direct FPGA control
|
||||||
#define CMD_FPGA_MAJOR_MODE_OFF 0x0500
|
#define CMD_FPGA_MAJOR_MODE_OFF 0x0500
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue