iso15sniff: add an "iclass" bool parameter to SniffIso15693()

This is required to disable ISO15 flags parsing when sniffing iClass
because those flags don't exist in iClass coms (iClass iso15 based
communications are always fast and using only one subcarrier).
This commit is contained in:
Yann GASCUEL 2022-03-16 11:26:07 +01:00
parent 6d37410d33
commit c5f216558c
5 changed files with 18 additions and 11 deletions

View file

@ -100,7 +100,7 @@ void RunMod(void) {
Dbprintf(_YELLOW_("HF 15693 SNIFF started"));
rdv40_spiffs_lazy_mount();
SniffIso15693(0, NULL);
SniffIso15693(0, NULL, false);
Dbprintf("Stopped sniffing");
SpinDelay(200);

View file

@ -1232,7 +1232,7 @@ static void PacketReceived(PacketCommandNG *packet) {
break;
}
case CMD_HF_ISO15693_SNIFF: {
SniffIso15693(0, NULL);
SniffIso15693(0, NULL, false);
reply_ng(CMD_HF_ISO15693_SNIFF, PM3_SUCCESS, NULL, 0);
break;
}

View file

@ -91,7 +91,7 @@ static uint8_t get_pagemap(const picopass_hdr_t *hdr) {
// Both sides of communication!
//=============================================================================
void SniffIClass(uint8_t jam_search_len, uint8_t *jam_search_string) {
SniffIso15693(jam_search_len, jam_search_string);
SniffIso15693(jam_search_len, jam_search_string, true);
}
static void rotateCSN(const uint8_t *original_csn, uint8_t *rotated_csn) {

View file

@ -1575,7 +1575,8 @@ static int RAMFUNC Handle15693FSKSamplesFromTag(uint8_t freq, DecodeTagFSK_t *De
}
return false;
}
void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) {
void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string, bool iclass) {
LEDsoff();
LED_A_ON();
@ -1601,6 +1602,7 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) {
DecodeReaderInit(&dreader, cmd, sizeof(cmd), jam_search_len, jam_search_string);
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | FPGA_HF_READER_MODE_SNIFF_AMPLITUDE | FPGA_HF_READER_2SUBCARRIERS_424_484_KHZ);
LED_D_OFF();
SetAdcMuxFor(GPIO_MUXSEL_HIPKD);
@ -1622,7 +1624,7 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) {
bool reader_is_active = false;
bool expect_tag_answer = false;
bool expect_fsk_answer = false;
bool expect_fast_answer = false;
bool expect_fast_answer = true; // default to true is required for iClass
int dma_start_time = 0;
// Count of samples received so far, so that we can include timing
@ -1686,8 +1688,11 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) {
- 16 * 16; // time for EOF transfer
LogTrace_ISO15693(dreader.output, dreader.byteCount, (sof_time * 4), (eof_time * 4), NULL, true);
expect_fsk_answer = dreader.output[0] & ISO15_REQ_SUBCARRIER_TWO;
expect_fast_answer = dreader.output[0] & ISO15_REQ_DATARATE_HIGH;
if (!iclass) // Those flags don't exist in iClass
{
expect_fsk_answer = dreader.output[0] & ISO15_REQ_SUBCARRIER_TWO;
expect_fast_answer = dreader.output[0] & ISO15_REQ_DATARATE_HIGH;
}
}
// And ready to receive another command.
//DecodeReaderReset(&dreader); // already reseted
@ -1704,9 +1709,11 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) {
- 32 * 16 // time for SOF transfer
- 16 * 16; // time for EOF transfer
LogTrace_ISO15693(dreader.output, dreader.byteCount, (sof_time * 4), (eof_time * 4), NULL, true);
expect_fsk_answer = dreader.output[0] & ISO15_REQ_SUBCARRIER_TWO;
expect_fast_answer = dreader.output[0] & ISO15_REQ_DATARATE_HIGH;
if (!iclass) // Those flags don't exist in iClass
{
expect_fsk_answer = dreader.output[0] & ISO15_REQ_SUBCARRIER_TWO;
expect_fast_answer = dreader.output[0] & ISO15_REQ_DATARATE_HIGH;
}
}
// And ready to receive another command
//DecodeReaderReset(&dreader); // already reseted

View file

@ -50,7 +50,7 @@ void SimTagIso15693(uint8_t *uid); // simulate an ISO15693 tag - greg
void BruteforceIso15693Afi(uint32_t speed); // find an AFI of a tag - atrox
void DirectTag15693Command(uint32_t datalen, uint32_t speed, uint32_t recv, uint8_t *data); // send arbitrary commands from CLI - atrox
void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string);
void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string, bool iclass);
int SendDataTag(uint8_t *send, int sendlen, bool init, bool speed_fast, uint8_t *recv,
uint16_t max_recv_len, uint32_t start_time, uint16_t timeout, uint32_t *eof_time);