#include <stdio.h>\r
#include <string.h>\r
#include <inttypes.h>\r
-#include <time.h>\r
+//#include <time.h>\r
#include "proxmark3.h"\r
#include "ui.h"\r
#include "graph.h"\r
#include "util.h"\r
#include "data.h"\r
#include "lfdemod.h"\r
-#include "../common/crc.h"\r
-#include "../common/iso14443crc.h"\r
#include "cmdhf14a.h"\r
\r
#define T55x7_CONFIGURATION_BLOCK 0x00\r
PrintAndLog("");\r
return 0;\r
}\r
-\r
+int usage_t55xx_wipe(){\r
+ PrintAndLog("Usage: lf t55xx wipe [h] [Q5]");\r
+ PrintAndLog("This commands wipes a tag, fills blocks 1-7 with zeros and a default configuration block");\r
+ PrintAndLog("Options:");\r
+ PrintAndLog(" h - this help");\r
+ PrintAndLog(" Q5 - indicates to use the T555 (Q5) default configuration block");\r
+ PrintAndLog("");\r
+ PrintAndLog("Examples:");\r
+ PrintAndLog(" lf t55xx wipe - wipes a t55x7 tag, config block 0x000880E0");\r
+ PrintAndLog(" lf t55xx wipe Q5 - wipes a t5555 Q5 tag, config block 0x6001F004");\r
+ return 0;\r
+}\r
static int CmdHelp(const char *Cmd);\r
\r
void printT5xxHeader(uint8_t page){\r
switch (tagtype){\r
case 0: snprintf(retStr, sizeof(buf),"%08X - T55X7 Default", T55X7_DEFAULT_CONFIG_BLOCK); break;\r
case 1: snprintf(retStr, sizeof(buf),"%08X - T55X7 Raw", T55X7_RAW_CONFIG_BLOCK); break;\r
- //case 2: snprintf(retStr, sizeof(buf),"%08X - Q5 Default", Q5_DEFAULT_CONFIG_BLOCK); break;\r
+ case 2: snprintf(retStr, sizeof(buf),"%08X - T5555 Q5 Default", T5555_DEFAULT_CONFIG_BLOCK); break;\r
default:\r
break;\r
}\r
int CmdT55xxWipe(const char *Cmd) {\r
char writeData[20] = {0};\r
char *ptrData = writeData;\r
- \r
+ char cmdp = param_getchar(Cmd, 0); \r
+ if ( cmdp == 'h' || cmdp == 'H') return usage_t55xx_wipe();\r
+\r
+ bool Q5 = (cmdp == 'q' || cmdp == 'Q');\r
+\r
+ // Try with the default password to reset block 0\r
+ // With a pwd should work even if pwd bit not set\r
PrintAndLog("\nBeginning Wipe of a T55xx tag (assuming the tag is not password protected)\n");\r
+ \r
+ if ( Q5 ){\r
+ snprintf(ptrData,sizeof(writeData),"b 0 d 6001F004 p 0");\r
+ } else {\r
+ snprintf(ptrData,sizeof(writeData),"b 0 d 000880E0 p 0");\r
+ }\r
\r
- //try with the default password to reset block 0 (with a pwd should work even if pwd bit not set)\r
- snprintf(ptrData,sizeof(writeData),"b 0 d 000880E0 p 0");\r
- \r
- if (!CmdT55xxWriteBlock(ptrData))\r
- PrintAndLog("Error writing blk 0");\r
+ if (!CmdT55xxWriteBlock(ptrData)) PrintAndLog("Error writing blk 0");\r
\r
for (uint8_t blk = 1; blk<8; blk++) {\r
\r
snprintf(ptrData,sizeof(writeData),"b %d d 0", blk);\r
\r
- if (!CmdT55xxWriteBlock(ptrData)) \r
- PrintAndLog("Error writing blk %d", blk);\r
+ if (!CmdT55xxWriteBlock(ptrData)) PrintAndLog("Error writing blk %d", blk);\r
\r
memset(writeData,0x00, sizeof(writeData));\r
}\r