\r
void printT5xxHeader(uint8_t page){\r
PrintAndLog("Reading Page %d:", page); \r
- PrintAndLog("blk | hex data | binary");\r
- PrintAndLog("----+----------+---------------------------------"); \r
+ PrintAndLog("blk | hex data | binary | ascii");\r
+ PrintAndLog("----+----------+---------------------------------+-------"); \r
}\r
\r
int CmdT55xxSetConfig(const char *Cmd) {\r
bits[i - config.offset] = DemodBuffer[i];\r
\r
blockData = PackBits(0, 32, bits);\r
+ uint8_t bytes[4] = {0};\r
+ num_to_bytes(blockData, 4, bytes);\r
\r
- PrintAndLog(" %s | %08X | %s", blockNum, blockData, sprint_bin(bits,32));\r
+ PrintAndLog(" %s | %08X | %s | %s", blockNum, blockData, sprint_bin(bits,32), sprint_ascii(bytes,4));\r
}\r
\r
int special(const char *Cmd) {\r
uint32_t blockData = 0;\r
uint8_t bits[32] = {0x00};\r
\r
- PrintAndLog("OFFSET | DATA | BINARY");\r
- PrintAndLog("----------------------------------------------------");\r
+ PrintAndLog("OFFSET | DATA | BINARY | ASCII");\r
+ PrintAndLog("-------+-------+------------------------------------+------");\r
int i,j = 0;\r
for (; j < 64; ++j){\r
\r
}\r
clearCommandBuffer();\r
SendCommand(&c);\r
- if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){\r
+ if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)){\r
PrintAndLog("Error occurred, device did not ACK write operation. (May be due to old firmware)");\r
return 0;\r
}\r
// bit1 = page to read from\r
// arg1: which block to read\r
// arg2: password\r
- \r
uint8_t arg0 = (page<<1) | pwdmode;\r
UsbCommand c = {CMD_T55XX_READ_BLOCK, {arg0, block, password}};\r
- \r
clearCommandBuffer();\r
SendCommand(&c);\r
- if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) {\r
+ if ( !WaitForResponseTimeout(CMD_ACK, NULL, 2500) ) {\r
PrintAndLog("command execution time out");\r
return 0;\r
}\r
\r
- uint8_t got[12000];\r
- GetFromBigBuf(got,sizeof(got),0);\r
- WaitForResponse(CMD_ACK,NULL);\r
+ //uint8_t got[12288];\r
+ uint8_t got[7679];\r
+ GetFromBigBuf(got, sizeof(got), 0);\r
+ if ( !WaitForResponseTimeout(CMD_ACK, NULL, 8000) ) {\r
+ PrintAndLog("command execution time out");\r
+ return 0;\r
+ }\r
setGraphBuf(got, sizeof(got));\r
return 1;\r
}\r
if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;\r
memcpy(filename, Cmd+2, len);\r
\r
- FILE * f = fopen( filename , "r");\r
- \r
+ FILE * f = fopen( filename , "r"); \r
if ( !f ) {\r
PrintAndLog("File: %s: not found or locked.", filename);\r
free(keyBlock);\r
// loop\r
uint64_t testpwd = 0x00;\r
for (uint16_t c = 0; c < keycnt; ++c ) {\r
- \r
+\r
+ if ( offline ) {\r
+ printf("Device offline\n");\r
+ free(keyBlock);\r
+ return 2;\r
+ }\r
+ \r
if (ukbhit()) {\r
ch = getchar();\r
(void)ch;\r
testpwd = bytes_to_num(keyBlock + 4*c, 4);\r
\r
PrintAndLog("Testing %08X", testpwd);\r
- \r
- \r
+ \r
if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, TRUE, testpwd)) {\r
PrintAndLog("Aquireing data from device failed. Quitting");\r
free(keyBlock);\r
}\r
\r
found = tryDetectModulation();\r
-\r
if ( found ) {\r
PrintAndLog("Found valid password: [%08X]", testpwd);\r
free(keyBlock);\r
\r
if (tryDetectModulation())\r
return 1;\r
- else return 0;\r
+ else \r
+ return 0;\r
}\r
\r
int CmdT55xxRecoverPW(const char *Cmd) {\r