return 1;\r
} \r
\r
- PrintAndLog(" Reading page 0 block : %d", Block);\r
+ //PrintAndLog(" Reading page 0 block : %d", Block);\r
\r
// this command fills up BigBuff\r
// \r
\r
manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream);\r
\r
+ uint32_t bl0 = PackBits(5, 32, bitstream);\r
+ PrintAndLog(" Block %d : 0x%08X %s", Block, bl0, sprint_bin(bitstream+5,32) );\r
+ \r
RepaintGraphWindow();\r
return 0;\r
}\r
uint8_t * bitstream = bits;\r
\r
manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream); \r
+ \r
+ uint32_t bl0 = PackBits(5, 32, bitstream);\r
+ PrintAndLog(" Block %d : 0x%08X %s", Block, bl0, sprint_bin(bitstream+5,32) );\r
+ \r
RepaintGraphWindow();\r
return 0;\r
}\r
uint32_t bl0 = PackBits(si, 32, bitstream);\r
uint32_t bl1 = PackBits(si+32, 32, bitstream);\r
\r
- uint32_t acl = PackBits(si, 8, bitstream);\r
- si += 8;\r
- uint32_t mfc = PackBits(si, 8, bitstream);\r
- si += 8;\r
- uint32_t cid = PackBits(si, 5, bitstream);\r
- si += 5;\r
- uint32_t icr = PackBits(si, 3, bitstream);\r
- si += 3;\r
- uint32_t year = PackBits(si, 4, bitstream);\r
- si += 4;\r
- uint32_t quarter = PackBits(si, 2, bitstream);\r
- si += 2;\r
- uint32_t num = PackBits(si, 12, bitstream);\r
- si += 12;\r
- uint32_t wafer = PackBits(si, 5, bitstream);\r
- si += 5;\r
- uint32_t dw = PackBits(si, 15, bitstream);\r
+ uint32_t acl = PackBits(si, 8, bitstream); si += 8;\r
+ uint32_t mfc = PackBits(si, 8, bitstream); si += 8;\r
+ uint32_t cid = PackBits(si, 5, bitstream); si += 5;\r
+ uint32_t icr = PackBits(si, 3, bitstream); si += 3;\r
+ uint32_t year = PackBits(si, 4, bitstream); si += 4;\r
+ uint32_t quarter = PackBits(si, 2, bitstream); si += 2;\r
+ uint32_t lotid = PackBits(si, 12, bitstream); si += 12;\r
+ uint32_t wafer = PackBits(si, 5, bitstream); si += 5;\r
+ uint32_t dw = PackBits(si, 15, bitstream); \r
\r
PrintAndLog("");\r
PrintAndLog("-- T55xx Trace Information ----------------------------------");\r
PrintAndLog(" ICR IC Revision : %d",icr );\r
PrintAndLog(" Manufactured");\r
PrintAndLog(" Year/Quarter : %d/%d",2000+year, quarter );\r
- PrintAndLog(" Number : %d", num );\r
+ PrintAndLog(" Lot ID : %d", lotid );\r
PrintAndLog(" Wafer number : %d", wafer);\r
PrintAndLog(" Die Number : %d", dw);\r
PrintAndLog("-------------------------------------------------------------");\r
- PrintAndLog(" Raw Data");\r
- PrintAndLog(" Block 0 : %08X", bl0);\r
- PrintAndLog(" Block 1 : %08X", bl1);\r
+ PrintAndLog(" Raw Data - Page 1");\r
+ PrintAndLog(" Block 0 : 0x%08X %s", bl0, sprint_bin(bitstream+5,32) );\r
+ PrintAndLog(" Block 0 : 0x%08X %s", bl1, sprint_bin(bitstream+37,32) );\r
PrintAndLog("-------------------------------------------------------------");\r
/*\r
TRACE - BLOCK O\r
22-24 ICR IC revision\r
25-28 YEAR (BCD encoded) 9 (= 2009)\r
29-30 QUARTER 1,2,3,4 \r
- 31-32 Number\r
+ 31-32 LOT ID\r
\r
TRACE - BLOCK 1\r
- 1-12 Number\r
+ 1-12 LOT ID \r
13-17 Wafer number\r
18-32 DW, die number sequential\r
*/\r
manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream);\r
\r
uint8_t si = 5;\r
- uint32_t bl0 = PackBits(si, 32, bitstream);\r
+ uint32_t bl0 = PackBits(si, 32, bitstream);\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 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 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 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
\r
PrintAndLog("");\r
PrintAndLog("-- T55xx Configuration --------------------------------------");\r
PrintAndLog(" Inverse data : %s", (inv) ? "Yes":"No");\r
PrintAndLog(" POR-Delay : %s", (por) ? "Yes":"No");\r
PrintAndLog("-------------------------------------------------------------");\r
- PrintAndLog(" Raw Data");\r
- PrintAndLog(" Block 0 : 0x%08X", bl0);\r
+ PrintAndLog(" Raw Data - Page 0");\r
+ PrintAndLog(" Block 0 : 0x%08X %s", bl0, sprint_bin(bitstream+5,32) );\r
PrintAndLog("-------------------------------------------------------------");\r
\r
return 0;\r
}\r
\r
+int CmdDump(const char *Cmd){\r
+\r
+ char cmdp = param_getchar(Cmd, 0);\r
+ char s[20];\r
+ uint8_t pwd[4] = {0x00};\r
+\r
+ \r
+ if (strlen(Cmd)>1 || cmdp == 'h' || cmdp == 'H') {\r
+ PrintAndLog("Usage: lf t55xx dump <password>");\r
+ PrintAndLog(" sample: lf t55xx dump FFFFFFFF");\r
+ return 0;\r
+ }\r
+\r
+ bool hasPwd = ( strlen(Cmd) > 0);\r
+ \r
+ if ( hasPwd ){\r
+ if (param_gethex(Cmd, 0, pwd, 4)) {\r
+ PrintAndLog("password must include 4 HEX symbols");\r
+ return 0;\r
+ }\r
+ }\r
+\r
+\r
+ for ( int i = 0; i <8; ++i){\r
+ *s = 0;\r
+ if ( hasPwd ) {\r
+ sprintf(s,"%d %d", i, pwd);\r
+ CmdReadBlkPWD(s);\r
+ } else {\r
+ sprintf(s,"%d", i);\r
+ CmdReadBlk(s);\r
+ }\r
+ }\r
+ return 0;\r
+}\r
+\r
char * GetBitRateStr(uint32_t id){\r
static char buf[40];\r
char *retStr = buf;\r
return buf;\r
}\r
\r
-\r
char * GetSaferStr(uint32_t id){\r
static char buf[40];\r
char *retStr = buf;\r
{"wrPWD", CmdWriteBlkPWD, 0, "<Data> <Block> <Password> -- Write T55xx block data in password mode(page 0)"},\r
{"trace", CmdReadTrace, 0, "Read T55xx traceability data (page 1)"},\r
{"info", CmdInfo, 0, "Read T55xx configuration data (page 0 / block 0"},\r
+ {"dump", CmdDump, 0, "Dump T55xx card block 0-7 (is possible)"},\r
{NULL, NULL, 0, NULL}\r
};\r
\r
clock = GetT55x7Clock( data, len, high );
startindex = DetectFirstTransition(data, len, high);
- PrintAndLog(" Clock : %d", clock);
- PrintAndLog(" startindex : %d", startindex);
+ //PrintAndLog(" Clock : %d", clock);
+ //PrintAndLog(" startindex : %d", startindex);
if (high != 1)
bitlength = ManchesterConvertFrom255(data, len, bitStream, high, low, clock, startindex);
else
bitlength= ManchesterConvertFrom1(data, len, bitStream, clock, startindex);
- if ( bitlength > 0 )
- PrintPaddedManchester(bitStream, bitlength, clock);
+ //if ( bitlength > 0 )
+ // PrintPaddedManchester(bitStream, bitlength, clock);
memcpy(dataout, bitStream, bitlength);
default: break;
}
- PrintAndLog(" Found Clock : %d - trying to adjust", clock);
+ //PrintAndLog(" Found Clock : %d - trying to adjust", clock);
// When detected clock is 31 or 33 then then return
int clockmod = clock%8;
startType = -1;
z = startIndex + (i*clock);
isDamp = 0;
-
-
+
/* Find out if we hit both high and low peaks */
for (j = 0; j < clock; j++)
{
// No high value found, are we in a dampening field?
if ( !hithigh ) {
//PrintAndLog(" # Entering damp test at index : %d (%d)", z+j, j);
- for (j = 0; j < clock/2; j++)
+ for (j = 0; j < clock; j++)
{
if (
(data[z+j] <= dampHi && data[z+j] >= dampLow)
){
- isDamp = 1;
+ isDamp++;
}
- else
- isDamp = 0;
}
}
else
dataout[bitIndex++] = 2;
- if ( isDamp ) {
+ if ( isDamp > clock/2 ) {
firstST++;
}