From: marshmellow42 Date: Fri, 20 Feb 2015 02:22:05 +0000 (-0500) Subject: Revert "lf simask, lf simfsk and bug fixes" X-Git-Tag: show~6^2~22 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/e396001c47364fd52177960ef3b9ca3bef7adc3f Revert "lf simask, lf simfsk and bug fixes" This reverts commit fb0c84c3df8bb19bcefb5d2124d61ff2ac3d0af7. --- diff --git a/armsrc/appmain.c b/armsrc/appmain.c index bfb4078d..3da34777 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -662,13 +662,7 @@ void UsbPacketReceived(uint8_t *packet, int len) case CMD_HID_SIM_TAG: CmdHIDsimTAG(c->arg[0], c->arg[1], 1); break; - case CMD_FSK_SIM_TAG: - CmdFSKsimTAG(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes); - break; - case CMD_ASK_SIM_TAG: - CmdASKsimTag(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes); - break; - case CMD_HID_CLONE_TAG: + case CMD_HID_CLONE_TAG: CopyHIDtoT55x7(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes[0]); break; case CMD_IO_DEMOD_FSK: diff --git a/armsrc/apps.h b/armsrc/apps.h index 8e79a03a..a506f415 100644 --- a/armsrc/apps.h +++ b/armsrc/apps.h @@ -118,8 +118,6 @@ void AcquireTiType(void); void AcquireRawBitsTI(void); void SimulateTagLowFrequency(int period, int gap, int ledcontrol); void CmdHIDsimTAG(int hi, int lo, int ledcontrol); -void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream); -void CmdASKsimTag(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream); void CmdHIDdemodFSK(int findone, int *high, int *low, int ledcontrol); void CmdEM410xdemod(int findone, int *high, int *low, int ledcontrol); void CmdIOdemodFSK(int findone, int *high, int *low, int ledcontrol); diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 780af199..e34eab35 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -394,8 +394,8 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol) AT91C_BASE_PIOA->PIO_OER = GPIO_SSC_DOUT; AT91C_BASE_PIOA->PIO_ODR = GPIO_SSC_CLK; - #define SHORT_COIL() LOW(GPIO_SSC_DOUT) - #define OPEN_COIL() HIGH(GPIO_SSC_DOUT) +#define SHORT_COIL() LOW(GPIO_SSC_DOUT) +#define OPEN_COIL() HIGH(GPIO_SSC_DOUT) i = 0; for(;;) { @@ -417,7 +417,7 @@ void SimulateTagLowFrequency(int period, int gap, int ledcontrol) if (ledcontrol) LED_D_OFF(); - //wait for next sample time + while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK) { if(BUTTON_PRESS()) { DbpString("Stopped"); @@ -442,9 +442,8 @@ void SimulateTagLowFrequencyBidir(int divisor, int t0) { } -// compose fc/8 fc/10 waveform (FSK2) -static void fc(int c, int *n) -{ +// compose fc/8 fc/10 waveform +static void fc(int c, int *n) { uint8_t *dest = BigBuf_get_addr(); int idx; @@ -452,21 +451,20 @@ static void fc(int c, int *n) if(c==0) { dest[((*n)++)]=1; dest[((*n)++)]=1; - dest[((*n)++)]=1; - dest[((*n)++)]=1; + dest[((*n)++)]=0; + dest[((*n)++)]=0; dest[((*n)++)]=0; dest[((*n)++)]=0; dest[((*n)++)]=0; dest[((*n)++)]=0; } - // an fc/8 encoded bit is a bit pattern of 11000000 x6 = 48 samples if(c==8) { for (idx=0; idx<6; idx++) { dest[((*n)++)]=1; dest[((*n)++)]=1; - dest[((*n)++)]=1; - dest[((*n)++)]=1; + dest[((*n)++)]=0; + dest[((*n)++)]=0; dest[((*n)++)]=0; dest[((*n)++)]=0; dest[((*n)++)]=0; @@ -477,8 +475,6 @@ static void fc(int c, int *n) // an fc/10 encoded bit is a bit pattern of 1110000000 x5 = 50 samples if(c==10) { for (idx=0; idx<5; idx++) { - dest[((*n)++)]=1; - dest[((*n)++)]=1; dest[((*n)++)]=1; dest[((*n)++)]=1; dest[((*n)++)]=1; @@ -487,37 +483,8 @@ static void fc(int c, int *n) dest[((*n)++)]=0; dest[((*n)++)]=0; dest[((*n)++)]=0; - } - } -} -// compose fc/X fc/Y waveform (FSKx) -static void fcAll(uint8_t c, int *n, uint8_t clock) -{ - uint8_t *dest = BigBuf_get_addr(); - uint8_t idx; - uint8_t fcCnt; - // c = count of field clock for this bit - - int mod = clock % c; - // loop through clock - step field clock - for (idx=0; idx < (uint8_t) clock/c; idx++){ - // loop through field clock length - put 1/2 FC length 1's and 1/2 0's per field clock wave (to create the wave) - for (fcCnt=0; fcCnt < c; fcCnt++){ - if (fcCnt < c/2){ - dest[((*n)++)]=1; - } else { - dest[((*n)++)]=0; - } - } - } - Dbprintf("mod: %d",mod); - if (mod>0){ //for FC counts that don't add up to a full clock cycle padd with extra wave - for (idx=0; idx < mod; idx++){ - if (idx < mod/2) { - dest[((*n)++)]=1; - } else { - dest[((*n)++)]=0; - } + dest[((*n)++)]=0; + dest[((*n)++)]=0; } } } @@ -578,114 +545,6 @@ void CmdHIDsimTAG(int hi, int lo, int ledcontrol) LED_A_OFF(); } -// prepare a waveform pattern in the buffer based on the ID given then -// simulate a FSK tag until the button is pressed -// arg1 contains fcHigh and fcLow, arg2 contains invert and clock -void CmdFSKsimTAG(uint16_t arg1, uint16_t arg2, size_t size, uint8_t *BitStream) -{ - int ledcontrol=1; - int n=0, i=0; - uint8_t fcHigh = arg1 >> 8; - uint8_t fcLow = arg1 & 0xFF; - //spacer bit - uint8_t clk = arg2 & 0xFF; - uint8_t invert = (arg2 >> 8) & 1; - //fcAll(0, &n, clk); - - WDT_HIT(); - for (i=0; i> 8) & 0xFF; - uint8_t manchester = arg1 & 1; - uint8_t separator = arg2 & 1; - uint8_t invert = (arg2 >> 8) & 1; - WDT_HIT(); - for (i=0; i 64) PrintAndLog("\nWarning! Length not what is expected - Length: %d bits\n",BitLen); printEM410x(lo); return 1; } @@ -1008,12 +1007,9 @@ int CmdFSKdemodParadox(const char *Cmd) } uint32_t fc = ((hi & 0x3)<<6) | (lo>>26); uint32_t cardnum = (lo>>10)&0xFFFF; - uint32_t rawLo = bytebits_to_byte(BitStream+idx+64,32); - uint32_t rawHi = bytebits_to_byte(BitStream+idx+32,32); - uint32_t rawHi2 = bytebits_to_byte(BitStream+idx,32); - - PrintAndLog("Paradox TAG ID: %x%08x - FC: %d - Card: %d - Checksum: %02x - RAW: %08x%08x%08x", - hi>>10, (hi & 0x3)<<26 | (lo>>10), fc, cardnum, (lo>>2) & 0xFF, rawHi2, rawHi, rawLo); + + PrintAndLog("Paradox TAG ID: %x%08x - FC: %d - Card: %d - Checksum: %02x", + hi>>10, (hi & 0x3)<<26 | (lo>>10), fc, cardnum, (lo>>2) & 0xFF ); setDemodBuf(BitStream,BitLen,idx); if (g_debugMode){ PrintAndLog("DEBUG: idx: %d, len: %d, Printing Demod Buffer:", idx, BitLen); @@ -1183,16 +1179,16 @@ int CmdFSKdemodAWID(const char *Cmd) fc = bytebits_to_byte(BitStream+9, 8); cardnum = bytebits_to_byte(BitStream+17, 16); code1 = bytebits_to_byte(BitStream+8,fmtLen); - PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); + PrintAndLog("AWID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); } else { cardnum = bytebits_to_byte(BitStream+8+(fmtLen-17), 16); if (fmtLen>32){ code1 = bytebits_to_byte(BitStream+8,fmtLen-32); code2 = bytebits_to_byte(BitStream+8+(fmtLen-32),32); - PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x%08x, Raw: %x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); } else{ code1 = bytebits_to_byte(BitStream+8,fmtLen); - PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); + PrintAndLog("AWID Found - BitLength: %d -unknown BitLength- (%d) - Wiegand: %x, Raw: %x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); } } if (g_debugMode){ @@ -1303,21 +1299,21 @@ int CmdFSKdemodPyramid(const char *Cmd) fc = bytebits_to_byte(BitStream+73, 8); cardnum = bytebits_to_byte(BitStream+81, 16); code1 = bytebits_to_byte(BitStream+72,fmtLen); - PrintAndLog("Pyramid ID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLog("Pyramid ID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %x%08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi3, rawHi2, rawHi, rawLo); } else if (fmtLen==45){ fmtLen=42; //end = 10 bits not 7 like 26 bit fmt fc = bytebits_to_byte(BitStream+53, 10); cardnum = bytebits_to_byte(BitStream+63, 32); - PrintAndLog("Pyramid ID Found - BitLength: %d, FC: %d, Card: %d - Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLog("Pyramid ID Found - BitLength: %d, FC: %d, Card: %d - Raw: %x%08x%08x%08x", fmtLen, fc, cardnum, rawHi3, rawHi2, rawHi, rawLo); } else { cardnum = bytebits_to_byte(BitStream+81, 16); if (fmtLen>32){ //code1 = bytebits_to_byte(BitStream+(size-fmtLen),fmtLen-32); //code2 = bytebits_to_byte(BitStream+(size-32),32); - PrintAndLog("Pyramid ID Found - BitLength: %d -unknown BitLength- (%d), Raw: %08x%08x%08x%08x", fmtLen, cardnum, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLog("Pyramid ID Found - BitLength: %d -unknown BitLength- (%d), Raw: %x%08x%08x%08x", fmtLen, cardnum, rawHi3, rawHi2, rawHi, rawLo); } else{ //code1 = bytebits_to_byte(BitStream+(size-fmtLen),fmtLen); - PrintAndLog("Pyramid ID Found - BitLength: %d -unknown BitLength- (%d), Raw: %08x%08x%08x%08x", fmtLen, cardnum, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLog("Pyramid ID Found - BitLength: %d -unknown BitLength- (%d), Raw: %x%08x%08x%08x", fmtLen, cardnum, rawHi3, rawHi2, rawHi, rawLo); } } if (g_debugMode){ diff --git a/client/cmddata.h b/client/cmddata.h index f48da516..c1a7ecae 100644 --- a/client/cmddata.h +++ b/client/cmddata.h @@ -14,8 +14,7 @@ command_t * CmdDataCommands(); int CmdData(const char *Cmd); -void printDemodBuff(void); -void setDemodBuf(uint8_t *buff, size_t size, size_t startIdx); +void printDemodBuff(); int CmdAmp(const char *Cmd); int Cmdaskdemod(const char *Cmd); int CmdAskEM410xDemod(const char *Cmd); diff --git a/client/cmdlf.c b/client/cmdlf.c index 2215aff6..f268eaa2 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -529,7 +529,6 @@ int CmdLFSim(const char *Cmd) /* convert to bitstream if necessary */ ChkBitstream(Cmd); - //can send 512 bits at a time (1 byte sent per bit...) printf("Sending [%d bytes]", GraphTraceLen); for (i = 0; i < GraphTraceLen; i += USB_CMD_DATA_SIZE) { UsbCommand c={CMD_DOWNLOADED_SIM_SAMPLES_125K, {i, 0, 0}}; @@ -549,221 +548,6 @@ int CmdLFSim(const char *Cmd) return 0; } -int usage_lf_simfsk(void) -{ - //print help - PrintAndLog("Usage: lf simfsk [c ] [i] [H ] [L ] [d ]"); - PrintAndLog("Options: "); - PrintAndLog(" h This help"); - PrintAndLog(" c Manually set clock - can autodetect if using DemodBuffer"); - PrintAndLog(" i invert data"); - PrintAndLog(" H Manually set the larger Field Clock"); - PrintAndLog(" L Manually set the smaller Field Clock"); - //PrintAndLog(" s TBD- -to enable a gap between playback repetitions - default: no gap"); - PrintAndLog(" d Data to sim as hex - omit to sim from DemodBuffer"); - return 0; -} - -int usage_lf_simask(void) -{ - //print help - PrintAndLog("Usage: lf simask [c ] [i] [m|r] [s] [d ]"); - PrintAndLog("Options: "); - PrintAndLog(" h This help"); - PrintAndLog(" c Manually set clock - can autodetect if using DemodBuffer"); - PrintAndLog(" i invert data"); - PrintAndLog(" m sim ask/manchester"); - PrintAndLog(" r sim ask/raw"); - PrintAndLog(" s TBD- -to enable a gap between playback repetitions - default: no gap"); - PrintAndLog(" d Data to sim as hex - omit to sim from DemodBuffer"); - return 0; -} - -// by marshmellow - sim ask data given clock, fcHigh, fcLow, invert -// - allow pull data from DemodBuffer -int CmdLFfskSim(const char *Cmd) -{ - //todo - allow data from demodbuffer or parameters - //might be able to autodetect FC and clock from Graphbuffer if using demod buffer - //will need FChigh, FClow, Clock, and bitstream - uint8_t fcHigh=0, fcLow=0, clk=0; - uint8_t invert=0; - bool errors = FALSE; - char hexData[32] = {0x00}; // store entered hex data - uint8_t data[255] = {0x00}; - int dataLen = 0; - uint8_t cmdp = 0; - while(param_getchar(Cmd, cmdp) != 0x00) - { - switch(param_getchar(Cmd, cmdp)) - { - case 'h': - return usage_lf_simfsk(); - case 'i': - invert = 1; - cmdp++; - break; - case 'c': - errors |= param_getdec(Cmd,cmdp+1,&clk); - cmdp+=2; - break; - case 'H': - errors |= param_getdec(Cmd,cmdp+1,&fcHigh); - cmdp+=2; - break; - case 'L': - errors |= param_getdec(Cmd,cmdp+1,&fcLow); - cmdp+=2; - break; - //case 's': - // separator=1; - // cmdp++; - // break; - case 'd': - dataLen = param_getstr(Cmd, cmdp+1, hexData); - if (dataLen==0) { - errors=TRUE; - } else { - dataLen = hextobinarray((char *)data, hexData); - } if (dataLen==0) errors=TRUE; - if (errors) PrintAndLog ("Error getting hex data"); - cmdp+=2; - break; - default: - PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp)); - errors = TRUE; - break; - } - if(errors) break; - } - if(cmdp == 0 && DemodBufferLen == 0) - { - errors = TRUE;// No args - } - - //Validations - if(errors) - { - return usage_lf_simfsk(); - } - if (dataLen == 0){ //using DemodBuffer - if (clk==0 || fcHigh==0 || fcLow==0){ - uint8_t ans = fskClocks(&fcHigh, &fcLow, &clk, 0); - if (ans==0){ - fcHigh=10; - fcLow=8; - clk=50; - } - } - } else { - setDemodBuf(data, dataLen, 0); - } - if (clk == 0) clk = 50; - if (fcHigh == 0) fcHigh = 10; - if (fcLow == 0) fcLow = 8; - - uint16_t arg1, arg2; - arg1 = fcHigh << 8 | fcLow; - arg2 = invert << 8 | clk; - UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, DemodBufferLen}}; - if (DemodBufferLen > USB_CMD_DATA_SIZE) { - PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", DemodBufferLen, USB_CMD_DATA_SIZE); - } - memcpy(c.d.asBytes, DemodBuffer, DemodBufferLen); - SendCommand(&c); - return 0; -} - -// by marshmellow - sim ask data given clock, invert, manchester or raw, separator -// - allow pull data from DemodBuffer -int CmdLFaskSim(const char *Cmd) -{ - //todo - allow data from demodbuffer or parameters - //autodetect clock from Graphbuffer if using demod buffer - //will need clock, invert, manchester/raw as m or r, separator as s, and bitstream - uint8_t manchester = 1, separator = 0; - //char cmdp = Cmd[0], par3='m', par4=0; - uint8_t clk=0, invert=0; - bool errors = FALSE; - char hexData[32] = {0x00}; - uint8_t data[255]= {0x00}; // store entered hex data - int dataLen = 0; - uint8_t cmdp = 0; - while(param_getchar(Cmd, cmdp) != 0x00) - { - switch(param_getchar(Cmd, cmdp)) - { - case 'h': - return usage_lf_simask(); - case 'i': - invert = 1; - cmdp++; - break; - case 'c': - errors |= param_getdec(Cmd,cmdp+1,&clk); - cmdp+=2; - break; - case 'm': - manchester=1; - cmdp++; - break; - case 'r': - manchester=0; - cmdp++; - break; - case 's': - separator=1; - cmdp++; - break; - case 'd': - dataLen = param_getstr(Cmd, cmdp+1, hexData); - if (dataLen==0) { - errors=TRUE; - } else { - dataLen = hextobinarray((char *)data, hexData); - } - if (dataLen==0) errors=TRUE; - if (errors) PrintAndLog ("Error getting hex data, datalen: %d",dataLen); - cmdp+=2; - break; - default: - PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp)); - errors = TRUE; - break; - } - if(errors) break; - } - if(cmdp == 0 && DemodBufferLen == 0) - { - errors = TRUE;// No args - } - - //Validations - if(errors) - { - return usage_lf_simask(); - } - if (dataLen == 0){ //using DemodBuffer - if (clk == 0) clk = GetAskClock("0", false, false); - } else { - setDemodBuf(data, dataLen, 0); - } - if (clk == 0) clk = 64; - - uint16_t arg1, arg2; - arg1 = clk << 8 | manchester; - arg2 = invert << 8 | separator; - UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, DemodBufferLen}}; - if (DemodBufferLen > USB_CMD_DATA_SIZE) { - PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", DemodBufferLen, USB_CMD_DATA_SIZE); - } - PrintAndLog("preparing to sim ask data: %d bits", DemodBufferLen); - memcpy(c.d.asBytes, DemodBuffer, DemodBufferLen); - SendCommand(&c); - return 0; -} - - int CmdLFSimBidir(const char *Cmd) { // Set ADC to twice the carrier for a slight supersampling @@ -982,8 +766,6 @@ static command_t CommandTable[] = {"read", CmdLFRead, 0, "Read 125/134 kHz LF ID-only tag. Do 'lf read h' for help"}, {"search", CmdLFfind, 1, "[offline] ['u'] Read and Search for valid known tag (in offline mode it you can load first then search) - 'u' to search for unknown tags"}, {"sim", CmdLFSim, 0, "[GAP] -- Simulate LF tag from buffer with optional GAP (in microseconds)"}, - {"simask", CmdLFaskSim, 0, "[clock] [invert <1|0>] [manchester/raw <'m'|'r'>] [trs separator 's'] -- Simulate LF ASK tag from demodbuffer"}, - {"simfsk", CmdLFfskSim, 0, "[invert <1|0>] -- Simulate LF FSK tag from demodbuffer"}, {"simbidir", CmdLFSimBidir, 0, "Simulate LF tag (with bidirectional data transmission between reader and tag)"}, {"simman", CmdLFSimManchester, 0, " [GAP] Simulate arbitrary Manchester LF tag"}, {"snoop", CmdLFSnoop, 0, "['l'|'h'|] [trigger threshold]-- Snoop LF (l:125khz, h:134khz)"}, diff --git a/client/cmdlf.h b/client/cmdlf.h index 22f7f818..e298d659 100644 --- a/client/cmdlf.h +++ b/client/cmdlf.h @@ -19,8 +19,6 @@ int CmdIndalaDemod(const char *Cmd); int CmdIndalaClone(const char *Cmd); int CmdLFRead(const char *Cmd); int CmdLFSim(const char *Cmd); -int CmdLFaskSim(const char *Cmd); -int CmdLFfskSim(const char *Cmd); int CmdLFSimBidir(const char *Cmd); int CmdLFSimManchester(const char *Cmd); int CmdLFSnoop(const char *Cmd); diff --git a/client/graph.c b/client/graph.c index c9457ff1..11dbc4d5 100644 --- a/client/graph.c +++ b/client/graph.c @@ -18,14 +18,14 @@ int GraphBuffer[MAX_GRAPH_TRACE_LEN]; int GraphTraceLen; -/* write a manchester bit to the graph */ +/* write a bit to the graph */ void AppendGraph(int redraw, int clock, int bit) { int i; - //set first half the clock bit (all 1's or 0's for a 0 or 1 bit) + for (i = 0; i < (int)(clock / 2); ++i) GraphBuffer[GraphTraceLen++] = bit ^ 1; - //set second half of the clock bit (all 0's or 1's for a 0 or 1 bit) + for (i = (int)(clock / 2); i < clock; ++i) GraphBuffer[GraphTraceLen++] = bit; @@ -193,22 +193,6 @@ uint8_t GetFskClock(const char str[], bool printAns, bool verbose) clock = 0; if (clock != 0) return (uint8_t)clock; - - uint8_t fc1=0, fc2=0, rf1=0; - uint8_t ans = fskClocks(&fc1, &fc2, &rf1, verbose); - if (ans == 0) return 0; - if ((fc1==10 && fc2==8) || (fc1==8 && fc2==5)){ - if (printAns) PrintAndLog("Detected Field Clocks: FC/%d, FC/%d - Bit Clock: RF/%d", fc1, fc2, rf1); - return rf1; - } - if (verbose){ - PrintAndLog("DEBUG: unknown fsk field clock detected"); - PrintAndLog("Detected Field Clocks: FC/%d, FC/%d - Bit Clock: RF/%d", fc1, fc2, rf1); - } - return 0; -} -uint8_t fskClocks(uint8_t *fc1, uint8_t *fc2, uint8_t *rf1, bool verbose) -{ uint8_t BitStream[MAX_GRAPH_TRACE_LEN]={0}; size_t size = getFromGraphBuf(BitStream); if (size==0) return 0; @@ -218,13 +202,22 @@ uint8_t fskClocks(uint8_t *fc1, uint8_t *fc2, uint8_t *rf1, bool verbose) if (verbose) PrintAndLog("DEBUG: No data found"); return 0; } - *fc1 = (ans >> 8) & 0xFF; - *fc2 = ans & 0xFF; + uint8_t fc1, fc2; + fc1 = (ans >> 8) & 0xFF; + fc2 = ans & 0xFF; - *rf1 = detectFSKClk(BitStream, size, *fc1, *fc2); - if (*rf1==0) { + uint8_t rf1 = detectFSKClk(BitStream, size, fc1, fc2); + if (rf1==0) { if (verbose) PrintAndLog("DEBUG: Clock detect error"); return 0; } - return 1; + if ((fc1==10 && fc2==8) || (fc1==8 && fc2==5)){ + if (printAns) PrintAndLog("Detected Field Clocks: FC/%d, FC/%d - Bit Clock: RF/%d", fc1, fc2, rf1); + return rf1; + } + if (verbose){ + PrintAndLog("DEBUG: unknown fsk field clock detected"); + PrintAndLog("Detected Field Clocks: FC/%d, FC/%d - Bit Clock: RF/%d", fc1, fc2, rf1); + } + return 0; } diff --git a/client/graph.h b/client/graph.h index 3c6de014..e4872afc 100644 --- a/client/graph.h +++ b/client/graph.h @@ -20,7 +20,6 @@ int GetAskClock(const char str[], bool printAns, bool verbose); int GetPskClock(const char str[], bool printAns, bool verbose); uint8_t GetNrzClock(const char str[], bool printAns, bool verbose); uint8_t GetFskClock(const char str[], bool printAns, bool verbose); -uint8_t fskClocks(uint8_t *fc1, uint8_t *fc2, uint8_t *rf1, bool verbose); void setGraphBuf(uint8_t *buff, size_t size); bool HasGraphData(); diff --git a/client/hid-flasher/usb_cmd.h b/client/hid-flasher/usb_cmd.h index 53c4dffe..a7552b3e 100644 --- a/client/hid-flasher/usb_cmd.h +++ b/client/hid-flasher/usb_cmd.h @@ -71,18 +71,6 @@ typedef struct { #define CMD_INDALA_CLONE_TAG 0x0212 // for 224 bits UID #define CMD_INDALA_CLONE_TAG_L 0x0213 -#define CMD_T55XX_READ_BLOCK 0x0214 -#define CMD_T55XX_WRITE_BLOCK 0x0215 -#define CMD_T55XX_READ_TRACE 0x0216 -#define CMD_PCF7931_READ 0x0217 -#define CMD_EM4X_READ_WORD 0x0218 -#define CMD_EM4X_WRITE_WORD 0x0219 -#define CMD_IO_DEMOD_FSK 0x021A -#define CMD_IO_CLONE_TAG 0x021B -#define CMD_EM410X_DEMOD 0x021c -#define CMD_SET_LF_SAMPLING_CONFIG 0x021d -#define CMD_FSK_SIM_TAG 0x021E -#define CMD_ASK_SIM_TAG 0x021F /* CMD_SET_ADC_MUX: ext1 is 0 for lopkd, 1 for loraw, 2 for hipkd, 3 for hiraw */ diff --git a/client/lualibs/commands.lua b/client/lualibs/commands.lua index 9b47a994..a5442f2a 100644 --- a/client/lualibs/commands.lua +++ b/client/lualibs/commands.lua @@ -48,12 +48,8 @@ local _commands = { CMD_EM4X_READ_WORD = 0x0218, CMD_EM4X_WRITE_WORD = 0x0219, CMD_IO_DEMOD_FSK = 0x021A, - CMD_IO_CLONE_TAG = 0x021B, - CMD_EM410X_DEMOD = 0x021c, - CMD_SET_LF_SAMPLING_CONFIG = 0x021d, - CMD_FSK_SIM_TAG = 0x021E, - CMD_ASK_SIM_TAG = 0x021F, - + CMD_IO_CLONE_TAG = 0x021B, + CMD_EM410X_DEMOD = 0x021c, --/* CMD_SET_ADC_MUX: ext1 is 0 for lopkd, 1 for loraw, 2 for hipkd, 3 for hiraw */ --// For the 13.56 MHz tags @@ -219,4 +215,4 @@ function Command:getBytes() return bin.pack("LLLLH",cmd, arg1, arg2, arg3,data); end -return _commands +return _commands \ No newline at end of file diff --git a/common/lfdemod.c b/common/lfdemod.c index 96b187b7..47e63ef6 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -108,7 +108,6 @@ uint64_t Em410xDecode(uint8_t *BitStream, size_t *size, size_t *startIdx) errChk = 0; break; } - //set uint64 with ID from BitStream for (uint8_t ii=0; ii<4; ii++){ lo = (lo << 1LL) | (BitStream[(i*5)+ii+idx]); } diff --git a/include/usb_cmd.h b/include/usb_cmd.h index d73fac54..d9a950ae 100644 --- a/include/usb_cmd.h +++ b/include/usb_cmd.h @@ -89,11 +89,9 @@ typedef struct{ #define CMD_EM4X_WRITE_WORD 0x0219 #define CMD_IO_DEMOD_FSK 0x021A #define CMD_IO_CLONE_TAG 0x021B -#define CMD_EM410X_DEMOD 0x021c +#define CMD_EM410X_DEMOD 0x021c // Sampling configuration for LF reader/snooper #define CMD_SET_LF_SAMPLING_CONFIG 0x021d -#define CMD_FSK_SIM_TAG 0x021E -#define CMD_ASK_SIM_TAG 0x021F /* CMD_SET_ADC_MUX: ext1 is 0 for lopkd, 1 for loraw, 2 for hipkd, 3 for hiraw */