]>
git.zerfleddert.de Git - proxmark3-svn/blob - client/cmdlft55xx.c
a719c7ad7a56e4a6216e910aa4d28cad3069007d
1 //-----------------------------------------------------------------------------
3 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
4 // at your option, any later version. See the LICENSE.txt file for the text of
6 //-----------------------------------------------------------------------------
7 // Low frequency T55xx commands
8 //-----------------------------------------------------------------------------
13 #include "proxmark3.h"
16 #include "cmdparser.h"
19 #include "cmdlft55xx.h"
21 static int CmdHelp(const char *Cmd
);
24 int CmdReadBlk(const char *Cmd
)
26 int Block
= 8; //default to invalid block
29 sscanf(Cmd
, "%d", &Block
);
32 PrintAndLog("Block must be between 0 and 7");
36 PrintAndLog("Reading block %d", Block
);
38 c
.cmd
= CMD_T55XX_READ_BLOCK
;
39 c
.d
.asBytes
[0] = 0x0; //Normal mode
47 int CmdReadBlkPWD(const char *Cmd
)
49 int Block
= 8; //default to invalid block
50 int Password
= 0xFFFFFFFF; //default to blank Block 7
53 sscanf(Cmd
, "%d %x", &Block
, &Password
);
56 PrintAndLog("Block must be between 0 and 7");
60 PrintAndLog("Reading block %d with password %08X", Block
, Password
);
62 c
.cmd
= CMD_T55XX_READ_BLOCK
;
63 c
.d
.asBytes
[0] = 0x1; //Password mode
71 int CmdWriteBlk(const char *Cmd
)
73 int Block
= 8; //default to invalid block
74 int Data
= 0xFFFFFFFF; //default to blank Block
77 sscanf(Cmd
, "%x %d", &Data
, &Block
);
80 PrintAndLog("Block must be between 0 and 7");
84 PrintAndLog("Writting block %d with data %08X", Block
, Data
);
86 c
.cmd
= CMD_T55XX_WRITE_BLOCK
;
87 c
.d
.asBytes
[0] = 0x0; //Normal mode
95 int CmdWriteBlkPWD(const char *Cmd
)
97 int Block
= 8; //default to invalid block
98 int Data
= 0xFFFFFFFF; //default to blank Block
99 int Password
= 0xFFFFFFFF; //default to blank Block 7
102 sscanf(Cmd
, "%x %d %x", &Data
, &Block
, &Password
);
105 PrintAndLog("Block must be between 0 and 7");
109 PrintAndLog("Writting block %d with data %08X and password %08X", Block
, Data
, Password
);
111 c
.cmd
= CMD_T55XX_WRITE_BLOCK
;
112 c
.d
.asBytes
[0] = 0x1; //Password mode
120 int CmdReadTrace(const char *Cmd
)
123 PrintAndLog("Reading traceability data");
125 UsbCommand c
= {CMD_T55XX_READ_TRACE
, {0, 0, 0}};
130 static command_t CommandTable
[] =
132 {"help", CmdHelp
, 1, "This help"},
133 {"readblock", CmdReadBlk
, 1, "<Block> -- Read T55xx block data (page 0)"},
134 {"readblockPWD", CmdReadBlkPWD
, 1, "<Block> <Password> -- Read T55xx block data in password mode(page 0)"},
135 {"writeblock", CmdWriteBlk
, 1, "<Data> <Block> -- Write T55xx block data (page 0)"},
136 {"writeblockPWD", CmdWriteBlkPWD
, 1, "<Data> <Block> <Password> -- Write T55xx block data in password mode(page 0)"},
137 {"readtrace", CmdReadTrace
, 1, "Read T55xx traceability data (page 1)"},
138 {NULL
, NULL
, 0, NULL
}
141 int CmdLFT55XX(const char *Cmd
)
143 CmdsParse(CommandTable
, Cmd
);
147 int CmdHelp(const char *Cmd
)
149 CmdsHelp(CommandTable
);