#include "data.h"\r
\r
\r
-#define LF_TRACE_BUFF_SIZE 12000 // 32 x 32 x 10 (32 bit times numofblock (7), times clock skip..)\r
+#define LF_TRACE_BUFF_SIZE 20000 // 32 x 32 x 10 (32 bit times numofblock (7), times clock skip..)\r
#define LF_BITSSTREAM_LEN 1000 // more then 1000 bits shouldn't happend.. 8block * 4 bytes * 8bits = \r
static int CmdHelp(const char *Cmd);\r
\r
-\r
int CmdReadBlk(const char *Cmd)\r
{\r
int block = -1;\r
\r
uint8_t data[LF_TRACE_BUFF_SIZE] = {0x00};\r
\r
- GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,3560); //3560 -- should be offset..\r
+ GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,0); //3560 -- should be offset..\r
WaitForResponseTimeout(CMD_ACK,NULL, 1500);\r
\r
for (int j = 0; j < LF_TRACE_BUFF_SIZE; j++) {\r
\r
uint8_t data[LF_TRACE_BUFF_SIZE] = {0x00};\r
\r
- GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,3560); //3560 -- should be offset..\r
+ GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,0); //3560 -- should be offset..\r
WaitForResponseTimeout(CMD_ACK,NULL, 1500);\r
\r
for (int j = 0; j < LF_TRACE_BUFF_SIZE; j++) {\r
\r
uint8_t data[LF_TRACE_BUFF_SIZE] = {0x00};\r
\r
- GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,3560); //3560 -- should be offset..\r
+ GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,0); //3560 -- should be offset..\r
WaitForResponseTimeout(CMD_ACK,NULL, 1500);\r
\r
for (int j = 0; j < LF_TRACE_BUFF_SIZE; j++) {\r
return 0;\r
}\r
\r
- if ( strlen(Cmd)==0){\r
+ if ( strlen(Cmd) == 0 ){\r
CmdReadBlk("0");\r
} \r
\r
uint8_t bits[LF_BITSSTREAM_LEN] = {0x00};\r
- uint8_t * bitstream = bits;\r
- \r
- manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream, LF_BITSSTREAM_LEN);\r
+\r
+ manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bits, LF_BITSSTREAM_LEN);\r
\r
uint8_t si = 5;\r
- uint32_t bl0 = PackBits(si, 32, bitstream);\r
+ uint32_t bl0 = PackBits(si, 32, bits);\r
\r
- uint32_t safer = PackBits(si, 4, bitstream); si += 4; \r
- uint32_t resv = PackBits(si, 7, bitstream); si += 7;\r
- uint32_t dbr = PackBits(si, 3, bitstream); si += 3;\r
- uint32_t extend = PackBits(si, 1, bitstream); si += 1;\r
- uint32_t datamodulation = PackBits(si, 5, bitstream); si += 5;\r
- uint32_t pskcf = PackBits(si, 2, bitstream); si += 2;\r
- uint32_t aor = PackBits(si, 1, bitstream); si += 1; \r
- uint32_t otp = PackBits(si, 1, bitstream); si += 1; \r
- uint32_t maxblk = PackBits(si, 3, bitstream); si += 3;\r
- uint32_t pwd = PackBits(si, 1, bitstream); si += 1; \r
- uint32_t sst = PackBits(si, 1, bitstream); si += 1; \r
- uint32_t fw = PackBits(si, 1, bitstream); si += 1;\r
- uint32_t inv = PackBits(si, 1, bitstream); si += 1; \r
- uint32_t por = PackBits(si, 1, bitstream); si += 1;\r
+ uint32_t safer = PackBits(si, 4, bits); si += 4; \r
+ uint32_t resv = PackBits(si, 7, bits); si += 7;\r
+ uint32_t dbr = PackBits(si, 3, bits); si += 3;\r
+ uint32_t extend = PackBits(si, 1, bits); si += 1;\r
+ uint32_t datamodulation = PackBits(si, 5, bits); si += 5;\r
+ uint32_t pskcf = PackBits(si, 2, bits); si += 2;\r
+ uint32_t aor = PackBits(si, 1, bits); si += 1; \r
+ uint32_t otp = PackBits(si, 1, bits); si += 1; \r
+ uint32_t maxblk = PackBits(si, 3, bits); si += 3;\r
+ uint32_t pwd = PackBits(si, 1, bits); si += 1; \r
+ uint32_t sst = PackBits(si, 1, bits); si += 1; \r
+ uint32_t fw = PackBits(si, 1, bits); si += 1;\r
+ uint32_t inv = PackBits(si, 1, bits); si += 1; \r
+ uint32_t por = PackBits(si, 1, bits); si += 1;\r
\r
PrintAndLog("");\r
- PrintAndLog("-- T55xx Configuration --------------------------------------");\r
+ PrintAndLog("-- T55xx Configuration & Tag Information --------------------");\r
PrintAndLog("-------------------------------------------------------------");\r
PrintAndLog(" Safer key : %s", GetSaferStr(safer));\r
PrintAndLog(" reserved : %d", resv);\r
PrintAndLog(" POR-Delay : %s", (por) ? "Yes":"No");\r
PrintAndLog("-------------------------------------------------------------");\r
PrintAndLog(" Raw Data - Page 0");\r
- PrintAndLog(" Block 0 : 0x%08X %s", bl0, sprint_bin(bitstream+5,32) );\r
+ PrintAndLog(" Block 0 : 0x%08X %s", bl0, sprint_bin(bits+5,32) );\r
PrintAndLog("-------------------------------------------------------------");\r
\r
return 0;\r
uint8_t bits[LF_BITSSTREAM_LEN] = {0x00};\r
uint8_t * bitstream = bits;\r
\r
- manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream, LF_BITSSTREAM_LEN); \r
- blockData = PackBits(offset, sizebyte, bitstream);\r
+ //manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream, LF_BITSSTREAM_LEN); \r
+ manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bits, LF_BITSSTREAM_LEN); \r
+ //blockData = PackBits(offset, sizebyte, bitstream);\r
+ blockData = PackBits(offset, sizebyte, bits);\r
\r
if ( blockNum < 0)\r
PrintAndLog(" Decoded : 0x%08X %s", blockData, sprint_bin(bitstream+offset,sizebyte) );\r
\r
int i = start;\r
int j = len-1;\r
+ if (len > 32) {\r
+ return 0;\r
+ }\r
uint32_t tmp = 0;\r
for (; j >= 0; --j, ++i){\r
tmp |= bits[i] << j;\r