]> git.zerfleddert.de Git - proxmark3-svn/blame_incremental - client/cmdlft55xx.c
ADD: added @pwpiwi 's corrections to "hf mf hardnested"
[proxmark3-svn] / client / cmdlft55xx.c
... / ...
CommitLineData
1//-----------------------------------------------------------------------------\r
2//\r
3// This code is licensed to you under the terms of the GNU GPL, version 2 or,\r
4// at your option, any later version. See the LICENSE.txt file for the text of\r
5// the license.\r
6//-----------------------------------------------------------------------------\r
7// Low frequency T55xx commands\r
8//-----------------------------------------------------------------------------\r
9\r
10#include <stdio.h>\r
11#include <string.h>\r
12#include <inttypes.h>\r
13#include <time.h>\r
14#include "proxmark3.h"\r
15#include "ui.h"\r
16#include "graph.h"\r
17#include "cmdmain.h"\r
18#include "cmdparser.h"\r
19#include "cmddata.h"\r
20#include "cmdlf.h"\r
21#include "cmdlft55xx.h"\r
22#include "util.h"\r
23#include "data.h"\r
24#include "lfdemod.h"\r
25#include "../common/crc.h"\r
26#include "../common/iso14443crc.h"\r
27#include "cmdhf14a.h"\r
28\r
29#define T55x7_CONFIGURATION_BLOCK 0x00\r
30#define T55x7_PAGE0 0x00\r
31#define T55x7_PAGE1 0x01\r
32#define T55x7_PWD 0x00000010\r
33#define REGULAR_READ_MODE_BLOCK 0xFF\r
34\r
35// Default configuration\r
36t55xx_conf_block_t config = { .modulation = DEMOD_ASK, .inverted = FALSE, .offset = 0x00, .block0 = 0x00, .Q5 = FALSE };\r
37\r
38t55xx_conf_block_t Get_t55xx_Config(){\r
39 return config;\r
40}\r
41void Set_t55xx_Config(t55xx_conf_block_t conf){\r
42 config = conf;\r
43}\r
44\r
45int usage_t55xx_config(){\r
46 PrintAndLog("Usage: lf t55xx config [d <demodulation>] [i 1] [o <offset>] [Q5]");\r
47 PrintAndLog("Options:");\r
48 PrintAndLog(" h This help");\r
49 PrintAndLog(" b <8|16|32|40|50|64|100|128> Set bitrate");\r
50 PrintAndLog(" d <FSK|FSK1|FSK1a|FSK2|FSK2a|ASK|PSK1|PSK2|NRZ|BI|BIa> Set demodulation FSK / ASK / PSK / NRZ / Biphase / Biphase A");\r
51 PrintAndLog(" i [1] Invert data signal, defaults to normal");\r
52 PrintAndLog(" o [offset] Set offset, where data should start decode in bitstream");\r
53 PrintAndLog(" Q5 Set as Q5(T5555) chip instead of T55x7");\r
54 PrintAndLog("");\r
55 PrintAndLog("Examples:");\r
56 PrintAndLog(" lf t55xx config d FSK - FSK demodulation");\r
57 PrintAndLog(" lf t55xx config d FSK i 1 - FSK demodulation, inverse data");\r
58 PrintAndLog(" lf t55xx config d FSK i 1 o 3 - FSK demodulation, inverse data, offset=3,start from position 3 to decode data");\r
59 PrintAndLog("");\r
60 return 0;\r
61}\r
62int usage_t55xx_read(){\r
63 PrintAndLog("Usage: lf t55xx read [b <block>] [p <password>] <override_safety> <page1>");\r
64 PrintAndLog("Options:");\r
65 PrintAndLog(" b <block> - block number to read. Between 0-7");\r
66 PrintAndLog(" p <password> - OPTIONAL password (8 hex characters)");\r
67 PrintAndLog(" o - OPTIONAL override safety check");\r
68 PrintAndLog(" 1 - OPTIONAL read Page 1 instead of Page 0");\r
69 PrintAndLog(" ****WARNING****");\r
70 PrintAndLog(" Use of read with password on a tag not configured for a pwd");\r
71 PrintAndLog(" can damage the tag");\r
72 PrintAndLog("");\r
73 PrintAndLog("Examples:");\r
74 PrintAndLog(" lf t55xx read b 0 - read data from block 0");\r
75 PrintAndLog(" lf t55xx read b 0 p feedbeef - read data from block 0 password feedbeef");\r
76 PrintAndLog(" lf t55xx read b 0 p feedbeef o - read data from block 0 password feedbeef safety check");\r
77 PrintAndLog("");\r
78 return 0;\r
79}\r
80int usage_t55xx_write(){\r
81 PrintAndLog("Usage: lf t55xx wr [b <block>] [d <data>] [p <password>] [1]");\r
82 PrintAndLog("Options:");\r
83 PrintAndLog(" b <block> - block number to write. Between 0-7");\r
84 PrintAndLog(" d <data> - 4 bytes of data to write (8 hex characters)");\r
85 PrintAndLog(" p <password> - OPTIONAL password 4bytes (8 hex characters)");\r
86 PrintAndLog(" 1 - OPTIONAL write Page 1 instead of Page 0");\r
87 PrintAndLog("");\r
88 PrintAndLog("Examples:");\r
89 PrintAndLog(" lf t55xx write b 3 d 11223344 - write 11223344 to block 3");\r
90 PrintAndLog(" lf t55xx write b 3 d 11223344 p feedbeef - write 11223344 to block 3 password feedbeef");\r
91 PrintAndLog("");\r
92 return 0;\r
93}\r
94int usage_t55xx_trace() {\r
95 PrintAndLog("Usage: lf t55xx trace [1]");\r
96 PrintAndLog("Options:");\r
97 PrintAndLog(" [graph buffer data] - if set, use Graphbuffer otherwise read data from tag.");\r
98 PrintAndLog("");\r
99 PrintAndLog("Examples:");\r
100 PrintAndLog(" lf t55xx trace");\r
101 PrintAndLog(" lf t55xx trace 1");\r
102 PrintAndLog("");\r
103 return 0;\r
104}\r
105int usage_t55xx_info() {\r
106 PrintAndLog("Usage: lf t55xx info [1]");\r
107 PrintAndLog("Options:");\r
108 PrintAndLog(" [graph buffer data] - if set, use Graphbuffer otherwise read data from tag.");\r
109 PrintAndLog("");\r
110 PrintAndLog("Examples:");\r
111 PrintAndLog(" lf t55xx info");\r
112 PrintAndLog(" lf t55xx info 1");\r
113 PrintAndLog("");\r
114 return 0;\r
115}\r
116int usage_t55xx_dump(){\r
117 PrintAndLog("Usage: lf t55xx dump <password> [o]");\r
118 PrintAndLog("Options:");\r
119 PrintAndLog(" <password> - OPTIONAL password 4bytes (8 hex symbols)");\r
120 PrintAndLog(" o - OPTIONAL override, force pwd read despite danger to card");\r
121 PrintAndLog("");\r
122 PrintAndLog("Examples:");\r
123 PrintAndLog(" lf t55xx dump");\r
124 PrintAndLog(" lf t55xx dump feedbeef o");\r
125 PrintAndLog("");\r
126 return 0;\r
127}\r
128int usage_t55xx_detect(){\r
129 PrintAndLog("Usage: lf t55xx detect [1] [p <password>]");\r
130 PrintAndLog("Options:");\r
131 PrintAndLog(" 1 - if set, use Graphbuffer otherwise read data from tag.");\r
132 PrintAndLog(" p <password> - OPTIONAL password (8 hex characters)");\r
133 PrintAndLog("");\r
134 PrintAndLog("Examples:");\r
135 PrintAndLog(" lf t55xx detect");\r
136 PrintAndLog(" lf t55xx detect 1");\r
137 PrintAndLog(" lf t55xx detect p 11223344");\r
138 PrintAndLog("");\r
139 return 0;\r
140}\r
141int usage_t55xx_wakup(){\r
142 PrintAndLog("Usage: lf t55xx wakeup [h] p <password>");\r
143 PrintAndLog("This commands send the Answer-On-Request command and leaves the readerfield ON afterwards.");\r
144 PrintAndLog("Options:");\r
145 PrintAndLog(" h - this help");\r
146 PrintAndLog(" p <password> - password 4bytes (8 hex symbols)");\r
147 PrintAndLog("");\r
148 PrintAndLog("Examples:");\r
149 PrintAndLog(" lf t55xx wakeup p 11223344 - send wakeup password");\r
150 return 0;\r
151}\r
152int usage_t55xx_bruteforce(){\r
153 PrintAndLog("This command uses A) bruteforce to scan a number range");\r
154 PrintAndLog(" B) a dictionary attack");\r
155 PrintAndLog("Usage: lf t55xx bruteforce <start password> <end password> [i <*.dic>]");\r
156 PrintAndLog(" password must be 4 bytes (8 hex symbols)");\r
157 PrintAndLog("Options:");\r
158 PrintAndLog(" h - this help");\r
159 PrintAndLog(" <start_pwd> - 4 byte hex value to start pwd search at");\r
160 PrintAndLog(" <end_pwd> - 4 byte hex value to end pwd search at");\r
161 PrintAndLog(" i <*.dic> - loads a default keys dictionary file <*.dic>");\r
162 PrintAndLog("");\r
163 PrintAndLog("Examples:");\r
164 PrintAndLog(" lf t55xx bruteforce aaaaaaaa bbbbbbbb");\r
165 PrintAndLog(" lf t55xx bruteforce i default_pwd.dic");\r
166 PrintAndLog("");\r
167 return 0;\r
168}\r
169\r
170static int CmdHelp(const char *Cmd);\r
171\r
172void printT5xxHeader(uint8_t page){\r
173 PrintAndLog("Reading Page %d:", page); \r
174 PrintAndLog("blk | hex data | binary");\r
175 PrintAndLog("----+----------+---------------------------------"); \r
176}\r
177\r
178int CmdT55xxSetConfig(const char *Cmd) {\r
179\r
180 uint8_t offset = 0;\r
181 char modulation[5] = {0x00};\r
182 char tmp = 0x00;\r
183 uint8_t bitRate = 0;\r
184 uint8_t rates[9] = {8,16,32,40,50,64,100,128,0};\r
185 uint8_t cmdp = 0;\r
186 bool errors = FALSE;\r
187 while(param_getchar(Cmd, cmdp) != 0x00 && !errors)\r
188 {\r
189 tmp = param_getchar(Cmd, cmdp);\r
190 switch(tmp)\r
191 {\r
192 case 'h':\r
193 case 'H':\r
194 return usage_t55xx_config();\r
195 case 'b':\r
196 errors |= param_getdec(Cmd, cmdp+1, &bitRate);\r
197 if ( !errors){\r
198 uint8_t i = 0;\r
199 for (; i < 9; i++){\r
200 if (rates[i]==bitRate) {\r
201 config.bitrate = i;\r
202 break;\r
203 }\r
204 }\r
205 if (i==9) errors = TRUE;\r
206 }\r
207 cmdp+=2;\r
208 break;\r
209 case 'd':\r
210 param_getstr(Cmd, cmdp+1, modulation);\r
211 cmdp += 2;\r
212\r
213 if ( strcmp(modulation, "FSK" ) == 0) {\r
214 config.modulation = DEMOD_FSK;\r
215 } else if ( strcmp(modulation, "FSK1" ) == 0) {\r
216 config.modulation = DEMOD_FSK1;\r
217 config.inverted=1;\r
218 } else if ( strcmp(modulation, "FSK1a" ) == 0) {\r
219 config.modulation = DEMOD_FSK1a;\r
220 config.inverted=0;\r
221 } else if ( strcmp(modulation, "FSK2" ) == 0) {\r
222 config.modulation = DEMOD_FSK2;\r
223 config.inverted=0;\r
224 } else if ( strcmp(modulation, "FSK2a" ) == 0) {\r
225 config.modulation = DEMOD_FSK2a;\r
226 config.inverted=1;\r
227 } else if ( strcmp(modulation, "ASK" ) == 0) {\r
228 config.modulation = DEMOD_ASK;\r
229 } else if ( strcmp(modulation, "NRZ" ) == 0) {\r
230 config.modulation = DEMOD_NRZ;\r
231 } else if ( strcmp(modulation, "PSK1" ) == 0) {\r
232 config.modulation = DEMOD_PSK1;\r
233 } else if ( strcmp(modulation, "PSK2" ) == 0) {\r
234 config.modulation = DEMOD_PSK2;\r
235 } else if ( strcmp(modulation, "PSK3" ) == 0) {\r
236 config.modulation = DEMOD_PSK3;\r
237 } else if ( strcmp(modulation, "BIa" ) == 0) {\r
238 config.modulation = DEMOD_BIa;\r
239 config.inverted=1;\r
240 } else if ( strcmp(modulation, "BI" ) == 0) {\r
241 config.modulation = DEMOD_BI;\r
242 config.inverted=0;\r
243 } else {\r
244 PrintAndLog("Unknown modulation '%s'", modulation);\r
245 errors = TRUE;\r
246 }\r
247 break;\r
248 case 'i':\r
249 config.inverted = param_getchar(Cmd,cmdp+1) == '1';\r
250 cmdp+=2;\r
251 break;\r
252 case 'o':\r
253 errors |= param_getdec(Cmd, cmdp+1, &offset);\r
254 if ( !errors )\r
255 config.offset = offset;\r
256 cmdp+=2;\r
257 break;\r
258 case 'Q':\r
259 case 'q': \r
260 config.Q5 = TRUE;\r
261 cmdp++;\r
262 break;\r
263 default:\r
264 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r
265 errors = TRUE;\r
266 break;\r
267 }\r
268 }\r
269\r
270 // No args\r
271 if (cmdp == 0) return printConfiguration( config );\r
272\r
273 //Validations\r
274 if (errors) return usage_t55xx_config();\r
275\r
276 config.block0 = 0;\r
277 return printConfiguration ( config );\r
278}\r
279\r
280int T55xxReadBlock(uint8_t block, bool page1, bool usepwd, bool override, uint32_t password){\r
281 //Password mode\r
282 if ( usepwd ) {\r
283 // try reading the config block and verify that PWD bit is set before doing this!\r
284 if ( !override ) {\r
285 \r
286 if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, false, 0 ) ) return 0;\r
287 \r
288 if ( !tryDetectModulation() ) {\r
289 PrintAndLog("Safety Check: Could not detect if PWD bit is set in config block. Exits.");\r
290 return 0;\r
291 } else {\r
292 PrintAndLog("Safety Check: PWD bit is NOT set in config block. Reading without password..."); \r
293 usepwd = false;\r
294 page1 = false;\r
295 }\r
296 } else {\r
297 PrintAndLog("Safety Check Overriden - proceeding despite risk");\r
298 }\r
299 }\r
300\r
301 if (!AquireData(page1, block, usepwd, password) ) return 0;\r
302 if (!DecodeT55xxBlock()) return 0;\r
303\r
304 char blk[10]={0};\r
305 sprintf(blk,"%02d", block);\r
306 printT55xxBlock(blk); \r
307 return 1;\r
308}\r
309\r
310int CmdT55xxReadBlock(const char *Cmd) {\r
311 uint8_t block = REGULAR_READ_MODE_BLOCK;\r
312 uint32_t password = 0; //default to blank Block 7\r
313 bool usepwd = false;\r
314 bool override = false;\r
315 bool page1 = false;\r
316 bool errors = false;\r
317 uint8_t cmdp = 0;\r
318 while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {\r
319 switch(param_getchar(Cmd, cmdp)) {\r
320 case 'h':\r
321 case 'H':\r
322 return usage_t55xx_read();\r
323 case 'b':\r
324 case 'B':\r
325 errors |= param_getdec(Cmd, cmdp+1, &block);\r
326 cmdp += 2;\r
327 break;\r
328 case 'o':\r
329 case 'O':\r
330 override = TRUE;\r
331 cmdp++;\r
332 break;\r
333 case 'p':\r
334 case 'P':\r
335 password = param_get32ex(Cmd, cmdp+1, 0, 16);\r
336 usepwd = true;\r
337 cmdp += 2;\r
338 break;\r
339 case '1':\r
340 page1 = true;\r
341 cmdp++;\r
342 break;\r
343 default:\r
344 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r
345 errors = true;\r
346 break;\r
347 }\r
348 }\r
349 if (errors) return usage_t55xx_read();\r
350\r
351 if (block > 7 && block != REGULAR_READ_MODE_BLOCK ) {\r
352 PrintAndLog("Block must be between 0 and 7");\r
353 return 0;\r
354 }\r
355\r
356 printT5xxHeader(page1);\r
357 return T55xxReadBlock(block, page1, usepwd, override, password);\r
358}\r
359\r
360bool DecodeT55xxBlock(){\r
361 \r
362 char buf[30] = {0x00};\r
363 char *cmdStr = buf;\r
364 int ans = 0;\r
365 uint8_t bitRate[8] = {8,16,32,40,50,64,100,128};\r
366 DemodBufferLen = 0x00;\r
367\r
368 switch( config.modulation ){\r
369 case DEMOD_FSK:\r
370 snprintf(cmdStr, sizeof(buf),"%d %d", bitRate[config.bitrate], config.inverted );\r
371 ans = FSKrawDemod(cmdStr, FALSE);\r
372 break;\r
373 case DEMOD_FSK1:\r
374 case DEMOD_FSK1a:\r
375 snprintf(cmdStr, sizeof(buf),"%d %d 8 5", bitRate[config.bitrate], config.inverted );\r
376 ans = FSKrawDemod(cmdStr, FALSE);\r
377 break;\r
378 case DEMOD_FSK2:\r
379 case DEMOD_FSK2a:\r
380 snprintf(cmdStr, sizeof(buf),"%d %d 10 8", bitRate[config.bitrate], config.inverted );\r
381 ans = FSKrawDemod(cmdStr, FALSE);\r
382 break;\r
383 case DEMOD_ASK:\r
384 snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted );\r
385 ans = ASKDemod(cmdStr, FALSE, FALSE, 1);\r
386 break;\r
387 case DEMOD_PSK1:\r
388 // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)\r
389 save_restoreGB(1);\r
390 CmdLtrim("160");\r
391 snprintf(cmdStr, sizeof(buf),"%d %d 6", bitRate[config.bitrate], config.inverted );\r
392 ans = PSKDemod(cmdStr, FALSE);\r
393 //undo trim samples\r
394 save_restoreGB(0);\r
395 break;\r
396 case DEMOD_PSK2: //inverted won't affect this\r
397 case DEMOD_PSK3: //not fully implemented\r
398 // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)\r
399 save_restoreGB(1);\r
400 CmdLtrim("160");\r
401 snprintf(cmdStr, sizeof(buf),"%d 0 6", bitRate[config.bitrate] );\r
402 ans = PSKDemod(cmdStr, FALSE);\r
403 psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
404 //undo trim samples\r
405 save_restoreGB(0);\r
406 break;\r
407 case DEMOD_NRZ:\r
408 snprintf(cmdStr, sizeof(buf),"%d %d 1", bitRate[config.bitrate], config.inverted );\r
409 ans = NRZrawDemod(cmdStr, FALSE);\r
410 break;\r
411 case DEMOD_BI:\r
412 case DEMOD_BIa:\r
413 snprintf(cmdStr, sizeof(buf),"0 %d %d 1", bitRate[config.bitrate], config.inverted );\r
414 ans = ASKbiphaseDemod(cmdStr, FALSE);\r
415 break;\r
416 default:\r
417 return FALSE;\r
418 }\r
419 return (bool) ans;\r
420}\r
421\r
422bool DecodeT5555TraceBlock() {\r
423 DemodBufferLen = 0x00;\r
424 \r
425 // According to datasheet. Always: RF/64, not inverted, Manchester\r
426 return (bool) ASKDemod("64 0 1", FALSE, FALSE, 1);\r
427}\r
428\r
429\r
430int CmdT55xxDetect(const char *Cmd){\r
431 bool errors = FALSE;\r
432 bool useGB = FALSE;\r
433 bool usepwd = FALSE;\r
434 uint32_t password = 0;\r
435 uint8_t cmdp = 0;\r
436\r
437 while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {\r
438 switch(param_getchar(Cmd, cmdp)) {\r
439 case 'h':\r
440 case 'H':\r
441 return usage_t55xx_detect();\r
442 case 'p':\r
443 case 'P':\r
444 password = param_get32ex(Cmd, cmdp+1, 0, 16);\r
445 usepwd = TRUE;\r
446 cmdp += 2;\r
447 break;\r
448 case '1':\r
449 // use Graphbuffer data\r
450 useGB = TRUE;\r
451 cmdp++;\r
452 break;\r
453 default:\r
454 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r
455 errors = true;\r
456 break;\r
457 }\r
458 }\r
459 if (errors) return usage_t55xx_detect();\r
460 \r
461 if ( !useGB) {\r
462 if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, usepwd, password) )\r
463 return 0;\r
464 }\r
465 \r
466 if ( !tryDetectModulation() )\r
467 PrintAndLog("Could not detect modulation automatically. Try setting it manually with \'lf t55xx config\'");\r
468\r
469 return 1;\r
470}\r
471\r
472// detect configuration?\r
473bool tryDetectModulation(){\r
474 uint8_t hits = 0;\r
475 t55xx_conf_block_t tests[15];\r
476 int bitRate=0;\r
477 uint8_t fc1 = 0, fc2 = 0, clk=0;\r
478 \r
479 if (GetFskClock("", FALSE, FALSE)){ \r
480 fskClocks(&fc1, &fc2, &clk, FALSE);\r
481 if ( FSKrawDemod("0 0", FALSE) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){\r
482 tests[hits].modulation = DEMOD_FSK;\r
483 if (fc1==8 && fc2 == 5)\r
484 tests[hits].modulation = DEMOD_FSK1a;\r
485 else if (fc1==10 && fc2 == 8)\r
486 tests[hits].modulation = DEMOD_FSK2;\r
487 tests[hits].bitrate = bitRate;\r
488 tests[hits].inverted = FALSE;\r
489 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
490 ++hits;\r
491 }\r
492 if ( FSKrawDemod("0 1", FALSE) && test(DEMOD_FSK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
493 tests[hits].modulation = DEMOD_FSK;\r
494 if (fc1 == 8 && fc2 == 5)\r
495 tests[hits].modulation = DEMOD_FSK1;\r
496 else if (fc1 == 10 && fc2 == 8)\r
497 tests[hits].modulation = DEMOD_FSK2a;\r
498 tests[hits].bitrate = bitRate;\r
499 tests[hits].inverted = TRUE;\r
500 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
501 ++hits;\r
502 }\r
503 } else {\r
504 clk = GetAskClock("", FALSE, FALSE);\r
505 if (clk>0) {\r
506 if ( ASKDemod("0 0 1", FALSE, FALSE, 1) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
507 tests[hits].modulation = DEMOD_ASK;\r
508 tests[hits].bitrate = bitRate;\r
509 tests[hits].inverted = FALSE;\r
510 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
511 ++hits;\r
512 }\r
513 if ( ASKDemod("0 1 1", FALSE, FALSE, 1) && test(DEMOD_ASK, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
514 tests[hits].modulation = DEMOD_ASK;\r
515 tests[hits].bitrate = bitRate;\r
516 tests[hits].inverted = TRUE;\r
517 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
518 ++hits;\r
519 }\r
520 if ( ASKbiphaseDemod("0 0 0 2", FALSE) && test(DEMOD_BI, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5) ) {\r
521 tests[hits].modulation = DEMOD_BI;\r
522 tests[hits].bitrate = bitRate;\r
523 tests[hits].inverted = FALSE;\r
524 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
525 ++hits;\r
526 }\r
527 if ( ASKbiphaseDemod("0 0 1 2", FALSE) && test(DEMOD_BIa, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5) ) {\r
528 tests[hits].modulation = DEMOD_BIa;\r
529 tests[hits].bitrate = bitRate;\r
530 tests[hits].inverted = TRUE;\r
531 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
532 ++hits;\r
533 }\r
534 }\r
535 //undo trim from ask\r
536 //save_restoreGB(0);\r
537 clk = GetNrzClock("", FALSE, FALSE);\r
538 if (clk>0) {\r
539 if ( NRZrawDemod("0 0 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
540 tests[hits].modulation = DEMOD_NRZ;\r
541 tests[hits].bitrate = bitRate;\r
542 tests[hits].inverted = FALSE;\r
543 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
544 ++hits;\r
545 }\r
546\r
547 if ( NRZrawDemod("0 1 1", FALSE) && test(DEMOD_NRZ, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
548 tests[hits].modulation = DEMOD_NRZ;\r
549 tests[hits].bitrate = bitRate;\r
550 tests[hits].inverted = TRUE;\r
551 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
552 ++hits;\r
553 }\r
554 }\r
555 \r
556 // allow undo\r
557 // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise)\r
558 save_restoreGB(1);\r
559 CmdLtrim("160");\r
560 clk = GetPskClock("", FALSE, FALSE);\r
561 if (clk>0) {\r
562 if ( PSKDemod("0 0 6", FALSE) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
563 tests[hits].modulation = DEMOD_PSK1;\r
564 tests[hits].bitrate = bitRate;\r
565 tests[hits].inverted = FALSE;\r
566 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
567 ++hits;\r
568 }\r
569 if ( PSKDemod("0 1 6", FALSE) && test(DEMOD_PSK1, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)) {\r
570 tests[hits].modulation = DEMOD_PSK1;\r
571 tests[hits].bitrate = bitRate;\r
572 tests[hits].inverted = TRUE;\r
573 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
574 ++hits;\r
575 }\r
576 // PSK2 - needs a call to psk1TOpsk2.\r
577 if ( PSKDemod("0 0 6", FALSE)) {\r
578 psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
579 if (test(DEMOD_PSK2, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){\r
580 tests[hits].modulation = DEMOD_PSK2;\r
581 tests[hits].bitrate = bitRate;\r
582 tests[hits].inverted = FALSE;\r
583 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
584 ++hits;\r
585 }\r
586 } // inverse waves does not affect this demod\r
587 // PSK3 - needs a call to psk1TOpsk2.\r
588 if ( PSKDemod("0 0 6", FALSE)) {\r
589 psk1TOpsk2(DemodBuffer, DemodBufferLen);\r
590 if (test(DEMOD_PSK3, &tests[hits].offset, &bitRate, clk, &tests[hits].Q5)){\r
591 tests[hits].modulation = DEMOD_PSK3;\r
592 tests[hits].bitrate = bitRate;\r
593 tests[hits].inverted = FALSE;\r
594 tests[hits].block0 = PackBits(tests[hits].offset, 32, DemodBuffer);\r
595 ++hits;\r
596 }\r
597 } // inverse waves does not affect this demod\r
598 }\r
599 //undo trim samples\r
600 save_restoreGB(0);\r
601 } \r
602 if ( hits == 1) {\r
603 config.modulation = tests[0].modulation;\r
604 config.bitrate = tests[0].bitrate;\r
605 config.inverted = tests[0].inverted;\r
606 config.offset = tests[0].offset;\r
607 config.block0 = tests[0].block0;\r
608 config.Q5 = tests[0].Q5;\r
609 printConfiguration( config );\r
610 return TRUE;\r
611 }\r
612 \r
613 if ( hits > 1) {\r
614 PrintAndLog("Found [%d] possible matches for modulation.",hits);\r
615 for(int i=0; i<hits; ++i){\r
616 PrintAndLog("--[%d]---------------", i+1);\r
617 printConfiguration( tests[i] );\r
618 }\r
619 }\r
620 return FALSE;\r
621}\r
622\r
623bool testModulation(uint8_t mode, uint8_t modread){\r
624 switch( mode ){\r
625 case DEMOD_FSK:\r
626 if (modread >= DEMOD_FSK1 && modread <= DEMOD_FSK2a) return TRUE;\r
627 break;\r
628 case DEMOD_ASK:\r
629 if (modread == DEMOD_ASK) return TRUE;\r
630 break;\r
631 case DEMOD_PSK1:\r
632 if (modread == DEMOD_PSK1) return TRUE;\r
633 break;\r
634 case DEMOD_PSK2:\r
635 if (modread == DEMOD_PSK2) return TRUE;\r
636 break;\r
637 case DEMOD_PSK3:\r
638 if (modread == DEMOD_PSK3) return TRUE;\r
639 break;\r
640 case DEMOD_NRZ:\r
641 if (modread == DEMOD_NRZ) return TRUE;\r
642 break;\r
643 case DEMOD_BI:\r
644 if (modread == DEMOD_BI) return TRUE;\r
645 break;\r
646 case DEMOD_BIa:\r
647 if (modread == DEMOD_BIa) return TRUE;\r
648 break; \r
649 default:\r
650 return FALSE;\r
651 }\r
652 return FALSE;\r
653}\r
654\r
655bool testQ5Modulation(uint8_t mode, uint8_t modread){\r
656 switch( mode ){\r
657 case DEMOD_FSK:\r
658 if (modread >= 4 && modread <= 5) return TRUE;\r
659 break;\r
660 case DEMOD_ASK:\r
661 if (modread == 0) return TRUE;\r
662 break;\r
663 case DEMOD_PSK1:\r
664 if (modread == 1) return TRUE;\r
665 break;\r
666 case DEMOD_PSK2:\r
667 if (modread == 2) return TRUE;\r
668 break;\r
669 case DEMOD_PSK3:\r
670 if (modread == 3) return TRUE;\r
671 break;\r
672 case DEMOD_NRZ:\r
673 if (modread == 7) return TRUE;\r
674 break;\r
675 case DEMOD_BI:\r
676 if (modread == 6) return TRUE;\r
677 break;\r
678 default:\r
679 return FALSE;\r
680 }\r
681 return FALSE;\r
682}\r
683\r
684int convertQ5bitRate(uint8_t bitRateRead) {\r
685 uint8_t expected[] = {8, 16, 32, 40, 50, 64, 100, 128};\r
686 for (int i=0; i<8; i++)\r
687 if (expected[i] == bitRateRead)\r
688 return i;\r
689\r
690 return -1;\r
691}\r
692\r
693bool testQ5(uint8_t mode, uint8_t *offset, int *fndBitRate, uint8_t clk){\r
694\r
695 if ( DemodBufferLen < 64 ) return FALSE;\r
696 uint8_t si = 0;\r
697 for (uint8_t idx = 28; idx < 64; idx++){\r
698 si = idx;\r
699 if ( PackBits(si, 28, DemodBuffer) == 0x00 ) continue;\r
700\r
701 uint8_t safer = PackBits(si, 4, DemodBuffer); si += 4; //master key\r
702 uint8_t resv = PackBits(si, 8, DemodBuffer); si += 8;\r
703 // 2nibble must be zeroed.\r
704 if (safer != 0x6 && safer != 0x9) continue;\r
705 if ( resv > 0x00) continue;\r
706 //uint8_t pageSel = PackBits(si, 1, DemodBuffer); si += 1;\r
707 //uint8_t fastWrite = PackBits(si, 1, DemodBuffer); si += 1;\r
708 si += 1+1;\r
709 int bitRate = PackBits(si, 6, DemodBuffer)*2 + 2; si += 6; //bit rate\r
710 if (bitRate > 128 || bitRate < 8) continue;\r
711\r
712 //uint8_t AOR = PackBits(si, 1, DemodBuffer); si += 1; \r
713 //uint8_t PWD = PackBits(si, 1, DemodBuffer); si += 1; \r
714 //uint8_t pskcr = PackBits(si, 2, DemodBuffer); si += 2; //could check psk cr\r
715 //uint8_t inverse = PackBits(si, 1, DemodBuffer); si += 1;\r
716 si += 1+1+2+1;\r
717 uint8_t modread = PackBits(si, 3, DemodBuffer); si += 3;\r
718 uint8_t maxBlk = PackBits(si, 3, DemodBuffer); si += 3;\r
719 //uint8_t ST = PackBits(si, 1, DemodBuffer); si += 1;\r
720 if (maxBlk == 0) continue;\r
721 //test modulation\r
722 if (!testQ5Modulation(mode, modread)) continue;\r
723 if (bitRate != clk) continue;\r
724 *fndBitRate = convertQ5bitRate(bitRate);\r
725 if (*fndBitRate < 0) continue;\r
726 *offset = idx;\r
727\r
728 return TRUE;\r
729 }\r
730 return FALSE;\r
731}\r
732\r
733bool testBitRate(uint8_t readRate, uint8_t clk){\r
734 uint8_t expected[] = {8, 16, 32, 40, 50, 64, 100, 128};\r
735 if (expected[readRate] == clk)\r
736 return true;\r
737\r
738 return false;\r
739}\r
740\r
741bool test(uint8_t mode, uint8_t *offset, int *fndBitRate, uint8_t clk, bool *Q5){\r
742\r
743 if ( DemodBufferLen < 64 ) return FALSE;\r
744 uint8_t si = 0;\r
745 for (uint8_t idx = 28; idx < 64; idx++){\r
746 si = idx;\r
747 if ( PackBits(si, 28, DemodBuffer) == 0x00 ) continue;\r
748\r
749 uint8_t safer = PackBits(si, 4, DemodBuffer); si += 4; //master key\r
750 uint8_t resv = PackBits(si, 4, DemodBuffer); si += 4; //was 7 & +=7+3 //should be only 4 bits if extended mode\r
751 // 2nibble must be zeroed.\r
752 // moved test to here, since this gets most faults first.\r
753 if ( resv > 0x00) continue;\r
754\r
755 uint8_t xtRate = PackBits(si, 3, DemodBuffer); si += 3; //extended mode part of rate\r
756 int bitRate = PackBits(si, 3, DemodBuffer); si += 3; //bit rate\r
757 if (bitRate > 7) continue;\r
758 uint8_t extend = PackBits(si, 1, DemodBuffer); si += 1; //bit 15 extended mode\r
759 uint8_t modread = PackBits(si, 5, DemodBuffer); si += 5+2+1; \r
760 //uint8_t pskcr = PackBits(si, 2, DemodBuffer); si += 2+1; //could check psk cr\r
761 uint8_t nml01 = PackBits(si, 1, DemodBuffer); si += 1+5; //bit 24, 30, 31 could be tested for 0 if not extended mode\r
762 uint8_t nml02 = PackBits(si, 2, DemodBuffer); si += 2;\r
763 \r
764 //if extended mode\r
765 bool extMode =( (safer == 0x6 || safer == 0x9) && extend) ? TRUE : FALSE;\r
766\r
767 if (!extMode){\r
768 if (nml01 || nml02 || xtRate) continue;\r
769 }\r
770 //test modulation\r
771 if (!testModulation(mode, modread)) continue;\r
772 if (!testBitRate(bitRate, clk)) continue;\r
773 *fndBitRate = bitRate;\r
774 *offset = idx;\r
775 *Q5 = FALSE;\r
776 return TRUE;\r
777 }\r
778 if (testQ5(mode, offset, fndBitRate, clk)) {\r
779 *Q5 = TRUE;\r
780 return TRUE;\r
781 }\r
782 return FALSE;\r
783}\r
784\r
785void printT55xxBlock(const char *blockNum){\r
786 \r
787 uint8_t i = config.offset;\r
788 uint8_t endpos = 32 + i;\r
789 uint32_t blockData = 0;\r
790 uint8_t bits[64] = {0x00};\r
791\r
792 if ( !DemodBufferLen) return;\r
793\r
794 if ( endpos > DemodBufferLen){\r
795 PrintAndLog("The configured offset %d is too big. Possible offset: %d)", i, DemodBufferLen-32);\r
796 return;\r
797 }\r
798\r
799 for (; i < endpos; ++i)\r
800 bits[i - config.offset] = DemodBuffer[i];\r
801\r
802 blockData = PackBits(0, 32, bits);\r
803\r
804 PrintAndLog(" %s | %08X | %s", blockNum, blockData, sprint_bin(bits,32));\r
805}\r
806\r
807int special(const char *Cmd) {\r
808 uint32_t blockData = 0;\r
809 uint8_t bits[32] = {0x00};\r
810\r
811 PrintAndLog("OFFSET | DATA | BINARY");\r
812 PrintAndLog("----------------------------------------------------");\r
813 int i,j = 0;\r
814 for (; j < 64; ++j){\r
815 \r
816 for (i = 0; i < 32; ++i)\r
817 bits[i]=DemodBuffer[j+i];\r
818 \r
819 blockData = PackBits(0, 32, bits);\r
820 \r
821 PrintAndLog("%02d | 0x%08X | %s",j , blockData, sprint_bin(bits,32)); \r
822 }\r
823 return 0;\r
824}\r
825\r
826int printConfiguration( t55xx_conf_block_t b){\r
827 PrintAndLog("Chip Type : %s", (b.Q5) ? "T5555(Q5)" : "T55x7");\r
828 PrintAndLog("Modulation : %s", GetSelectedModulationStr(b.modulation) );\r
829 PrintAndLog("Bit Rate : %s", GetBitRateStr(b.bitrate) );\r
830 PrintAndLog("Inverted : %s", (b.inverted) ? "Yes" : "No" );\r
831 PrintAndLog("Offset : %d", b.offset);\r
832 PrintAndLog("Block0 : 0x%08X", b.block0);\r
833 PrintAndLog("");\r
834 return 0;\r
835}\r
836\r
837int CmdT55xxWakeUp(const char *Cmd) {\r
838 uint32_t password = 0;\r
839 uint8_t cmdp = 0;\r
840 bool errors = false;\r
841 while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {\r
842 switch(param_getchar(Cmd, cmdp)) {\r
843 case 'h':\r
844 case 'H':\r
845 return usage_t55xx_wakup();\r
846 case 'p':\r
847 case 'P':\r
848 password = param_get32ex(Cmd, cmdp+1, 0, 16);\r
849 cmdp += 2;\r
850 errors = false;\r
851 break;\r
852 default:\r
853 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r
854 errors = true;\r
855 break;\r
856 }\r
857 }\r
858 if (errors) return usage_t55xx_wakup();\r
859\r
860 UsbCommand c = {CMD_T55XX_WAKEUP, {password, 0, 0}};\r
861 clearCommandBuffer();\r
862 SendCommand(&c);\r
863 PrintAndLog("Wake up command sent. Try read now");\r
864 return 0;\r
865}\r
866\r
867int CmdT55xxWriteBlock(const char *Cmd) {\r
868 uint8_t block = 0xFF; //default to invalid block\r
869 uint32_t data = 0; //default to blank Block \r
870 uint32_t password = 0; //default to blank Block 7\r
871 bool usepwd = false;\r
872 bool page1 = false; \r
873 bool gotdata = false;\r
874 bool errors = false;\r
875 uint8_t cmdp = 0;\r
876 while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {\r
877 switch(param_getchar(Cmd, cmdp)) {\r
878 case 'h':\r
879 case 'H':\r
880 return usage_t55xx_write();\r
881 case 'b':\r
882 case 'B':\r
883 errors |= param_getdec(Cmd, cmdp+1, &block);\r
884 cmdp += 2;\r
885 break;\r
886 case 'd':\r
887 case 'D':\r
888 data = param_get32ex(Cmd, cmdp+1, 0, 16);\r
889 gotdata = true;\r
890 cmdp += 2;\r
891 break;\r
892 case 'p':\r
893 case 'P':\r
894 password = param_get32ex(Cmd, cmdp+1, 0, 16);\r
895 usepwd = true;\r
896 cmdp += 2;\r
897 break;\r
898 case '1':\r
899 page1 = true;\r
900 cmdp++;\r
901 break;\r
902 default:\r
903 PrintAndLog("Unknown parameter '%c'", param_getchar(Cmd, cmdp));\r
904 errors = true;\r
905 break;\r
906 }\r
907 }\r
908 if (errors || !gotdata) return usage_t55xx_write();\r
909\r
910 if (block > 7) {\r
911 PrintAndLog("Block number must be between 0 and 7");\r
912 return 0;\r
913 }\r
914 \r
915 UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {data, block, 0}};\r
916 UsbCommand resp;\r
917 c.d.asBytes[0] = (page1) ? 0x2 : 0; \r
918\r
919 char pwdStr[16] = {0};\r
920 snprintf(pwdStr, sizeof(pwdStr), "pwd: 0x%08X", password);\r
921 \r
922 PrintAndLog("Writing page %d block: %02d data: 0x%08X %s", page1, block, data, (usepwd) ? pwdStr : "" );\r
923\r
924 //Password mode\r
925 if (usepwd) {\r
926 c.arg[2] = password;\r
927 c.d.asBytes[0] |= 0x1; \r
928 }\r
929 clearCommandBuffer();\r
930 SendCommand(&c);\r
931 if (!WaitForResponseTimeout(CMD_ACK, &resp, 1000)){\r
932 PrintAndLog("Error occurred, device did not ACK write operation. (May be due to old firmware)");\r
933 return 0;\r
934 }\r
935 return 1;\r
936}\r
937\r
938int CmdT55xxReadTrace(const char *Cmd) {\r
939 char cmdp = param_getchar(Cmd, 0);\r
940 bool pwdmode = false;\r
941 uint32_t password = 0; \r
942 if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') return usage_t55xx_trace();\r
943\r
944 if (strlen(Cmd)==0)\r
945 if ( !AquireData( T55x7_PAGE1, REGULAR_READ_MODE_BLOCK, pwdmode, password ) )\r
946 return 0;\r
947\r
948 if ( config.Q5 ){\r
949 if (!DecodeT5555TraceBlock()) return 0;\r
950 }\r
951 else {\r
952 if (!DecodeT55xxBlock()) return 0;\r
953 }\r
954 \r
955 if ( !DemodBufferLen ) return 0;\r
956 \r
957 RepaintGraphWindow();\r
958 uint8_t repeat = (config.offset > 5) ? 32 : 0;\r
959 \r
960 uint8_t si = config.offset + repeat;\r
961 uint32_t bl1 = PackBits(si, 32, DemodBuffer);\r
962 uint32_t bl2 = PackBits(si+32, 32, DemodBuffer); \r
963 \r
964 if (config.Q5) {\r
965 uint32_t hdr = PackBits(si, 9, DemodBuffer); si += 9;\r
966 \r
967 if (hdr != 0x1FF) {\r
968 PrintAndLog("Invalid Q5 Trace data header (expected 0x1FF, found %X)", hdr);\r
969 return 0;\r
970 }\r
971 \r
972 t5555_tracedata_t data = {.bl1 = bl1, .bl2 = bl2, .icr = 0, .lotidc = '?', .lotid = 0, .wafer = 0, .dw =0};\r
973 \r
974 data.icr = PackBits(si, 2, DemodBuffer); si += 2;\r
975 data.lotidc = 'Z' - PackBits(si, 2, DemodBuffer); si += 3;\r
976 \r
977 data.lotid = PackBits(si, 4, DemodBuffer); si += 5;\r
978 data.lotid <<= 4;\r
979 data.lotid |= PackBits(si, 4, DemodBuffer); si += 5;\r
980 data.lotid <<= 4;\r
981 data.lotid |= PackBits(si, 4, DemodBuffer); si += 5;\r
982 data.lotid <<= 4;\r
983 data.lotid |= PackBits(si, 4, DemodBuffer); si += 5;\r
984 data.lotid <<= 1;\r
985 data.lotid |= PackBits(si, 1, DemodBuffer); si += 1;\r
986 \r
987 data.wafer = PackBits(si, 3, DemodBuffer); si += 4;\r
988 data.wafer <<= 2;\r
989 data.wafer |= PackBits(si, 2, DemodBuffer); si += 2;\r
990 \r
991 data.dw = PackBits(si, 2, DemodBuffer); si += 3;\r
992 data.dw <<= 4;\r
993 data.dw |= PackBits(si, 4, DemodBuffer); si += 5;\r
994 data.dw <<= 4;\r
995 data.dw |= PackBits(si, 4, DemodBuffer); si += 5;\r
996 data.dw <<= 4;\r
997 data.dw |= PackBits(si, 4, DemodBuffer); si += 5;\r
998 \r
999 printT5555Trace(data, repeat);\r
1000 \r
1001 } else {\r
1002 \r
1003 t55xx_tracedata_t data = {.bl1 = bl1, .bl2 = bl2, .acl = 0, .mfc = 0, .cid = 0, .year = 0, .quarter = 0, .icr = 0, .lotid = 0, .wafer = 0, .dw = 0};\r
1004 \r
1005 data.acl = PackBits(si, 8, DemodBuffer); si += 8;\r
1006 if ( data.acl != 0xE0 ) {\r
1007 PrintAndLog("The modulation is most likely wrong since the ACL is not 0xE0. ");\r
1008 return 0;\r
1009 }\r
1010\r
1011 data.mfc = PackBits(si, 8, DemodBuffer); si += 8;\r
1012 data.cid = PackBits(si, 5, DemodBuffer); si += 5;\r
1013 data.icr = PackBits(si, 3, DemodBuffer); si += 3;\r
1014 data.year = PackBits(si, 4, DemodBuffer); si += 4;\r
1015 data.quarter = PackBits(si, 2, DemodBuffer); si += 2;\r
1016 data.lotid = PackBits(si, 14, DemodBuffer); si += 14;\r
1017 data.wafer = PackBits(si, 5, DemodBuffer); si += 5;\r
1018 data.dw = PackBits(si, 15, DemodBuffer); \r
1019\r
1020 time_t t = time(NULL);\r
1021 struct tm tm = *localtime(&t);\r
1022 if ( data.year > tm.tm_year-110)\r
1023 data.year += 2000;\r
1024 else\r
1025 data.year += 2010;\r
1026\r
1027 \r
1028 printT55xxTrace(data, repeat);\r
1029 }\r
1030 return 0;\r
1031}\r
1032\r
1033void printT55xxTrace( t55xx_tracedata_t data, uint8_t repeat ){\r
1034 PrintAndLog("-- T55xx Trace Information ----------------------------------");\r
1035 PrintAndLog("-------------------------------------------------------------");\r
1036 PrintAndLog(" ACL Allocation class (ISO/IEC 15963-1) : 0x%02X (%d)", data.acl, data.acl);\r
1037 PrintAndLog(" MFC Manufacturer ID (ISO/IEC 7816-6) : 0x%02X (%d) - %s", data.mfc, data.mfc, getTagInfo(data.mfc));\r
1038 PrintAndLog(" CID : 0x%02X (%d) - %s", data.cid, data.cid, GetModelStrFromCID(data.cid));\r
1039 PrintAndLog(" ICR IC Revision : %d", data.icr );\r
1040 PrintAndLog(" Manufactured");\r
1041 PrintAndLog(" Year/Quarter : %d/%d", data.year, data.quarter);\r
1042 PrintAndLog(" Lot ID : %d", data.lotid );\r
1043 PrintAndLog(" Wafer number : %d", data.wafer);\r
1044 PrintAndLog(" Die Number : %d", data.dw);\r
1045 PrintAndLog("-------------------------------------------------------------");\r
1046 PrintAndLog(" Raw Data - Page 1");\r
1047 PrintAndLog(" Block 1 : 0x%08X %s", data.bl1, sprint_bin(DemodBuffer+config.offset+repeat,32) );\r
1048 PrintAndLog(" Block 2 : 0x%08X %s", data.bl2, sprint_bin(DemodBuffer+config.offset+repeat+32,32) );\r
1049 PrintAndLog("-------------------------------------------------------------"); \r
1050\r
1051 /*\r
1052 TRACE - BLOCK O\r
1053 Bits Definition HEX\r
1054 1-8 ACL Allocation class (ISO/IEC 15963-1) 0xE0 \r
1055 9-16 MFC Manufacturer ID (ISO/IEC 7816-6) 0x15 Atmel Corporation\r
1056 17-21 CID 0x1 = Atmel ATA5577M1 0x2 = Atmel ATA5577M2 \r
1057 22-24 ICR IC revision\r
1058 25-28 YEAR (BCD encoded) 9 (= 2009)\r
1059 29-30 QUARTER 1,2,3,4 \r
1060 31-32 LOT ID\r
1061 \r
1062 TRACE - BLOCK 1\r
1063 1-12 LOT ID \r
1064 13-17 Wafer number\r
1065 18-32 DW, die number sequential\r
1066 */\r
1067}\r
1068void printT5555Trace( t5555_tracedata_t data, uint8_t repeat ){\r
1069 PrintAndLog("-- T5555 (Q5) Trace Information -----------------------------");\r
1070 PrintAndLog("-------------------------------------------------------------");\r
1071 PrintAndLog(" ICR IC Revision : %d", data.icr ); \r
1072 PrintAndLog(" Lot : %c%d", data.lotidc, data.lotid);\r
1073 PrintAndLog(" Wafer number : %d", data.wafer);\r
1074 PrintAndLog(" Die Number : %d", data.dw);\r
1075 PrintAndLog("-------------------------------------------------------------");\r
1076 PrintAndLog(" Raw Data - Page 1");\r
1077 PrintAndLog(" Block 1 : 0x%08X %s", data.bl1, sprint_bin(DemodBuffer+config.offset+repeat,32) );\r
1078 PrintAndLog(" Block 2 : 0x%08X %s", data.bl2, sprint_bin(DemodBuffer+config.offset+repeat+32,32) );\r
1079 \r
1080 /*\r
1081 ** Q5 **\r
1082 TRACE - BLOCK O and BLOCK1\r
1083 Bits Definition HEX\r
1084 1-9 Header 0x1FF\r
1085 10-11 IC Revision\r
1086 12-13 Lot ID char\r
1087 15-35 Lot ID (NB parity)\r
1088 36-41 Wafer number (NB parity)\r
1089 42-58 DW, die number sequential (NB parity)\r
1090 60-63 Parity bits\r
1091 64 Always zero\r
1092 */\r
1093}\r
1094\r
1095int CmdT55xxInfo(const char *Cmd){\r
1096 /*\r
1097 Page 0 Block 0 Configuration data.\r
1098 Normal mode\r
1099 Extended mode\r
1100 */\r
1101 bool pwdmode = false;\r
1102 uint32_t password = 0;\r
1103 char cmdp = param_getchar(Cmd, 0);\r
1104\r
1105 if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') return usage_t55xx_info();\r
1106 \r
1107 if (strlen(Cmd)==0)\r
1108 if ( !AquireData( T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, pwdmode, password ) )\r
1109 return 1;\r
1110\r
1111 if (!DecodeT55xxBlock()) return 1;\r
1112\r
1113 // too little space to start with\r
1114 if ( DemodBufferLen < 32) return 1;\r
1115\r
1116 // \r
1117 PrintAndLog("Offset+32 ==%d\n DemodLen == %d", config.offset + 32,DemodBufferLen );\r
1118\r
1119 uint8_t si = config.offset;\r
1120 uint32_t bl0 = PackBits(si, 32, DemodBuffer); \r
1121 uint32_t safer = PackBits(si, 4, DemodBuffer); si += 4; \r
1122 uint32_t resv = PackBits(si, 7, DemodBuffer); si += 7;\r
1123 uint32_t dbr = PackBits(si, 3, DemodBuffer); si += 3;\r
1124 uint32_t extend = PackBits(si, 1, DemodBuffer); si += 1;\r
1125 uint32_t datamod = PackBits(si, 5, DemodBuffer); si += 5;\r
1126 uint32_t pskcf = PackBits(si, 2, DemodBuffer); si += 2;\r
1127 uint32_t aor = PackBits(si, 1, DemodBuffer); si += 1; \r
1128 uint32_t otp = PackBits(si, 1, DemodBuffer); si += 1; \r
1129 uint32_t maxblk = PackBits(si, 3, DemodBuffer); si += 3;\r
1130 uint32_t pwd = PackBits(si, 1, DemodBuffer); si += 1; \r
1131 uint32_t sst = PackBits(si, 1, DemodBuffer); si += 1; \r
1132 uint32_t fw = PackBits(si, 1, DemodBuffer); si += 1;\r
1133 uint32_t inv = PackBits(si, 1, DemodBuffer); si += 1; \r
1134 uint32_t por = PackBits(si, 1, DemodBuffer); si += 1;\r
1135 \r
1136 if (config.Q5) PrintAndLog("*** Warning *** Config Info read off a Q5 will not display as expected");\r
1137 PrintAndLog("");\r
1138 PrintAndLog("-- T55xx Configuration & Tag Information --------------------");\r
1139 PrintAndLog("-------------------------------------------------------------");\r
1140 PrintAndLog(" Safer key : %s", GetSaferStr(safer));\r
1141 PrintAndLog(" reserved : %d", resv);\r
1142 PrintAndLog(" Data bit rate : %s", GetBitRateStr(dbr));\r
1143 PrintAndLog(" eXtended mode : %s", (extend) ? "Yes - Warning":"No");\r
1144 PrintAndLog(" Modulation : %s", GetModulationStr(datamod));\r
1145 PrintAndLog(" PSK clock frequency : %d", pskcf);\r
1146 PrintAndLog(" AOR - Answer on Request : %s", (aor) ? "Yes":"No");\r
1147 PrintAndLog(" OTP - One Time Pad : %s", (otp) ? "Yes - Warning":"No" );\r
1148 PrintAndLog(" Max block : %d", maxblk);\r
1149 PrintAndLog(" Password mode : %s", (pwd) ? "Yes":"No");\r
1150 PrintAndLog(" Sequence Start Terminator : %s", (sst) ? "Yes":"No");\r
1151 PrintAndLog(" Fast Write : %s", (fw) ? "Yes":"No");\r
1152 PrintAndLog(" Inverse data : %s", (inv) ? "Yes":"No");\r
1153 PrintAndLog(" POR-Delay : %s", (por) ? "Yes":"No");\r
1154 PrintAndLog("-------------------------------------------------------------");\r
1155 PrintAndLog(" Raw Data - Page 0");\r
1156 PrintAndLog(" Block 0 : 0x%08X %s", bl0, sprint_bin(DemodBuffer+config.offset,32) );\r
1157 PrintAndLog("-------------------------------------------------------------");\r
1158 \r
1159 return 0;\r
1160}\r
1161\r
1162int CmdT55xxDump(const char *Cmd){\r
1163\r
1164 uint32_t password = 0;\r
1165 bool override = false;\r
1166 char cmdp = param_getchar(Cmd, 0); \r
1167 if ( cmdp == 'h' || cmdp == 'H') return usage_t55xx_dump();\r
1168\r
1169 bool usepwd = ( strlen(Cmd) > 0); \r
1170 if ( usepwd ){\r
1171 password = param_get32ex(Cmd, 0, 0, 16);\r
1172 if (param_getchar(Cmd, 1) =='o' )\r
1173 override = true;\r
1174 }\r
1175 \r
1176 printT5xxHeader(0);\r
1177 for ( uint8_t i = 0; i < 8; ++i)\r
1178 T55xxReadBlock(i, 0, usepwd, override, password);\r
1179\r
1180 printT5xxHeader(1);\r
1181 for ( uint8_t i = 0; i < 4; i++)\r
1182 T55xxReadBlock(i, 1, usepwd, override, password); \r
1183\r
1184 return 1;\r
1185}\r
1186\r
1187int AquireData( uint8_t page, uint8_t block, bool pwdmode, uint32_t password ){\r
1188 // arg0 bitmodes:\r
1189 // bit0 = pwdmode\r
1190 // bit1 = page to read from\r
1191 uint8_t arg0 = (page<<1) | pwdmode;\r
1192 UsbCommand c = {CMD_T55XX_READ_BLOCK, {arg0, block, password}};\r
1193 \r
1194 clearCommandBuffer();\r
1195 SendCommand(&c);\r
1196 if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) {\r
1197 PrintAndLog("command execution time out");\r
1198 return 0;\r
1199 }\r
1200\r
1201 uint8_t got[12000];\r
1202 GetFromBigBuf(got,sizeof(got),0);\r
1203 WaitForResponse(CMD_ACK,NULL);\r
1204 setGraphBuf(got, sizeof(got));\r
1205 return 1;\r
1206}\r
1207\r
1208char * GetBitRateStr(uint32_t id){\r
1209 static char buf[25];\r
1210\r
1211 char *retStr = buf;\r
1212 switch (id){\r
1213 case 0: snprintf(retStr,sizeof(buf),"%d - RF/8",id); break;\r
1214 case 1: snprintf(retStr,sizeof(buf),"%d - RF/16",id); break;\r
1215 case 2: snprintf(retStr,sizeof(buf),"%d - RF/32",id); break;\r
1216 case 3: snprintf(retStr,sizeof(buf),"%d - RF/40",id); break;\r
1217 case 4: snprintf(retStr,sizeof(buf),"%d - RF/50",id); break;\r
1218 case 5: snprintf(retStr,sizeof(buf),"%d - RF/64",id); break;\r
1219 case 6: snprintf(retStr,sizeof(buf),"%d - RF/100",id); break;\r
1220 case 7: snprintf(retStr,sizeof(buf),"%d - RF/128",id); break;\r
1221 default: snprintf(retStr,sizeof(buf),"%d - (Unknown)",id); break;\r
1222 }\r
1223 return buf;\r
1224}\r
1225\r
1226char * GetSaferStr(uint32_t id){\r
1227 static char buf[40];\r
1228 char *retStr = buf;\r
1229 \r
1230 snprintf(retStr,sizeof(buf),"%d",id);\r
1231 if (id == 6) {\r
1232 snprintf(retStr,sizeof(buf),"%d - passwd",id);\r
1233 }\r
1234 if (id == 9 ){\r
1235 snprintf(retStr,sizeof(buf),"%d - testmode",id);\r
1236 }\r
1237 \r
1238 return buf;\r
1239}\r
1240\r
1241char * GetModulationStr( uint32_t id){\r
1242 static char buf[60];\r
1243 char *retStr = buf;\r
1244 \r
1245 switch (id){\r
1246 case 0: snprintf(retStr,sizeof(buf),"%d - DIRECT (ASK/NRZ)",id); break;\r
1247 case 1: snprintf(retStr,sizeof(buf),"%d - PSK 1 phase change when input changes",id); break;\r
1248 case 2: snprintf(retStr,sizeof(buf),"%d - PSK 2 phase change on bitclk if input high",id); break;\r
1249 case 3: snprintf(retStr,sizeof(buf),"%d - PSK 3 phase change on rising edge of input",id); break;\r
1250 case 4: snprintf(retStr,sizeof(buf),"%d - FSK 1 RF/8 RF/5",id); break;\r
1251 case 5: snprintf(retStr,sizeof(buf),"%d - FSK 2 RF/8 RF/10",id); break;\r
1252 case 6: snprintf(retStr,sizeof(buf),"%d - FSK 1a RF/5 RF/8",id); break;\r
1253 case 7: snprintf(retStr,sizeof(buf),"%d - FSK 2a RF/10 RF/8",id); break;\r
1254 case 8: snprintf(retStr,sizeof(buf),"%d - Manchester",id); break;\r
1255 case 16: snprintf(retStr,sizeof(buf),"%d - Biphase",id); break;\r
1256 case 0x18:snprintf(retStr,sizeof(buf),"%d - Biphase a - AKA Conditional Dephase Encoding(CDP)",id); break;\r
1257 case 17: snprintf(retStr,sizeof(buf),"%d - Reserved",id); break;\r
1258 default: snprintf(retStr,sizeof(buf),"0x%02X (Unknown)",id); break;\r
1259 }\r
1260 return buf;\r
1261}\r
1262\r
1263char * GetModelStrFromCID(uint32_t cid){\r
1264 \r
1265 static char buf[10];\r
1266 char *retStr = buf;\r
1267 \r
1268 if (cid == 1) snprintf(retStr, sizeof(buf),"ATA5577M1");\r
1269 if (cid == 2) snprintf(retStr, sizeof(buf),"ATA5577M2"); \r
1270 return buf;\r
1271}\r
1272\r
1273char * GetSelectedModulationStr( uint8_t id){\r
1274\r
1275 static char buf[20];\r
1276 char *retStr = buf;\r
1277\r
1278 switch (id){\r
1279 case DEMOD_FSK: snprintf(retStr,sizeof(buf),"FSK"); break;\r
1280 case DEMOD_FSK1: snprintf(retStr,sizeof(buf),"FSK1"); break;\r
1281 case DEMOD_FSK1a: snprintf(retStr,sizeof(buf),"FSK1a"); break;\r
1282 case DEMOD_FSK2: snprintf(retStr,sizeof(buf),"FSK2"); break;\r
1283 case DEMOD_FSK2a: snprintf(retStr,sizeof(buf),"FSK2a"); break;\r
1284 case DEMOD_ASK: snprintf(retStr,sizeof(buf),"ASK"); break;\r
1285 case DEMOD_NRZ: snprintf(retStr,sizeof(buf),"DIRECT/NRZ"); break;\r
1286 case DEMOD_PSK1: snprintf(retStr,sizeof(buf),"PSK1"); break;\r
1287 case DEMOD_PSK2: snprintf(retStr,sizeof(buf),"PSK2"); break;\r
1288 case DEMOD_PSK3: snprintf(retStr,sizeof(buf),"PSK3"); break;\r
1289 case DEMOD_BI: snprintf(retStr,sizeof(buf),"BIPHASE"); break;\r
1290 case DEMOD_BIa: snprintf(retStr,sizeof(buf),"BIPHASEa - (CDP)"); break;\r
1291 default: snprintf(retStr,sizeof(buf),"(Unknown)"); break;\r
1292 }\r
1293 return buf;\r
1294}\r
1295\r
1296void t55x7_create_config_block( int tagtype ){\r
1297\r
1298 /*\r
1299 T55X7_DEFAULT_CONFIG_BLOCK, T55X7_RAW_CONFIG_BLOCK\r
1300 T55X7_EM_UNIQUE_CONFIG_BLOCK, T55X7_FDXB_CONFIG_BLOCK,\r
1301 T55X7_FDXB_CONFIG_BLOCK, T55X7_HID_26_CONFIG_BLOCK, T55X7_INDALA_64_CONFIG_BLOCK, T55X7_INDALA_224_CONFIG_BLOCK \r
1302 T55X7_GUARDPROXII_CONFIG_BLOCK, T55X7_VIKING_CONFIG_BLOCK, T55X7_NORALYS_CONFIG_BLOCK, T55X7_IOPROX_CONFIG_BLOCK \r
1303 */\r
1304 static char buf[60];\r
1305 char *retStr = buf;\r
1306 \r
1307 switch (tagtype){\r
1308 case 0: snprintf(retStr, sizeof(buf),"%08X - T55X7 Default", T55X7_DEFAULT_CONFIG_BLOCK); break;\r
1309 case 1: snprintf(retStr, sizeof(buf),"%08X - T55X7 Raw", T55X7_RAW_CONFIG_BLOCK); break;\r
1310 //case 2: snprintf(retStr, sizeof(buf),"%08X - Q5 Default", Q5_DEFAULT_CONFIG_BLOCK); break;\r
1311 default:\r
1312 break;\r
1313 }\r
1314 PrintAndLog(buf);\r
1315}\r
1316\r
1317int CmdResetRead(const char *Cmd) {\r
1318 UsbCommand c = {CMD_T55XX_RESET_READ, {0,0,0}};\r
1319\r
1320 clearCommandBuffer();\r
1321 SendCommand(&c);\r
1322 if ( !WaitForResponseTimeout(CMD_ACK,NULL,2500) ) {\r
1323 PrintAndLog("command execution time out");\r
1324 return 0;\r
1325 }\r
1326\r
1327 uint8_t got[BIGBUF_SIZE-1];\r
1328 GetFromBigBuf(got,sizeof(got),0);\r
1329 WaitForResponse(CMD_ACK,NULL);\r
1330 setGraphBuf(got, sizeof(got));\r
1331 return 1;\r
1332}\r
1333// ADD T5555 (Q5) Default config block\r
1334int CmdT55xxWipe(const char *Cmd) {\r
1335 char writeData[20] = {0};\r
1336 char *ptrData = writeData;\r
1337 \r
1338 PrintAndLog("\nBeginning Wipe of a T55xx tag (assuming the tag is not password protected)\n");\r
1339 \r
1340 //try with the default password to reset block 0 (with a pwd should work even if pwd bit not set)\r
1341 snprintf(ptrData,sizeof(writeData),"b 0 d 000880E0 p 0");\r
1342 \r
1343 if (!CmdT55xxWriteBlock(ptrData))\r
1344 PrintAndLog("Error writing blk 0");\r
1345 \r
1346 for (uint8_t blk = 1; blk<8; blk++) {\r
1347 \r
1348 snprintf(ptrData,sizeof(writeData),"b %d d 0", blk);\r
1349 \r
1350 if (!CmdT55xxWriteBlock(ptrData)) \r
1351 PrintAndLog("Error writing blk %d", blk);\r
1352 \r
1353 memset(writeData,0x00, sizeof(writeData));\r
1354 }\r
1355 return 0;\r
1356}\r
1357\r
1358int CmdT55xxBruteForce(const char *Cmd) {\r
1359 \r
1360 // load a default pwd file.\r
1361 char buf[9];\r
1362 char filename[FILE_PATH_SIZE]={0};\r
1363 int keycnt = 0;\r
1364 uint8_t stKeyBlock = 20;\r
1365 uint8_t *keyBlock = NULL, *p;\r
1366 keyBlock = calloc(stKeyBlock, 6);\r
1367 if (keyBlock == NULL) return 1;\r
1368 \r
1369 uint32_t start_password = 0x00000000; //start password\r
1370 uint32_t end_password = 0xFFFFFFFF; //end password\r
1371 bool found = false;\r
1372\r
1373 char cmdp = param_getchar(Cmd, 0);\r
1374 if (cmdp == 'h' || cmdp == 'H') return usage_t55xx_bruteforce();\r
1375\r
1376 if (cmdp == 'i' || cmdp == 'I') {\r
1377 \r
1378 int len = strlen(Cmd+2);\r
1379 if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;\r
1380 memcpy(filename, Cmd+2, len);\r
1381 \r
1382 FILE * f = fopen( filename , "r");\r
1383 \r
1384 if ( !f ) {\r
1385 PrintAndLog("File: %s: not found or locked.", filename);\r
1386 free(keyBlock);\r
1387 return 1;\r
1388 } \r
1389 \r
1390 while( fgets(buf, sizeof(buf), f) ){\r
1391 if (strlen(buf) < 8 || buf[7] == '\n') continue;\r
1392 \r
1393 while (fgetc(f) != '\n' && !feof(f)) ; //goto next line\r
1394 \r
1395 //The line start with # is comment, skip\r
1396 if( buf[0]=='#' ) continue;\r
1397\r
1398 if (!isxdigit(buf[0])){\r
1399 PrintAndLog("File content error. '%s' must include 8 HEX symbols", buf);\r
1400 continue;\r
1401 }\r
1402 \r
1403 buf[8] = 0;\r
1404\r
1405 if ( stKeyBlock - keycnt < 2) {\r
1406 p = realloc(keyBlock, 6*(stKeyBlock+=10));\r
1407 if (!p) {\r
1408 PrintAndLog("Cannot allocate memory for defaultKeys");\r
1409 free(keyBlock);\r
1410 return 2;\r
1411 }\r
1412 keyBlock = p;\r
1413 }\r
1414 memset(keyBlock + 4 * keycnt, 0, 4);\r
1415 num_to_bytes(strtoll(buf, NULL, 16), 4, keyBlock + 4*keycnt);\r
1416 PrintAndLog("chk custom pwd[%2d] %08X", keycnt, bytes_to_num(keyBlock + 4*keycnt, 4));\r
1417 keycnt++;\r
1418 memset(buf, 0, sizeof(buf));\r
1419 } \r
1420 fclose(f);\r
1421 \r
1422 if (keycnt == 0) {\r
1423 PrintAndLog("No keys found in file");\r
1424 return 1;\r
1425 }\r
1426 PrintAndLog("Loaded %d keys", keycnt);\r
1427 \r
1428 // loop\r
1429 uint64_t testpwd = 0x00;\r
1430 for (uint16_t c = 0; c < keycnt; ++c ) {\r
1431 \r
1432 if (ukbhit()) {\r
1433 getchar();\r
1434 printf("\naborted via keyboard!\n");\r
1435 return 0;\r
1436 }\r
1437 \r
1438 testpwd = bytes_to_num(keyBlock + 4*c, 4);\r
1439\r
1440 PrintAndLog("Testing %08X", testpwd);\r
1441 \r
1442 \r
1443 if ( !AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, TRUE, testpwd)) {\r
1444 PrintAndLog("Aquireing data from device failed. Quitting");\r
1445 return 0;\r
1446 }\r
1447 \r
1448 found = tryDetectModulation();\r
1449\r
1450 if ( found ) {\r
1451 PrintAndLog("Found valid password: [%08X]", testpwd);\r
1452 return 0;\r
1453 } \r
1454 }\r
1455 PrintAndLog("Password NOT found.");\r
1456 return 0;\r
1457 }\r
1458 \r
1459 // Try to read Block 7, first :)\r
1460 \r
1461 // incremental pwd range search\r
1462 start_password = param_get32ex(Cmd, 0, 0, 16);\r
1463 end_password = param_get32ex(Cmd, 1, 0, 16);\r
1464 \r
1465 if ( start_password >= end_password ) return usage_t55xx_bruteforce();\r
1466 \r
1467 PrintAndLog("Search password range [%08X -> %08X]", start_password, end_password);\r
1468 \r
1469 uint32_t i = start_password;\r
1470\r
1471 while ((!found) && (i <= end_password)){\r
1472\r
1473 printf(".");\r
1474 fflush(stdout);\r
1475 if (ukbhit()) {\r
1476 getchar();\r
1477 printf("\naborted via keyboard!\n");\r
1478 return 0;\r
1479 }\r
1480 \r
1481 if (!AquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, TRUE, i)) {\r
1482 PrintAndLog("Aquireing data from device failed. Quitting");\r
1483 return 0;\r
1484 }\r
1485 found = tryDetectModulation();\r
1486 \r
1487 if (found) break;\r
1488 i++;\r
1489 }\r
1490 \r
1491 PrintAndLog("");\r
1492 \r
1493 if (found)\r
1494 PrintAndLog("Found valid password: [%08x]", i);\r
1495 else\r
1496 PrintAndLog("Password NOT found. Last tried: [%08x]", --i);\r
1497 return 0;\r
1498}\r
1499\r
1500static command_t CommandTable[] = {\r
1501 {"help", CmdHelp, 1, "This help"},\r
1502 {"bruteforce",CmdT55xxBruteForce,0, "<start password> <end password> [i <*.dic>] Simple bruteforce attack to find password"},\r
1503 {"config", CmdT55xxSetConfig, 1, "Set/Get T55XX configuration (modulation, inverted, offset, rate)"},\r
1504 {"detect", CmdT55xxDetect, 1, "[1] Try detecting the tag modulation from reading the configuration block."},\r
1505 {"dump", CmdT55xxDump, 0, "[password] [o] Dump T55xx card block 0-7. Optional [password], [override]"},\r
1506 {"info", CmdT55xxInfo, 1, "[1] Show T55x7 configuration data (page 0/ blk 0)"},\r
1507 {"read", CmdT55xxReadBlock, 0, "b <block> p [password] [o] [1] -- Read T55xx block data. Optional [p password], [override], [page1]"},\r
1508 {"resetread", CmdResetRead, 0, "Send Reset Cmd then lf read the stream to attempt to identify the start of it (needs a demod and/or plot after)"},\r
1509 {"special", special, 0, "Show block changes with 64 different offsets"}, \r
1510 {"trace", CmdT55xxReadTrace, 1, "[1] Show T55x7 traceability data (page 1/ blk 0-1)"},\r
1511 {"wakeup", CmdT55xxWakeUp, 0, "Send AOR wakeup command"},\r
1512 {"wipe", CmdT55xxWipe, 0, "Wipe a T55xx tag and set defaults (will destroy any data on tag)"},\r
1513 {"write", CmdT55xxWriteBlock,0, "b <block> d <data> p [password] [1] -- Write T55xx block data. Optional [p password], [page1]"},\r
1514 {NULL, NULL, 0, NULL}\r
1515};\r
1516\r
1517int CmdLFT55XX(const char *Cmd) {\r
1518 CmdsParse(CommandTable, Cmd);\r
1519 return 0;\r
1520}\r
1521\r
1522int CmdHelp(const char *Cmd) {\r
1523 CmdsHelp(CommandTable);\r
1524 return 0;\r
1525}\r
Impressum, Datenschutz