]> git.zerfleddert.de Git - proxmark3-svn/blob - client/cmdlfio.c
New release with FPGA compression
[proxmark3-svn] / client / cmdlfio.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <inttypes.h>
5 #include <limits.h>
6 #include "proxmark3.h"
7 #include "data.h"
8 #include "graph.h"
9 #include "ui.h"
10 #include "cmdparser.h"
11 #include "cmdmain.h"
12 #include "cmddata.h"
13 #include "cmdlf.h"
14
15 static int CmdHelp(const char *Cmd);
16
17 int CmdIODemodFSK(const char *Cmd)
18 {
19 int findone=0;
20 if(Cmd[0]=='1') findone=1;
21
22 UsbCommand c={CMD_IO_DEMOD_FSK};
23 c.arg[0]=findone;
24 SendCommand(&c);
25 return 0;
26 }
27 /*
28 int CmdIOProxDemod(const char *Cmd){
29 if (GraphTraceLen < 4800) {
30 PrintAndLog("too short; need at least 4800 samples");
31 return 0;
32 }
33 GraphTraceLen = 4800;
34 for (int i = 0; i < GraphTraceLen; ++i) {
35 GraphBuffer[i] = (GraphBuffer[i] < 0) ? 0 : 1;
36 }
37 RepaintGraphWindow();
38 return 0;
39 }
40 */
41 int CmdIOClone(const char *Cmd)
42 {
43 unsigned int hi = 0, lo = 0;
44 int n = 0, i = 0;
45 UsbCommand c;
46
47
48 //if (1 == sscanf(str, "0x%"SCNx32, &hi)) {
49 // value now contains the value in the string--decimal 255, in this case.
50 //}
51
52 while (sscanf(&Cmd[i++], "%1x", &n ) == 1) {
53 hi = (hi << 4) | (lo >> 28);
54 lo = (lo << 4) | (n & 0xf);
55 }
56
57 PrintAndLog("Cloning tag with ID %08x %08x", hi, lo);
58 PrintAndLog("Press pm3-button to abort simulation");
59 c.cmd = CMD_IO_CLONE_TAG;
60 c.arg[0] = hi;
61 c.arg[1] = lo;
62
63 SendCommand(&c);
64 return 0;
65 }
66
67 static command_t CommandTable[] =
68 {
69 {"help", CmdHelp, 1, "This help"},
70 //{"demod", CmdIOProxDemod, 1, "Demodulate Stream"},
71 {"fskdemod", CmdIODemodFSK, 0, "['1'] Realtime IO FSK demodulator (option '1' for one tag only)"},
72 {"clone", CmdIOClone, 0, "Clone ioProx Tag"},
73 {NULL, NULL, 0, NULL}
74 };
75
76 int CmdLFIO(const char *Cmd)
77 {
78 CmdsParse(CommandTable, Cmd);
79 return 0;
80 }
81
82 int CmdHelp(const char *Cmd)
83 {
84 CmdsHelp(CommandTable);
85 return 0;
86 }
Impressum, Datenschutz