]> git.zerfleddert.de Git - proxmark3-svn/blob - client/cmdlf.c
dcc6cfae97e01209edaaf408514de4835fb2543b
[proxmark3-svn] / client / cmdlf.c
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // Low frequency commands
9 //-----------------------------------------------------------------------------
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <limits.h>
15 #include "proxmark3.h"
16 #include "cmdlf.h"
17 #include "lfdemod.h" // for psk2TOpsk1
18 #include "util.h" // for parsing cli command utils
19 #include "ui.h" // for show graph controls
20 #include "graph.h" // for graph data
21 #include "cmdparser.h" // for getting cli commands included in cmdmain.h
22 #include "cmdmain.h" // for sending cmds to device
23 #include "data.h" // for GetFromBigBuf
24 #include "cmddata.h" // for `lf search`
25 #include "cmdlfawid.h" // for awid menu
26 #include "cmdlfem4x.h" // for em4x menu
27 #include "cmdlfhid.h" // for hid menu
28 #include "cmdlfhitag.h" // for hitag menu
29 #include "cmdlfio.h" // for ioprox menu
30 #include "cmdlft55xx.h" // for t55xx menu
31 #include "cmdlfti.h" // for ti menu
32 #include "cmdlfpresco.h" // for presco menu
33 #include "cmdlfpcf7931.h"// for pcf7931 menu
34 #include "cmdlfpyramid.h"// for pyramid menu
35 #include "cmdlfviking.h" // for viking menu
36 #include "cmdlfcotag.h" // for COTAG menu
37
38 bool g_lf_threshold_set = false;
39 static int CmdHelp(const char *Cmd);
40
41
42
43 int usage_lf_cmdread(void)
44 {
45 PrintAndLog("Usage: lf cmdread d <delay period> z <zero period> o <one period> c <cmdbytes> [H] ");
46 PrintAndLog("Options: ");
47 PrintAndLog(" h This help");
48 PrintAndLog(" L Low frequency (125 KHz)");
49 PrintAndLog(" H High frequency (134 KHz)");
50 PrintAndLog(" d <delay> delay OFF period");
51 PrintAndLog(" z <zero> time period ZERO");
52 PrintAndLog(" o <one> time period ONE");
53 PrintAndLog(" c <cmd> Command bytes");
54 PrintAndLog(" ************* All periods in microseconds");
55 PrintAndLog("Examples:");
56 PrintAndLog(" lf cmdread d 80 z 100 o 200 c 11000");
57 PrintAndLog(" lf cmdread d 80 z 100 o 100 c 11000 H");
58 return 0;
59 }
60
61 /* send a command before reading */
62 int CmdLFCommandRead(const char *Cmd)
63 {
64 static char dummy[3] = {0x20,0x00,0x00};
65 UsbCommand c = {CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K};
66 bool errors = false;
67 //uint8_t divisor = 95; //125khz
68 uint8_t cmdp = 0;
69 while(param_getchar(Cmd, cmdp) != 0x00)
70 {
71 switch(param_getchar(Cmd, cmdp))
72 {
73 case 'h':
74 return usage_lf_cmdread();
75 case 'H':
76 //divisor = 88;
77 dummy[1]='h';
78 cmdp++;
79 break;
80 case 'L':
81 cmdp++;
82 break;
83 case 'c':
84 param_getstr(Cmd, cmdp+1, (char *)&c.d.asBytes);
85 cmdp+=2;
86 break;
87 case 'd':
88 c.arg[0] = param_get32ex(Cmd, cmdp+1, 0, 10);
89 cmdp+=2;
90 break;
91 case 'z':
92 c.arg[1] = param_get32ex(Cmd, cmdp+1, 0, 10);
93 cmdp+=2;
94 break;
95 case 'o':
96 c.arg[2] = param_get32ex(Cmd, cmdp+1, 0, 10);
97 cmdp+=2;
98 break;
99 default:
100 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));
101 errors = 1;
102 break;
103 }
104 if(errors) break;
105 }
106 // No args
107 if(cmdp == 0) errors = 1;
108
109 //Validations
110 if(errors) return usage_lf_cmdread();
111
112 // in case they specified 'H'
113 strcpy((char *)&c.d.asBytes + strlen((char *)c.d.asBytes), dummy);
114
115 clearCommandBuffer();
116 SendCommand(&c);
117 return 0;
118 }
119
120 int CmdFlexdemod(const char *Cmd)
121 {
122 int i;
123 for (i = 0; i < GraphTraceLen; ++i) {
124 if (GraphBuffer[i] < 0) {
125 GraphBuffer[i] = -1;
126 } else {
127 GraphBuffer[i] = 1;
128 }
129 }
130
131 #define LONG_WAIT 100
132 int start;
133 for (start = 0; start < GraphTraceLen - LONG_WAIT; start++) {
134 int first = GraphBuffer[start];
135 for (i = start; i < start + LONG_WAIT; i++) {
136 if (GraphBuffer[i] != first) {
137 break;
138 }
139 }
140 if (i == (start + LONG_WAIT)) {
141 break;
142 }
143 }
144 if (start == GraphTraceLen - LONG_WAIT) {
145 PrintAndLog("nothing to wait for");
146 return 0;
147 }
148
149 GraphBuffer[start] = 2;
150 GraphBuffer[start+1] = -2;
151 uint8_t bits[64] = {0x00};
152
153 int bit, sum;
154 i = start;
155 for (bit = 0; bit < 64; bit++) {
156 sum = 0;
157 for (int j = 0; j < 16; j++) {
158 sum += GraphBuffer[i++];
159 }
160
161 bits[bit] = (sum > 0) ? 1 : 0;
162
163 PrintAndLog("bit %d sum %d", bit, sum);
164 }
165
166 for (bit = 0; bit < 64; bit++) {
167 int j;
168 int sum = 0;
169 for (j = 0; j < 16; j++) {
170 sum += GraphBuffer[i++];
171 }
172 if (sum > 0 && bits[bit] != 1) {
173 PrintAndLog("oops1 at %d", bit);
174 }
175 if (sum < 0 && bits[bit] != 0) {
176 PrintAndLog("oops2 at %d", bit);
177 }
178 }
179
180 // HACK writing back to graphbuffer.
181 GraphTraceLen = 32*64;
182 i = 0;
183 int phase = 0;
184 for (bit = 0; bit < 64; bit++) {
185
186 phase = (bits[bit] == 0) ? 0 : 1;
187
188 int j;
189 for (j = 0; j < 32; j++) {
190 GraphBuffer[i++] = phase;
191 phase = !phase;
192 }
193 }
194
195 RepaintGraphWindow();
196 return 0;
197 }
198
199 int CmdIndalaDemod(const char *Cmd)
200 {
201 // Usage: recover 64bit UID by default, specify "224" as arg to recover a 224bit UID
202
203 int state = -1;
204 int count = 0;
205 int i, j;
206
207 // worst case with GraphTraceLen=64000 is < 4096
208 // under normal conditions it's < 2048
209
210 uint8_t rawbits[4096];
211 int rawbit = 0;
212 int worst = 0, worstPos = 0;
213 // PrintAndLog("Expecting a bit less than %d raw bits", GraphTraceLen / 32);
214
215 // loop through raw signal - since we know it is psk1 rf/32 fc/2 skip every other value (+=2)
216 for (i = 0; i < GraphTraceLen-1; i += 2) {
217 count += 1;
218 if ((GraphBuffer[i] > GraphBuffer[i + 1]) && (state != 1)) {
219 // appears redundant - marshmellow
220 if (state == 0) {
221 for (j = 0; j < count - 8; j += 16) {
222 rawbits[rawbit++] = 0;
223 }
224 if ((abs(count - j)) > worst) {
225 worst = abs(count - j);
226 worstPos = i;
227 }
228 }
229 state = 1;
230 count = 0;
231 } else if ((GraphBuffer[i] < GraphBuffer[i + 1]) && (state != 0)) {
232 //appears redundant
233 if (state == 1) {
234 for (j = 0; j < count - 8; j += 16) {
235 rawbits[rawbit++] = 1;
236 }
237 if ((abs(count - j)) > worst) {
238 worst = abs(count - j);
239 worstPos = i;
240 }
241 }
242 state = 0;
243 count = 0;
244 }
245 }
246
247 if (rawbit>0){
248 PrintAndLog("Recovered %d raw bits, expected: %d", rawbit, GraphTraceLen/32);
249 PrintAndLog("worst metric (0=best..7=worst): %d at pos %d", worst, worstPos);
250 } else {
251 return 0;
252 }
253
254 // Finding the start of a UID
255 int uidlen, long_wait;
256 if (strcmp(Cmd, "224") == 0) {
257 uidlen = 224;
258 long_wait = 30;
259 } else {
260 uidlen = 64;
261 long_wait = 29;
262 }
263
264 int start;
265 int first = 0;
266 for (start = 0; start <= rawbit - uidlen; start++) {
267 first = rawbits[start];
268 for (i = start; i < start + long_wait; i++) {
269 if (rawbits[i] != first) {
270 break;
271 }
272 }
273 if (i == (start + long_wait)) {
274 break;
275 }
276 }
277
278 if (start == rawbit - uidlen + 1) {
279 PrintAndLog("nothing to wait for");
280 return 0;
281 }
282
283 // Inverting signal if needed
284 if (first == 1) {
285 for (i = start; i < rawbit; i++) {
286 rawbits[i] = !rawbits[i];
287 }
288 }
289
290 // Dumping UID
291 uint8_t bits[224] = {0x00};
292 char showbits[225] = {0x00};
293 int bit;
294 i = start;
295 int times = 0;
296
297 if (uidlen > rawbit) {
298 PrintAndLog("Warning: not enough raw bits to get a full UID");
299 for (bit = 0; bit < rawbit; bit++) {
300 bits[bit] = rawbits[i++];
301 // As we cannot know the parity, let's use "." and "/"
302 showbits[bit] = '.' + bits[bit];
303 }
304 showbits[bit+1]='\0';
305 PrintAndLog("Partial UID=%s", showbits);
306 return 0;
307 } else {
308 for (bit = 0; bit < uidlen; bit++) {
309 bits[bit] = rawbits[i++];
310 showbits[bit] = '0' + bits[bit];
311 }
312 times = 1;
313 }
314
315 //convert UID to HEX
316 uint32_t uid1, uid2, uid3, uid4, uid5, uid6, uid7;
317 int idx;
318 uid1 = uid2 = 0;
319
320 if (uidlen==64){
321 for( idx=0; idx<64; idx++) {
322 if (showbits[idx] == '0') {
323 uid1=(uid1<<1)|(uid2>>31);
324 uid2=(uid2<<1)|0;
325 } else {
326 uid1=(uid1<<1)|(uid2>>31);
327 uid2=(uid2<<1)|1;
328 }
329 }
330 PrintAndLog("UID=%s (%x%08x)", showbits, uid1, uid2);
331 }
332 else {
333 uid3 = uid4 = uid5 = uid6 = uid7 = 0;
334
335 for( idx=0; idx<224; idx++) {
336 uid1=(uid1<<1)|(uid2>>31);
337 uid2=(uid2<<1)|(uid3>>31);
338 uid3=(uid3<<1)|(uid4>>31);
339 uid4=(uid4<<1)|(uid5>>31);
340 uid5=(uid5<<1)|(uid6>>31);
341 uid6=(uid6<<1)|(uid7>>31);
342
343 if (showbits[idx] == '0')
344 uid7 = (uid7<<1) | 0;
345 else
346 uid7 = (uid7<<1) | 1;
347 }
348 PrintAndLog("UID=%s (%x%08x%08x%08x%08x%08x%08x)", showbits, uid1, uid2, uid3, uid4, uid5, uid6, uid7);
349 }
350
351 // Checking UID against next occurrences
352 int failed = 0;
353 for (; i + uidlen <= rawbit;) {
354 failed = 0;
355 for (bit = 0; bit < uidlen; bit++) {
356 if (bits[bit] != rawbits[i++]) {
357 failed = 1;
358 break;
359 }
360 }
361 if (failed == 1) {
362 break;
363 }
364 times += 1;
365 }
366
367 PrintAndLog("Occurrences: %d (expected %d)", times, (rawbit - start) / uidlen);
368
369 // Remodulating for tag cloning
370 // HACK: 2015-01-04 this will have an impact on our new way of seening lf commands (demod)
371 // since this changes graphbuffer data.
372 GraphTraceLen = 32*uidlen;
373 i = 0;
374 int phase = 0;
375 for (bit = 0; bit < uidlen; bit++) {
376 if (bits[bit] == 0) {
377 phase = 0;
378 } else {
379 phase = 1;
380 }
381 int j;
382 for (j = 0; j < 32; j++) {
383 GraphBuffer[i++] = phase;
384 phase = !phase;
385 }
386 }
387
388 RepaintGraphWindow();
389 return 1;
390 }
391
392 int CmdIndalaClone(const char *Cmd)
393 {
394 UsbCommand c;
395 unsigned int uid1, uid2, uid3, uid4, uid5, uid6, uid7;
396
397 uid1 = uid2 = uid3 = uid4 = uid5 = uid6 = uid7 = 0;
398 int n = 0, i = 0;
399
400 if (strchr(Cmd,'l') != 0) {
401 while (sscanf(&Cmd[i++], "%1x", &n ) == 1) {
402 uid1 = (uid1 << 4) | (uid2 >> 28);
403 uid2 = (uid2 << 4) | (uid3 >> 28);
404 uid3 = (uid3 << 4) | (uid4 >> 28);
405 uid4 = (uid4 << 4) | (uid5 >> 28);
406 uid5 = (uid5 << 4) | (uid6 >> 28);
407 uid6 = (uid6 << 4) | (uid7 >> 28);
408 uid7 = (uid7 << 4) | (n & 0xf);
409 }
410 PrintAndLog("Cloning 224bit tag with UID %x%08x%08x%08x%08x%08x%08x", uid1, uid2, uid3, uid4, uid5, uid6, uid7);
411 c.cmd = CMD_INDALA_CLONE_TAG_L;
412 c.d.asDwords[0] = uid1;
413 c.d.asDwords[1] = uid2;
414 c.d.asDwords[2] = uid3;
415 c.d.asDwords[3] = uid4;
416 c.d.asDwords[4] = uid5;
417 c.d.asDwords[5] = uid6;
418 c.d.asDwords[6] = uid7;
419 } else {
420 while (sscanf(&Cmd[i++], "%1x", &n ) == 1) {
421 uid1 = (uid1 << 4) | (uid2 >> 28);
422 uid2 = (uid2 << 4) | (n & 0xf);
423 }
424 PrintAndLog("Cloning 64bit tag with UID %x%08x", uid1, uid2);
425 c.cmd = CMD_INDALA_CLONE_TAG;
426 c.arg[0] = uid1;
427 c.arg[1] = uid2;
428 }
429
430 clearCommandBuffer();
431 SendCommand(&c);
432 return 0;
433 }
434
435 int usage_lf_read(void)
436 {
437 PrintAndLog("Usage: lf read");
438 PrintAndLog("Options: ");
439 PrintAndLog(" h This help");
440 PrintAndLog(" s silent run no printout");
441 PrintAndLog("This function takes no arguments. ");
442 PrintAndLog("Use 'lf config' to set parameters.");
443 return 0;
444 }
445 int usage_lf_snoop(void)
446 {
447 PrintAndLog("Usage: lf snoop");
448 PrintAndLog("Options: ");
449 PrintAndLog(" h This help");
450 PrintAndLog("This function takes no arguments. ");
451 PrintAndLog("Use 'lf config' to set parameters.");
452 return 0;
453 }
454
455 int usage_lf_config(void)
456 {
457 PrintAndLog("Usage: lf config [H|<divisor>] [b <bps>] [d <decim>] [a 0|1]");
458 PrintAndLog("Options: ");
459 PrintAndLog(" h This help");
460 PrintAndLog(" L Low frequency (125 KHz)");
461 PrintAndLog(" H High frequency (134 KHz)");
462 PrintAndLog(" q <divisor> Manually set divisor. 88-> 134KHz, 95-> 125 Hz");
463 PrintAndLog(" b <bps> Sets resolution of bits per sample. Default (max): 8");
464 PrintAndLog(" d <decim> Sets decimation. A value of N saves only 1 in N samples. Default: 1");
465 PrintAndLog(" a [0|1] Averaging - if set, will average the stored sample value when decimating. Default: 1");
466 PrintAndLog(" t <threshold> Sets trigger threshold. 0 means no threshold (range: 0-128)");
467 PrintAndLog("Examples:");
468 PrintAndLog(" lf config b 8 L");
469 PrintAndLog(" Samples at 125KHz, 8bps.");
470 PrintAndLog(" lf config H b 4 d 3");
471 PrintAndLog(" Samples at 134KHz, averages three samples into one, stored with ");
472 PrintAndLog(" a resolution of 4 bits per sample.");
473 PrintAndLog(" lf read");
474 PrintAndLog(" Performs a read (active field)");
475 PrintAndLog(" lf snoop");
476 PrintAndLog(" Performs a snoop (no active field)");
477 return 0;
478 }
479
480 int CmdLFSetConfig(const char *Cmd)
481 {
482
483 uint8_t divisor = 0;//Frequency divisor
484 uint8_t bps = 0; // Bits per sample
485 uint8_t decimation = 0; //How many to keep
486 bool averaging = 1; // Defaults to true
487 bool errors = false;
488 int trigger_threshold =-1;//Means no change
489 uint8_t unsigned_trigg = 0;
490
491 uint8_t cmdp =0;
492 while(param_getchar(Cmd, cmdp) != 0x00)
493 {
494 switch(param_getchar(Cmd, cmdp))
495 {
496 case 'h':
497 return usage_lf_config();
498 case 'H':
499 divisor = 88;
500 cmdp++;
501 break;
502 case 'L':
503 divisor = 95;
504 cmdp++;
505 break;
506 case 'q':
507 errors |= param_getdec(Cmd,cmdp+1,&divisor);
508 cmdp+=2;
509 break;
510 case 't':
511 errors |= param_getdec(Cmd,cmdp+1,&unsigned_trigg);
512 cmdp+=2;
513 if(!errors) {
514 trigger_threshold = unsigned_trigg;
515 if (trigger_threshold > 0) g_lf_threshold_set = true;
516 }
517 break;
518 case 'b':
519 errors |= param_getdec(Cmd,cmdp+1,&bps);
520 cmdp+=2;
521 break;
522 case 'd':
523 errors |= param_getdec(Cmd,cmdp+1,&decimation);
524 cmdp+=2;
525 break;
526 case 'a':
527 averaging = param_getchar(Cmd,cmdp+1) == '1';
528 cmdp+=2;
529 break;
530 default:
531 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));
532 errors = 1;
533 break;
534 }
535 if(errors) break;
536 }
537 if(cmdp == 0)
538 {
539 errors = 1;// No args
540 }
541
542 //Validations
543 if(errors)
544 {
545 return usage_lf_config();
546 }
547 //Bps is limited to 8, so fits in lower half of arg1
548 if(bps >> 4) bps = 8;
549
550 sample_config config = {
551 decimation,bps,averaging,divisor,trigger_threshold
552 };
553 //Averaging is a flag on high-bit of arg[1]
554 UsbCommand c = {CMD_SET_LF_SAMPLING_CONFIG};
555 memcpy(c.d.asBytes,&config,sizeof(sample_config));
556 clearCommandBuffer();
557 SendCommand(&c);
558 return 0;
559 }
560
561 int CmdLFRead(const char *Cmd)
562 {
563 if (offline) return 0;
564 uint8_t cmdp = 0;
565 bool arg1 = false;
566 if (param_getchar(Cmd, cmdp) == 'h')
567 {
568 return usage_lf_read();
569 }
570 if (param_getchar(Cmd, cmdp) == 's') arg1 = true; //suppress print
571 //And ship it to device
572 UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_125K, {arg1,0,0}};
573 clearCommandBuffer();
574 SendCommand(&c);
575 if (g_lf_threshold_set) {
576 WaitForResponse(CMD_ACK,NULL);
577 } else {
578 if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) {
579 PrintAndLog("command execution time out");
580 return 1;
581 }
582 }
583 return 0;
584 }
585
586 int CmdLFSnoop(const char *Cmd)
587 {
588 uint8_t cmdp =0;
589 if(param_getchar(Cmd, cmdp) == 'h')
590 {
591 return usage_lf_snoop();
592 }
593
594 UsbCommand c = {CMD_LF_SNOOP_RAW_ADC_SAMPLES};
595 clearCommandBuffer();
596 SendCommand(&c);
597 WaitForResponse(CMD_ACK,NULL);
598 return 0;
599 }
600
601 static void ChkBitstream(const char *str)
602 {
603 int i;
604
605 /* convert to bitstream if necessary */
606 for (i = 0; i < (int)(GraphTraceLen / 2); i++){
607 if (GraphBuffer[i] > 1 || GraphBuffer[i] < 0) {
608 CmdGetBitStream("");
609 break;
610 }
611 }
612 }
613 //Attempt to simulate any wave in buffer (one bit per output sample)
614 // converts GraphBuffer to bitstream (based on zero crossings) if needed.
615 int CmdLFSim(const char *Cmd)
616 {
617 int i,j;
618 static int gap;
619
620 sscanf(Cmd, "%i", &gap);
621
622 // convert to bitstream if necessary
623
624 ChkBitstream(Cmd);
625
626 //can send only 512 bits at a time (1 byte sent per bit...)
627 printf("Sending [%d bytes]", GraphTraceLen);
628 for (i = 0; i < GraphTraceLen; i += USB_CMD_DATA_SIZE) {
629 UsbCommand c={CMD_DOWNLOADED_SIM_SAMPLES_125K, {i, 0, 0}};
630
631 for (j = 0; j < USB_CMD_DATA_SIZE; j++) {
632 c.d.asBytes[j] = GraphBuffer[i+j];
633 }
634 SendCommand(&c);
635 WaitForResponse(CMD_ACK,NULL);
636 printf(".");
637 }
638
639 printf("\n");
640 PrintAndLog("Starting to simulate");
641 UsbCommand c = {CMD_SIMULATE_TAG_125K, {GraphTraceLen, gap, 0}};
642 clearCommandBuffer();
643 SendCommand(&c);
644 return 0;
645 }
646
647 int usage_lf_simfsk(void)
648 {
649 //print help
650 PrintAndLog("Usage: lf simfsk [c <clock>] [i] [H <fcHigh>] [L <fcLow>] [d <hexdata>]");
651 PrintAndLog("Options: ");
652 PrintAndLog(" h This help");
653 PrintAndLog(" c <clock> Manually set clock - can autodetect if using DemodBuffer");
654 PrintAndLog(" i invert data");
655 PrintAndLog(" H <fcHigh> Manually set the larger Field Clock");
656 PrintAndLog(" L <fcLow> Manually set the smaller Field Clock");
657 //PrintAndLog(" s TBD- -to enable a gap between playback repetitions - default: no gap");
658 PrintAndLog(" d <hexdata> Data to sim as hex - omit to sim from DemodBuffer");
659 PrintAndLog("\n NOTE: if you set one clock manually set them all manually");
660 return 0;
661 }
662
663 int usage_lf_simask(void)
664 {
665 //print help
666 PrintAndLog("Usage: lf simask [c <clock>] [i] [b|m|r] [s] [d <raw hex to sim>]");
667 PrintAndLog("Options: ");
668 PrintAndLog(" h This help");
669 PrintAndLog(" c <clock> Manually set clock - can autodetect if using DemodBuffer");
670 PrintAndLog(" i invert data");
671 PrintAndLog(" b sim ask/biphase");
672 PrintAndLog(" m sim ask/manchester - Default");
673 PrintAndLog(" r sim ask/raw");
674 PrintAndLog(" s add t55xx Sequence Terminator gap - default: no gaps (only manchester)");
675 PrintAndLog(" d <hexdata> Data to sim as hex - omit to sim from DemodBuffer");
676 return 0;
677 }
678
679 int usage_lf_simpsk(void)
680 {
681 //print help
682 PrintAndLog("Usage: lf simpsk [1|2|3] [c <clock>] [i] [r <carrier>] [d <raw hex to sim>]");
683 PrintAndLog("Options: ");
684 PrintAndLog(" h This help");
685 PrintAndLog(" c <clock> Manually set clock - can autodetect if using DemodBuffer");
686 PrintAndLog(" i invert data");
687 PrintAndLog(" 1 set PSK1 (default)");
688 PrintAndLog(" 2 set PSK2");
689 PrintAndLog(" 3 set PSK3");
690 PrintAndLog(" r <carrier> 2|4|8 are valid carriers: default = 2");
691 PrintAndLog(" d <hexdata> Data to sim as hex - omit to sim from DemodBuffer");
692 return 0;
693 }
694
695 // by marshmellow - sim fsk data given clock, fcHigh, fcLow, invert
696 // - allow pull data from DemodBuffer
697 int CmdLFfskSim(const char *Cmd)
698 {
699 //might be able to autodetect FCs and clock from Graphbuffer if using demod buffer
700 // otherwise will need FChigh, FClow, Clock, and bitstream
701 uint8_t fcHigh=0, fcLow=0, clk=0;
702 uint8_t invert=0;
703 bool errors = false;
704 char hexData[32] = {0x00}; // store entered hex data
705 uint8_t data[255] = {0x00};
706 int dataLen = 0;
707 uint8_t cmdp = 0;
708 while(param_getchar(Cmd, cmdp) != 0x00)
709 {
710 switch(param_getchar(Cmd, cmdp))
711 {
712 case 'h':
713 return usage_lf_simfsk();
714 case 'i':
715 invert = 1;
716 cmdp++;
717 break;
718 case 'c':
719 errors |= param_getdec(Cmd,cmdp+1,&clk);
720 cmdp+=2;
721 break;
722 case 'H':
723 errors |= param_getdec(Cmd,cmdp+1,&fcHigh);
724 cmdp+=2;
725 break;
726 case 'L':
727 errors |= param_getdec(Cmd,cmdp+1,&fcLow);
728 cmdp+=2;
729 break;
730 //case 's':
731 // separator=1;
732 // cmdp++;
733 // break;
734 case 'd':
735 dataLen = param_getstr(Cmd, cmdp+1, hexData);
736 if (dataLen==0) {
737 errors=true;
738 } else {
739 dataLen = hextobinarray((char *)data, hexData);
740 }
741 if (dataLen==0) errors=true;
742 if (errors) PrintAndLog ("Error getting hex data");
743 cmdp+=2;
744 break;
745 default:
746 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));
747 errors = true;
748 break;
749 }
750 if(errors) break;
751 }
752 if(cmdp == 0 && DemodBufferLen == 0)
753 {
754 errors = true;// No args
755 }
756
757 //Validations
758 if(errors)
759 {
760 return usage_lf_simfsk();
761 }
762
763 if (dataLen == 0){ //using DemodBuffer
764 if (clk==0 || fcHigh==0 || fcLow==0){ //manual settings must set them all
765 uint8_t ans = fskClocks(&fcHigh, &fcLow, &clk, 0);
766 if (ans==0){
767 if (!fcHigh) fcHigh=10;
768 if (!fcLow) fcLow=8;
769 if (!clk) clk=50;
770 }
771 }
772 } else {
773 setDemodBuf(data, dataLen, 0);
774 }
775
776 //default if not found
777 if (clk == 0) clk = 50;
778 if (fcHigh == 0) fcHigh = 10;
779 if (fcLow == 0) fcLow = 8;
780
781 uint16_t arg1, arg2;
782 arg1 = fcHigh << 8 | fcLow;
783 arg2 = invert << 8 | clk;
784 size_t size = DemodBufferLen;
785 if (size > USB_CMD_DATA_SIZE) {
786 PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", size, USB_CMD_DATA_SIZE);
787 size = USB_CMD_DATA_SIZE;
788 }
789 UsbCommand c = {CMD_FSK_SIM_TAG, {arg1, arg2, size}};
790
791 memcpy(c.d.asBytes, DemodBuffer, size);
792 clearCommandBuffer();
793 SendCommand(&c);
794 return 0;
795 }
796
797 // by marshmellow - sim ask data given clock, invert, manchester or raw, separator
798 // - allow pull data from DemodBuffer
799 int CmdLFaskSim(const char *Cmd)
800 {
801 //autodetect clock from Graphbuffer if using demod buffer
802 // needs clock, invert, manchester/raw as m or r, separator as s, and bitstream
803 uint8_t encoding = 1, separator = 0;
804 uint8_t clk=0, invert=0;
805 bool errors = false;
806 char hexData[32] = {0x00};
807 uint8_t data[255]= {0x00}; // store entered hex data
808 int dataLen = 0;
809 uint8_t cmdp = 0;
810 while(param_getchar(Cmd, cmdp) != 0x00)
811 {
812 switch(param_getchar(Cmd, cmdp))
813 {
814 case 'h':
815 return usage_lf_simask();
816 case 'i':
817 invert = 1;
818 cmdp++;
819 break;
820 case 'c':
821 errors |= param_getdec(Cmd,cmdp+1,&clk);
822 cmdp+=2;
823 break;
824 case 'b':
825 encoding=2; //biphase
826 cmdp++;
827 break;
828 case 'm':
829 encoding=1;
830 cmdp++;
831 break;
832 case 'r':
833 encoding=0;
834 cmdp++;
835 break;
836 case 's':
837 separator=1;
838 cmdp++;
839 break;
840 case 'd':
841 dataLen = param_getstr(Cmd, cmdp+1, hexData);
842 if (dataLen==0) {
843 errors=true;
844 } else {
845 dataLen = hextobinarray((char *)data, hexData);
846 }
847 if (dataLen==0) errors=true;
848 if (errors) PrintAndLog ("Error getting hex data, datalen: %d",dataLen);
849 cmdp+=2;
850 break;
851 default:
852 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));
853 errors = true;
854 break;
855 }
856 if(errors) break;
857 }
858 if(cmdp == 0 && DemodBufferLen == 0)
859 {
860 errors = true;// No args
861 }
862
863 //Validations
864 if(errors)
865 {
866 return usage_lf_simask();
867 }
868 if (dataLen == 0){ //using DemodBuffer
869 if (clk == 0) clk = GetAskClock("0", false, false);
870 } else {
871 setDemodBuf(data, dataLen, 0);
872 }
873 if (clk == 0) clk = 64;
874 if (encoding == 0) clk = clk/2; //askraw needs to double the clock speed
875 uint16_t arg1, arg2;
876 size_t size=DemodBufferLen;
877 arg1 = clk << 8 | encoding;
878 arg2 = invert << 8 | separator;
879 if (size > USB_CMD_DATA_SIZE) {
880 PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", size, USB_CMD_DATA_SIZE);
881 size = USB_CMD_DATA_SIZE;
882 }
883 UsbCommand c = {CMD_ASK_SIM_TAG, {arg1, arg2, size}};
884 PrintAndLog("preparing to sim ask data: %d bits", size);
885 memcpy(c.d.asBytes, DemodBuffer, size);
886 clearCommandBuffer();
887 SendCommand(&c);
888 return 0;
889 }
890
891 // by marshmellow - sim psk data given carrier, clock, invert
892 // - allow pull data from DemodBuffer or parameters
893 int CmdLFpskSim(const char *Cmd)
894 {
895 //might be able to autodetect FC and clock from Graphbuffer if using demod buffer
896 //will need carrier, Clock, and bitstream
897 uint8_t carrier=0, clk=0;
898 uint8_t invert=0;
899 bool errors = false;
900 char hexData[32] = {0x00}; // store entered hex data
901 uint8_t data[255] = {0x00};
902 int dataLen = 0;
903 uint8_t cmdp = 0;
904 uint8_t pskType = 1;
905 while(param_getchar(Cmd, cmdp) != 0x00)
906 {
907 switch(param_getchar(Cmd, cmdp))
908 {
909 case 'h':
910 return usage_lf_simpsk();
911 case 'i':
912 invert = 1;
913 cmdp++;
914 break;
915 case 'c':
916 errors |= param_getdec(Cmd,cmdp+1,&clk);
917 cmdp+=2;
918 break;
919 case 'r':
920 errors |= param_getdec(Cmd,cmdp+1,&carrier);
921 cmdp+=2;
922 break;
923 case '1':
924 pskType=1;
925 cmdp++;
926 break;
927 case '2':
928 pskType=2;
929 cmdp++;
930 break;
931 case '3':
932 pskType=3;
933 cmdp++;
934 break;
935 case 'd':
936 dataLen = param_getstr(Cmd, cmdp+1, hexData);
937 if (dataLen==0) {
938 errors=true;
939 } else {
940 dataLen = hextobinarray((char *)data, hexData);
941 }
942 if (dataLen==0) errors=true;
943 if (errors) PrintAndLog ("Error getting hex data");
944 cmdp+=2;
945 break;
946 default:
947 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));
948 errors = true;
949 break;
950 }
951 if (errors) break;
952 }
953 if (cmdp == 0 && DemodBufferLen == 0)
954 {
955 errors = true;// No args
956 }
957
958 //Validations
959 if (errors)
960 {
961 return usage_lf_simpsk();
962 }
963 if (dataLen == 0){ //using DemodBuffer
964 PrintAndLog("Getting Clocks");
965 if (clk==0) clk = GetPskClock("", false, false);
966 PrintAndLog("clk: %d",clk);
967 if (!carrier) carrier = GetPskCarrier("", false, false);
968 PrintAndLog("carrier: %d", carrier);
969 } else {
970 setDemodBuf(data, dataLen, 0);
971 }
972
973 if (clk <= 0) clk = 32;
974 if (carrier == 0) carrier = 2;
975 if (pskType != 1){
976 if (pskType == 2){
977 //need to convert psk2 to psk1 data before sim
978 psk2TOpsk1(DemodBuffer, DemodBufferLen);
979 } else {
980 PrintAndLog("Sorry, PSK3 not yet available");
981 }
982 }
983 uint16_t arg1, arg2;
984 arg1 = clk << 8 | carrier;
985 arg2 = invert;
986 size_t size=DemodBufferLen;
987 if (size > USB_CMD_DATA_SIZE) {
988 PrintAndLog("DemodBuffer too long for current implementation - length: %d - max: %d", size, USB_CMD_DATA_SIZE);
989 size=USB_CMD_DATA_SIZE;
990 }
991 UsbCommand c = {CMD_PSK_SIM_TAG, {arg1, arg2, size}};
992 PrintAndLog("DEBUG: Sending DemodBuffer Length: %d", size);
993 memcpy(c.d.asBytes, DemodBuffer, size);
994 clearCommandBuffer();
995 SendCommand(&c);
996
997 return 0;
998 }
999
1000 int CmdLFSimBidir(const char *Cmd)
1001 {
1002 // Set ADC to twice the carrier for a slight supersampling
1003 // HACK: not implemented in ARMSRC.
1004 PrintAndLog("Not implemented yet.");
1005 UsbCommand c = {CMD_LF_SIMULATE_BIDIR, {47, 384, 0}};
1006 SendCommand(&c);
1007 return 0;
1008 }
1009
1010 int CmdVchDemod(const char *Cmd)
1011 {
1012 // Is this the entire sync pattern, or does this also include some
1013 // data bits that happen to be the same everywhere? That would be
1014 // lovely to know.
1015 static const int SyncPattern[] = {
1016 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1017 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1018 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1019 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1020 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1021 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1022 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1023 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1024 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1025 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
1026 };
1027
1028 // So first, we correlate for the sync pattern, and mark that.
1029 int bestCorrel = 0, bestPos = 0;
1030 int i;
1031 // It does us no good to find the sync pattern, with fewer than
1032 // 2048 samples after it...
1033 for (i = 0; i < (GraphTraceLen-2048); i++) {
1034 int sum = 0;
1035 int j;
1036 for (j = 0; j < arraylen(SyncPattern); j++) {
1037 sum += GraphBuffer[i+j]*SyncPattern[j];
1038 }
1039 if (sum > bestCorrel) {
1040 bestCorrel = sum;
1041 bestPos = i;
1042 }
1043 }
1044 PrintAndLog("best sync at %d [metric %d]", bestPos, bestCorrel);
1045
1046 char bits[257];
1047 bits[256] = '\0';
1048
1049 int worst = INT_MAX;
1050 int worstPos = 0;
1051
1052 for (i = 0; i < 2048; i += 8) {
1053 int sum = 0;
1054 int j;
1055 for (j = 0; j < 8; j++) {
1056 sum += GraphBuffer[bestPos+i+j];
1057 }
1058 if (sum < 0) {
1059 bits[i/8] = '.';
1060 } else {
1061 bits[i/8] = '1';
1062 }
1063 if(abs(sum) < worst) {
1064 worst = abs(sum);
1065 worstPos = i;
1066 }
1067 }
1068 PrintAndLog("bits:");
1069 PrintAndLog("%s", bits);
1070 PrintAndLog("worst metric: %d at pos %d", worst, worstPos);
1071
1072 if (strcmp(Cmd, "clone")==0) {
1073 GraphTraceLen = 0;
1074 char *s;
1075 for(s = bits; *s; s++) {
1076 int j;
1077 for(j = 0; j < 16; j++) {
1078 GraphBuffer[GraphTraceLen++] = (*s == '1') ? 1 : 0;
1079 }
1080 }
1081 RepaintGraphWindow();
1082 }
1083 return 0;
1084 }
1085
1086
1087 //by marshmellow
1088 int CheckChipType(char cmdp) {
1089 uint32_t wordData = 0;
1090
1091 //check for em4x05/em4x69 chips first
1092 save_restoreGB(1);
1093 if ((!offline && (cmdp != '1')) && EM4x05Block0Test(&wordData)) {
1094 PrintAndLog("\nValid EM4x05/EM4x69 Chip Found\nTry lf em 4x05... commands\n");
1095 save_restoreGB(0);
1096 return 1;
1097 }
1098
1099 //TODO check for t55xx chip...
1100
1101 save_restoreGB(0);
1102 return 1;
1103 }
1104
1105 //by marshmellow
1106 int CmdLFfind(const char *Cmd)
1107 {
1108 uint32_t wordData = 0;
1109 int ans=0;
1110 size_t minLength = 1000;
1111 char cmdp = param_getchar(Cmd, 0);
1112 char testRaw = param_getchar(Cmd, 1);
1113 if (strlen(Cmd) > 3 || cmdp == 'h' || cmdp == 'H') {
1114 PrintAndLog("Usage: lf search <0|1> [u]");
1115 PrintAndLog(" <use data from Graphbuffer> , if not set, try reading data from tag.");
1116 PrintAndLog(" [Search for Unknown tags] , if not set, reads only known tags.");
1117 PrintAndLog("");
1118 PrintAndLog(" sample: lf search = try reading data from tag & search for known tags");
1119 PrintAndLog(" : lf search 1 = use data from GraphBuffer & search for known tags");
1120 PrintAndLog(" : lf search u = try reading data from tag & search for known and unknown tags");
1121 PrintAndLog(" : lf search 1 u = use data from GraphBuffer & search for known and unknown tags");
1122
1123 return 0;
1124 }
1125
1126 if (!offline && (cmdp != '1')){
1127 CmdLFRead("s");
1128 getSamples("30000",false);
1129 } else if (GraphTraceLen < minLength) {
1130 PrintAndLog("Data in Graphbuffer was too small.");
1131 return 0;
1132 }
1133 if (cmdp == 'u' || cmdp == 'U') testRaw = 'u';
1134
1135 PrintAndLog("NOTE: some demods output possible binary\n if it finds something that looks like a tag");
1136 PrintAndLog("False Positives ARE possible\n");
1137 PrintAndLog("\nChecking for known tags:\n");
1138
1139 size_t testLen = minLength;
1140 // only run if graphbuffer is just noise as it should be for hitag/cotag
1141 if (graphJustNoise(GraphBuffer, testLen)) {
1142 // only run these tests if we are in online mode
1143 if (!offline && (cmdp != '1')) {
1144 // test for em4x05 in reader talk first mode.
1145 if (EM4x05Block0Test(&wordData)) {
1146 PrintAndLog("\nValid EM4x05/EM4x69 Chip Found\nUse lf em 4x05readword/dump commands to read\n");
1147 return 1;
1148 }
1149 ans=CmdLFHitagReader("26");
1150 if (ans==0) {
1151 return 1;
1152 }
1153 ans=CmdCOTAGRead("");
1154 if (ans>0){
1155 PrintAndLog("\nValid COTAG ID Found!");
1156 return 1;
1157 }
1158 }
1159 return 0;
1160 }
1161
1162 ans=CmdFSKdemodIO("");
1163 if (ans>0) {
1164 PrintAndLog("\nValid IO Prox ID Found!");
1165 return CheckChipType(cmdp);
1166 }
1167
1168 ans=CmdFSKdemodPyramid("");
1169 if (ans>0) {
1170 PrintAndLog("\nValid Pyramid ID Found!");
1171 return CheckChipType(cmdp);
1172 }
1173
1174 ans=CmdFSKdemodParadox("");
1175 if (ans>0) {
1176 PrintAndLog("\nValid Paradox ID Found!");
1177 return CheckChipType(cmdp);
1178 }
1179
1180 ans=CmdFSKdemodAWID("");
1181 if (ans>0) {
1182 PrintAndLog("\nValid AWID ID Found!");
1183 return CheckChipType(cmdp);
1184 }
1185
1186 ans=CmdFSKdemodHID("");
1187 if (ans>0) {
1188 PrintAndLog("\nValid HID Prox ID Found!");
1189 return CheckChipType(cmdp);
1190 }
1191
1192 ans=CmdAskEM410xDemod("");
1193 if (ans>0) {
1194 PrintAndLog("\nValid EM410x ID Found!");
1195 return CheckChipType(cmdp);
1196 }
1197
1198 ans=CmdG_Prox_II_Demod("");
1199 if (ans>0) {
1200 PrintAndLog("\nValid G Prox II ID Found!");
1201 return CheckChipType(cmdp);
1202 }
1203
1204 ans=CmdFDXBdemodBI("");
1205 if (ans>0) {
1206 PrintAndLog("\nValid FDX-B ID Found!");
1207 return CheckChipType(cmdp);
1208 }
1209
1210 ans=EM4x50Read("", false);
1211 if (ans>0) {
1212 PrintAndLog("\nValid EM4x50 ID Found!");
1213 return 1;
1214 }
1215
1216 ans=CmdVikingDemod("");
1217 if (ans>0) {
1218 PrintAndLog("\nValid Viking ID Found!");
1219 return CheckChipType(cmdp);
1220 }
1221
1222 ans=CmdIndalaDecode("");
1223 if (ans>0) {
1224 PrintAndLog("\nValid Indala ID Found!");
1225 return CheckChipType(cmdp);
1226 }
1227
1228 ans=CmdPSKNexWatch("");
1229 if (ans>0) {
1230 PrintAndLog("\nValid NexWatch ID Found!");
1231 return CheckChipType(cmdp);
1232 }
1233
1234 PrintAndLog("\nNo Known Tags Found!\n");
1235 if (testRaw=='u' || testRaw=='U'){
1236 ans=CheckChipType(cmdp);
1237 //test unknown tag formats (raw mode)0
1238 PrintAndLog("\nChecking for Unknown tags:\n");
1239 ans=AutoCorrelate(4000, false, false);
1240 if (ans > 0) PrintAndLog("Possible Auto Correlation of %d repeating samples",ans);
1241 ans=GetFskClock("",false,false);
1242 if (ans != 0){ //fsk
1243 ans=FSKrawDemod("",true);
1244 if (ans>0) {
1245 PrintAndLog("\nUnknown FSK Modulated Tag Found!");
1246 return 1;
1247 }
1248 }
1249 bool st = true;
1250 ans=ASKDemod_ext("0 0 0",true,false,1,&st);
1251 if (ans>0) {
1252 PrintAndLog("\nUnknown ASK Modulated and Manchester encoded Tag Found!");
1253 PrintAndLog("\nif it does not look right it could instead be ASK/Biphase - try 'data rawdemod ab'");
1254 return 1;
1255 }
1256 ans=CmdPSK1rawDemod("");
1257 if (ans>0) {
1258 PrintAndLog("Possible unknown PSK1 Modulated Tag Found above!\n\nCould also be PSK2 - try 'data rawdemod p2'");
1259 PrintAndLog("\nCould also be PSK3 - [currently not supported]");
1260 PrintAndLog("\nCould also be NRZ - try 'data nrzrawdemod");
1261 return 1;
1262 }
1263 PrintAndLog("\nNo Data Found!\n");
1264 }
1265 return 0;
1266 }
1267
1268 static command_t CommandTable[] =
1269 {
1270 {"help", CmdHelp, 1, "This help"},
1271 {"awid", CmdLFAWID, 1, "{ AWID RFIDs... }"},
1272 {"cotag", CmdLFCOTAG, 1, "{ COTAG RFIDs... }"},
1273 {"em", CmdLFEM4X, 1, "{ EM4X RFIDs... }"},
1274 {"hid", CmdLFHID, 1, "{ HID RFIDs... }"},
1275 {"hitag", CmdLFHitag, 1, "{ Hitag tags and transponders... }"},
1276 {"io", CmdLFIO, 1, "{ ioProx tags... }"},
1277 {"presco", CmdLFPresco, 1, "{ Presco RFIDs... }"},
1278 {"pcf7931", CmdLFPCF7931, 1, "{ PCF7931 RFIDs... }"},
1279 {"pyramid", CmdLFPyramid, 1, "{ Farpointe/Pyramid RFIDs... }"},
1280 {"t55xx", CmdLFT55XX, 1, "{ T55xx RFIDs... }"},
1281 {"ti", CmdLFTI, 1, "{ TI RFIDs... }"},
1282 {"viking", CmdLFViking, 1, "{ Viking tags... }"},
1283 {"cmdread", CmdLFCommandRead, 0, "<d period> <z period> <o period> <c command> ['H'] -- Modulate LF reader field to send command before read (all periods in microseconds) (option 'H' for 134)"},
1284 {"config", CmdLFSetConfig, 0, "Set config for LF sampling, bit/sample, decimation, frequency"},
1285 {"flexdemod", CmdFlexdemod, 1, "Demodulate samples for FlexPass"},
1286 {"indalademod", CmdIndalaDemod, 1, "['224'] -- Demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"},
1287 {"indalaclone", CmdIndalaClone, 0, "<UID> ['l']-- Clone Indala to T55x7 (tag must be in antenna)(UID in HEX)(option 'l' for 224 UID"},
1288 {"read", CmdLFRead, 0, "['s' silent] Read 125/134 kHz LF ID-only tag. Do 'lf read h' for help"},
1289 {"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"},
1290 {"sim", CmdLFSim, 0, "[GAP] -- Simulate LF tag from buffer with optional GAP (in microseconds)"},
1291 {"simask", CmdLFaskSim, 0, "[clock] [invert <1|0>] [biphase/manchester/raw <'b'|'m'|'r'>] [msg separator 's'] [d <hexdata>] -- Simulate LF ASK tag from demodbuffer or input"},
1292 {"simfsk", CmdLFfskSim, 0, "[c <clock>] [i] [H <fcHigh>] [L <fcLow>] [d <hexdata>] -- Simulate LF FSK tag from demodbuffer or input"},
1293 {"simpsk", CmdLFpskSim, 0, "[1|2|3] [c <clock>] [i] [r <carrier>] [d <raw hex to sim>] -- Simulate LF PSK tag from demodbuffer or input"},
1294 {"simbidir", CmdLFSimBidir, 0, "Simulate LF tag (with bidirectional data transmission between reader and tag)"},
1295 {"snoop", CmdLFSnoop, 0, "['l'|'h'|<divisor>] [trigger threshold]-- Snoop LF (l:125khz, h:134khz)"},
1296 {"vchdemod", CmdVchDemod, 1, "['clone'] -- Demodulate samples for VeriChip"},
1297 {NULL, NULL, 0, NULL}
1298 };
1299
1300 int CmdLF(const char *Cmd)
1301 {
1302 CmdsParse(CommandTable, Cmd);
1303 return 0;
1304 }
1305
1306 int CmdHelp(const char *Cmd)
1307 {
1308 CmdsHelp(CommandTable);
1309 return 0;
1310 }
Impressum, Datenschutz