]> cvs.zerfleddert.de Git - proxmark3-svn/blob - client/cmdhfdes.c
CHG: changed output for the "hf mf nested" to show KEY: A or B instead of 0/1
[proxmark3-svn] / client / cmdhfdes.c
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2012 nuit
3 //
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
6 // the license.
7 //-----------------------------------------------------------------------------
8 // High frequency MIFARE DESfire commands
9 //-----------------------------------------------------------------------------
10
11 #include "cmdhfdes.h"
12 #include "proxmark3.h"
13 #include "cmdmain.h"
14
15 static int CmdHelp(const char *Cmd);
16
17 int CmdHFDESReader(const char *Cmd)
18 {
19 UsbCommand c = { CMD_MIFARE_DES_READER, {3, 0x60, 0} };
20 SendCommand(&c);
21 UsbCommand resp;
22 if (!WaitForResponseTimeout(CMD_ACK,&resp,2000) ){
23 PrintAndLog("Command time-out");
24 return 1;
25 }
26 return 0;
27 }
28
29 int CmdHFDESDbg(const char *Cmd)
30 {
31 int dbgMode = param_get32ex(Cmd, 0, 0, 10);
32 if (dbgMode > 4) {
33 PrintAndLog("Max debud mode parameter is 4 \n");
34 }
35
36 if (strlen(Cmd) < 1 || !param_getchar(Cmd, 0) || dbgMode > 4) {
37 PrintAndLog("Usage: hf des dbg <debug level>");
38 PrintAndLog(" 0 - no debug messages");
39 PrintAndLog(" 1 - error messages");
40 PrintAndLog(" 2 - all messages");
41 PrintAndLog(" 4 - extended debug mode");
42 return 0;
43 }
44
45 UsbCommand c = {CMD_MIFARE_SET_DBGMODE, {dbgMode, 0, 0}};
46 SendCommand(&c);
47
48 return 0;
49 }
50
51 static command_t CommandTable[] =
52 {
53 {"help", CmdHelp, 1, "This help"},
54 {"dbg", CmdHFDESDbg, 0, "Set default debug mode"},
55 {"reader", CmdHFDESReader, 0, "Reader"},
56 {NULL, NULL, 0, NULL}
57 };
58
59 int CmdHFDES(const char *Cmd)
60 {
61 //flush
62 clearCommandBuffer();
63 //WaitForResponseTimeout(CMD_ACK,NULL,100);
64 CmdsParse(CommandTable, Cmd);
65 return 0;
66 }
67
68 int CmdHelp(const char *Cmd)
69 {
70 CmdsHelp(CommandTable);
71 return 0;
72 }
Impressum, Datenschutz