return 0;\r
}\r
int usage_t55xx_detect(){\r
- PrintAndLog("Usage: lf t55xx detect [1]");\r
+ PrintAndLog("Usage: lf t55xx detect [1] [p <password>]");\r
PrintAndLog("Options:");\r
- PrintAndLog(" [graph buffer data] - if set, use Graphbuffer otherwise read data from tag.");\r
+ PrintAndLog(" 1 - if set, use Graphbuffer otherwise read data from tag.");\r
+ PrintAndLog(" p <password> - OPTIONAL password (8 hex characters)");\r
PrintAndLog("");\r
PrintAndLog("Examples:");\r
PrintAndLog(" lf t55xx detect");\r
PrintAndLog(" lf t55xx detect 1");\r
+ PrintAndLog(" lf t55xx detect p 11223344");\r
PrintAndLog("");\r
return 0;\r
}\r
}\r
\r
int CmdT55xxDetect(const char *Cmd){\r
+ bool errors = FALSE;\r
+ bool useGB = FALSE;\r
+ bool usepwd = FALSE;\r
+ uint32_t password = 0;\r
+ uint8_t cmdp = 0;\r
\r
- uint32_t password = 0; //default to blank Block 7\r
-\r
- char cmdp = param_getchar(Cmd, 0);\r
- if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') return usage_t55xx_detect();\r
-\r
- bool usepwd = ( strlen(Cmd) > 0); \r
- if ( usepwd ){\r
- password = param_get32ex(Cmd, 0, 0, 16);\r
- // if (param_getchar(Cmd, 1) =='o' )\r
- // override = true;\r
+ while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {\r
+ switch(param_getchar(Cmd, cmdp)) {\r
+ case 'h':\r
+ case 'H':\r
+ return usage_t55xx_detect();\r
+ case 'p':\r
+ case 'P':\r
+ password = param_get32ex(Cmd, cmdp+1, 0, 16);\r
+ usepwd = TRUE;\r
+ cmdp += 2;\r
+ break;\r
+ case '1':\r
+ // use Graphbuffer data\r
+ useGB = TRUE;\r
+ cmdp++;\r
+ break;\r
+ default:\r
+ PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r
+ errors = true;\r
+ break;\r
+ }\r
}\r
-\r
+ if (errors) return usage_t55xx_detect();\r
\r
- if (strlen(Cmd)==1) {\r
- password = param_get32ex(Cmd, 0, 0, 16);\r
- //if (param_getchar(Cmd, 1) =='o' ) override = true;\r
+ if ( !useGB) {\r
+ if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, usepwd, password) )\r
+ return 0;\r
}\r
-\r
- if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, usepwd, password) )\r
- return 0;\r
- \r
+ \r
if ( !tryDetectModulation() )\r
PrintAndLog("Could not detect modulation automatically. Try setting it manually with \'lf t55xx config\'");\r
\r