]> git.zerfleddert.de Git - proxmark3-svn/blame - client/cmdlfio.c
Tested by changing the master key from the default to a custom value
[proxmark3-svn] / client / cmdlfio.c
CommitLineData
c8622024 1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <inttypes.h>
5#include <limits.h>
c8622024 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
15static int CmdHelp(const char *Cmd);
16
17int CmdIODemodFSK(const char *Cmd)
18{
19 UsbCommand c={CMD_IO_DEMOD_FSK};
20 SendCommand(&c);
21 return 0;
22}
23
c8622024 24int CmdIOProxDemod(const char *Cmd){
25 if (GraphTraceLen < 4800) {
26 PrintAndLog("too short; need at least 4800 samples");
27 return 0;
28 }
c8622024 29 GraphTraceLen = 4800;
30 for (int i = 0; i < GraphTraceLen; ++i) {
7bd30f12 31 GraphBuffer[i] = (GraphBuffer[i] < 0) ? 0 : 1;
c8622024 32 }
33 RepaintGraphWindow();
34 return 0;
35}
36
37int CmdIOClone(const char *Cmd)
38{
39 unsigned int hi = 0, lo = 0;
40 int n = 0, i = 0;
41 UsbCommand c;
42
43
44 //if (1 == sscanf(str, "0x%"SCNx32, &hi)) {
45 // value now contains the value in the string--decimal 255, in this case.
46 //}
47
48 while (sscanf(&Cmd[i++], "%1x", &n ) == 1) {
49 hi = (hi << 4) | (lo >> 28);
50 lo = (lo << 4) | (n & 0xf);
51 }
52
53 PrintAndLog("Cloning tag with ID %08x %08x", hi, lo);
54
55 c.cmd = CMD_IO_CLONE_TAG;
56 c.arg[0] = hi;
57 c.arg[1] = lo;
58
59 SendCommand(&c);
60 return 0;
61}
62
63static command_t CommandTable[] =
64{
7bd30f12 65 {"help", CmdHelp, 1, "This help"},
66 {"demod", CmdIOProxDemod, 1, "Demodulate Stream"},
67 {"fskdemod", CmdIODemodFSK, 1, "Demodulate ioProx Tag"},
68 {"clone", CmdIOClone, 1, "Clone ioProx Tag"},
c8622024 69 {NULL, NULL, 0, NULL}
70};
71
72int CmdLFIO(const char *Cmd)
73{
74 CmdsParse(CommandTable, Cmd);
75 return 0;
76}
77
78int CmdHelp(const char *Cmd)
79{
80 CmdsHelp(CommandTable);
81 return 0;
82}
Impressum, Datenschutz