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