]>
git.zerfleddert.de Git - proxmark3-svn/blob - client/cmdlfhid.c
d13856f4a3cc9442df48c188c8d67d3fbde671a8
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2010 iZsh <izsh at fail0verflow.com>
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
7 //-----------------------------------------------------------------------------
8 // Low frequency HID commands
9 //-----------------------------------------------------------------------------
12 //#include "proxusb.h"
13 #include "proxmark3.h"
16 #include "cmdparser.h"
19 static int CmdHelp(const char *Cmd
);
21 int CmdHIDDemod(const char *Cmd
)
23 if (GraphTraceLen
< 4800) {
24 PrintAndLog("too short; need at least 4800 samples");
29 for (int i
= 0; i
< GraphTraceLen
; ++i
) {
30 if (GraphBuffer
[i
] < 0) {
40 int CmdHIDDemodFSK(const char *Cmd
)
42 UsbCommand c
={CMD_HID_DEMOD_FSK
};
47 int CmdHIDSim(const char *Cmd
)
49 unsigned int hi
= 0, lo
= 0;
52 while (sscanf(&Cmd
[i
++], "%1x", &n
) == 1) {
53 hi
= (hi
<< 4) | (lo
>> 28);
54 lo
= (lo
<< 4) | (n
& 0xf);
57 PrintAndLog("Emulating tag with ID %x%16x", hi
, lo
);
59 UsbCommand c
= {CMD_HID_SIM_TAG
, {hi
, lo
, 0}};
64 int CmdHIDClone(const char *Cmd
)
66 unsigned int hi
= 0, lo
= 0;
69 while (sscanf(&Cmd
[i
++], "%1x", &n
) == 1) {
70 hi
= (hi
<< 4) | (lo
>> 28);
71 lo
= (lo
<< 4) | (n
& 0xf);
74 PrintAndLog("Cloning tag with ID %x%08x", hi
, lo
);
76 UsbCommand c
= {CMD_HID_CLONE_TAG
, {hi
, lo
}};
81 static command_t CommandTable
[] =
83 {"help", CmdHelp
, 1, "This help"},
84 {"demod", CmdHIDDemod
, 1, "Demodulate HID Prox Card II (not optimal)"},
85 {"fskdemod", CmdHIDDemodFSK
, 0, "Realtime HID FSK demodulator"},
86 {"sim", CmdHIDSim
, 0, "<ID> -- HID tag simulator"},
87 {"clone", CmdHIDClone
, 0, "<ID> -- Clone HID to T55x7 (tag must be in antenna)"},
91 int CmdLFHID(const char *Cmd
)
93 CmdsParse(CommandTable
, Cmd
);
97 int CmdHelp(const char *Cmd
)
99 CmdsHelp(CommandTable
);