]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/cmdlfhid.c
767ea3cc3dec3216489babd45473b83e8656ffbe
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 //-----------------------------------------------------------------------------
15 #include "cmdparser.h"
18 static int CmdHelp(const char *Cmd
);
20 int CmdHIDDemod(const char *Cmd
)
22 if (GraphTraceLen
< 4800) {
23 PrintAndLog("too short; need at least 4800 samples");
28 for (int i
= 0; i
< GraphTraceLen
; ++i
) {
29 if (GraphBuffer
[i
] < 0) {
39 int CmdHIDDemodFSK(const char *Cmd
)
41 UsbCommand c
={CMD_HID_DEMOD_FSK
};
46 int CmdHIDSim(const char *Cmd
)
48 unsigned int hi
= 0, lo
= 0;
51 while (sscanf(&Cmd
[i
++], "%1x", &n
) == 1) {
52 hi
= (hi
<< 4) | (lo
>> 28);
53 lo
= (lo
<< 4) | (n
& 0xf);
56 PrintAndLog("Emulating tag with ID %x%16x", hi
, lo
);
58 UsbCommand c
= {CMD_HID_SIM_TAG
, {hi
, lo
, 0}};
63 int CmdHIDClone(const char *Cmd
)
65 unsigned int hi
= 0, lo
= 0;
68 while (sscanf(&Cmd
[i
++], "%1x", &n
) == 1) {
69 hi
= (hi
<< 4) | (lo
>> 28);
70 lo
= (lo
<< 4) | (n
& 0xf);
73 PrintAndLog("Cloning tag with ID %x%08x", hi
, lo
);
75 UsbCommand c
= {CMD_HID_CLONE_TAG
, {hi
, lo
}};
80 static command_t CommandTable
[] =
82 {"help", CmdHelp
, 1, "This help"},
83 {"demod", CmdHIDDemod
, 1, "Demodulate HID Prox Card II (not optimal)"},
84 {"fskdemod", CmdHIDDemodFSK
, 0, "Realtime HID FSK demodulator"},
85 {"sim", CmdHIDSim
, 0, "<ID> -- HID tag simulator"},
86 {"clone", CmdHIDClone
, 0, "<ID> -- Clone HID to T55x7 (tag must be in antenna)"},
90 int CmdLFHID(const char *Cmd
)
92 CmdsParse(CommandTable
, Cmd
);
96 int CmdHelp(const char *Cmd
)
98 CmdsHelp(CommandTable
);