mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-28 19:31:19 +08: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
|
||||
|
||||
// always available
|
||||
case CMD_HF_DROPFIELD: {
|
||||
hf_field_off();
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef WITH_ISO14443a
|
||||
case CMD_HF_ISO14443A_SNIFF: {
|
||||
SniffIso14443a(packet->data.asBytes[0]);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#define MAX_ISO14A_TIMEOUT 524288
|
||||
static uint32_t iso14a_timeout;
|
||||
// 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;
|
||||
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) {
|
||||
|
||||
if (!iso14443a_active)
|
||||
if (!hf_field_active)
|
||||
return;
|
||||
|
||||
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) {
|
||||
|
||||
if (!iso14443a_active)
|
||||
if (!hf_field_active)
|
||||
return false;
|
||||
|
||||
// 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) {
|
||||
uint32_t c = 0;
|
||||
|
||||
if (!iso14443a_active)
|
||||
if (!hf_field_active)
|
||||
return false;
|
||||
|
||||
// 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;
|
||||
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);
|
||||
LEDsoff();
|
||||
iso14443a_active = false;
|
||||
hf_field_active = false;
|
||||
}
|
||||
|
||||
/* Peter Fillmore 2015
|
||||
|
@ -2716,7 +2716,7 @@ void ReaderIso14443a(PacketCommandNG *c) {
|
|||
return;
|
||||
|
||||
OUT:
|
||||
iso14443a_off();
|
||||
hf_field_off();
|
||||
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));
|
||||
|
||||
iso14443a_off();
|
||||
hf_field_off();
|
||||
set_tracing(false);
|
||||
}
|
||||
|
||||
|
@ -3250,6 +3250,6 @@ void DetectNACKbug(void) {
|
|||
|
||||
//reply_mix(CMD_ACK, isOK, num_nacks, i, 0, 0);
|
||||
BigBuf_free();
|
||||
iso14443a_off();
|
||||
hf_field_off();
|
||||
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_fast_select_card(uint8_t *uid_ptr, uint8_t num_cascades);
|
||||
void iso14a_set_trigger(bool enable);
|
||||
void iso14443a_off(void);
|
||||
void hf_field_off(void);
|
||||
|
||||
int EmSendCmd14443aRaw(uint8_t *resp, uint16_t respLen);
|
||||
int EmSend4bit(uint8_t resp);
|
||||
|
|
|
@ -32,7 +32,7 @@ void ReadThinFilm(void) {
|
|||
bool status = GetIso14443aAnswerFromTag_Thinfilm(buf, &len);
|
||||
reply_ng(CMD_HF_THINFILM_READ, status ? PM3_SUCCESS : PM3_ENODATA, buf, len);
|
||||
|
||||
iso14443a_off();
|
||||
hf_field_off();
|
||||
set_tracing(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,42 +54,59 @@ int CmdHFSearch(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(INFO, "Checking for known tags...\n");
|
||||
|
||||
if (infoThinFilm(false) == PM3_SUCCESS) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") " found\n");
|
||||
return 1;
|
||||
if (IfPm3NfcBarcode()) {
|
||||
if (infoThinFilm(false) == PM3_SUCCESS) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") " found\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (infoHF14A(false, false) > 0) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-A tag") " found\n");
|
||||
return 1;
|
||||
if (IfPm3Iso14443a()) {
|
||||
if (infoHF14A(false, false) > 0) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-A tag") " found\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (readHF15Uid(false) == 1) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO15693 tag") " found\n");
|
||||
return 1;
|
||||
if (IfPm3Iso15693()) {
|
||||
if (readHF15Uid(false) == 1) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO15693 tag") " found\n");
|
||||
DropField();
|
||||
return 1;
|
||||
}
|
||||
DropField();
|
||||
}
|
||||
if (readLegicUid(false) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC tag") " found\n");
|
||||
return 1;
|
||||
if (IfPm3Legicrf()) {
|
||||
if (readLegicUid(false) == 0) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC tag") " found\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (readTopazUid() == 0) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") " found\n");
|
||||
return 1;
|
||||
if (IfPm3Iso14443a()) {
|
||||
if (readTopazUid() == 0) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") " found\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// 14b and iclass is the longest test (put last)
|
||||
if (readHF14B(false) == 1) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-B tag") " found\n");
|
||||
return 1;
|
||||
if (IfPm3Iso14443a()) {
|
||||
if (readHF14B(false) == 1) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-B tag") " found\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (readIclass(false, false) == 1) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iClass tag / PicoPass tag") " found\n");
|
||||
return 1;
|
||||
if (IfPm3Iclass()) {
|
||||
if (readIclass(false, false) == 1) {
|
||||
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iClass tag / PicoPass tag") " found\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
ans = CmdHFFelicaReader("s");
|
||||
if (ans) {
|
||||
PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") " found\n");
|
||||
return ans;
|
||||
if (IfPm3Felica()) {
|
||||
ans = CmdHFFelicaReader("s");
|
||||
if (ans) {
|
||||
PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") " found\n");
|
||||
return ans;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#ifndef DropField
|
||||
#define DropField() { \
|
||||
clearCommandBuffer(); SendCommandMIX(CMD_HF_ISO14443A_READER, 0, 0, 0, NULL, 0); \
|
||||
clearCommandBuffer(); SendCommandNG(CMD_HF_DROPFIELD, NULL, 0); \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -425,6 +425,7 @@ typedef struct {
|
|||
#define CMD_MEASURE_ANTENNA_TUNING 0x0400
|
||||
#define CMD_MEASURE_ANTENNA_TUNING_HF 0x0401
|
||||
#define CMD_LISTEN_READER_FIELD 0x0420
|
||||
#define CMD_HF_DROPFIELD 0x0430
|
||||
|
||||
// For direct FPGA control
|
||||
#define CMD_FPGA_MAJOR_MODE_OFF 0x0500
|
||||
|
|
Loading…
Reference in a new issue