]> git.zerfleddert.de Git - proxmark3-svn/blame - client/cmdlfio.c
Minor fixes to some help-texts.
[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{
083ca3de 19 int findone=0;
20 if(Cmd[0]=='1') findone=1;
3fe4ff4f 21
c8622024 22 UsbCommand c={CMD_IO_DEMOD_FSK};
083ca3de 23 c.arg[0]=findone;
c8622024 24 SendCommand(&c);
25 return 0;
26}
27
c8622024 28int CmdIOProxDemod(const char *Cmd){
29 if (GraphTraceLen < 4800) {
30 PrintAndLog("too short; need at least 4800 samples");
31 return 0;
32 }
c8622024 33 GraphTraceLen = 4800;
34 for (int i = 0; i < GraphTraceLen; ++i) {
3fe4ff4f 35 GraphBuffer[i] = (GraphBuffer[i] < 0) ? 0 : 1;
c8622024 36 }
37 RepaintGraphWindow();
38 return 0;
39}
40
41int 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);
3fe4ff4f 58 PrintAndLog("Press pm3-button to abort simulation");
c8622024 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
67static command_t CommandTable[] =
68{
69 {"help", CmdHelp, 1, "This help"},
70 {"demod", CmdIOProxDemod, 1, "Demodulate Stream"},
083ca3de 71 {"fskdemod", CmdIODemodFSK, 0, "['1'] Realtime IO FSK demodulator (option '1' for one tag only)"},
72 {"clone", CmdIOClone, 0, "Clone ioProx Tag"},
c8622024 73 {NULL, NULL, 0, NULL}
74};
75
76int CmdLFIO(const char *Cmd)
77{
78 CmdsParse(CommandTable, Cmd);
79 return 0;
80}
81
82int CmdHelp(const char *Cmd)
83{
84 CmdsHelp(CommandTable);
85 return 0;
86}
Impressum, Datenschutz