]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/cmdhfmfu.c
1 //-----------------------------------------------------------------------------
2 // Ultralight Code (c) 2013,2014 Midnitesnake & Andy Davies of Pentura
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // High frequency MIFARE ULTRALIGHT (C) commands
9 //-----------------------------------------------------------------------------
10 //#include <openssl/des.h>
11 #include "loclass/des.h"
17 #define MAX_ULTRA_BLOCKS 0x0f
18 #define MAX_ULTRAC_BLOCKS 0x2f
19 //#define MAX_ULTRAC_BLOCKS 0x2c
22 static int CmdHelp(const char *Cmd
);
24 int CmdHF14AMfUInfo(const char *Cmd
){
26 uint8_t datatemp
[7] = {0x00};
30 UsbCommand c
= {CMD_MIFAREU_READCARD
, {0, 4}};
34 if (WaitForResponseTimeout(CMD_ACK
, &resp
, 1500)) {
35 isOK
= resp
.arg
[0] & 0xff;
36 data
= resp
.d
.asBytes
;
39 PrintAndLog("Error reading from tag");
43 PrintAndLog("Command execute timed out");
48 PrintAndLog("-- Mifare Ultralight / Ultralight-C Tag Information ---------");
49 PrintAndLog("-------------------------------------------------------------");
52 memcpy( datatemp
, data
, 3);
53 memcpy( datatemp
+3, data
+4, 4);
55 PrintAndLog("MANUFACTURER : %s", getTagInfo(datatemp
[0]));
56 PrintAndLog(" UID : %s ", sprint_hex(datatemp
, 7));
58 // CT (cascade tag byte) 0x88 xor SN0 xor SN1 xor SN2
59 int crc0
= 0x88 ^ data
[0] ^ data
[1] ^data
[2];
60 if ( data
[3] == crc0
)
61 PrintAndLog(" BCC0 : %02x - Ok", data
[3]);
63 PrintAndLog(" BCC0 : %02x - crc should be %02x", data
[3], crc0
);
65 int crc1
= data
[4] ^ data
[5] ^ data
[6] ^data
[7];
66 if ( data
[8] == crc1
)
67 PrintAndLog(" BCC1 : %02x - Ok", data
[8]);
69 PrintAndLog(" BCC1 : %02x - crc should be %02x", data
[8], crc1
);
71 PrintAndLog(" Internal : %s ", sprint_hex(data
+ 9, 1));
73 memcpy(datatemp
, data
+10, 2);
74 PrintAndLog(" Lock : %s - %s", sprint_hex(datatemp
, 2),printBits( 2, &datatemp
) );
75 PrintAndLog(" OneTimePad : %s ", sprint_hex(data
+ 3*4, 4));
78 int len
= CmdHF14AMfucAuth("K 0");
79 // PrintAndLog("CODE: %d",len);
81 PrintAndLog("Seems to be a Ultralight %s", (len
==0) ? "-C" :"");
86 // Mifare Ultralight Write Single Block
88 int CmdHF14AMfUWrBl(const char *Cmd
){
90 bool chinese_card
= FALSE
;
91 uint8_t bldata
[16] = {0x00};
94 char cmdp
= param_getchar(Cmd
, 0);
95 if (strlen(Cmd
) < 3 || cmdp
== 'h' || cmdp
== 'H') {
96 PrintAndLog("Usage: hf mfu wrbl <block number> <block data (8 hex symbols)> [w]");
97 PrintAndLog(" [block number]");
98 PrintAndLog(" [block data] - (8 hex symbols)");
99 PrintAndLog(" [w] - Chinese magic ultralight tag");
101 PrintAndLog(" sample: hf mfu wrbl 0 01020304");
106 blockNo
= param_get8(Cmd
, 0);
108 if (blockNo
> MAX_ULTRA_BLOCKS
){
109 PrintAndLog("Error: Maximum number of blocks is 15 for Ultralight Cards!");
113 if (param_gethex(Cmd
, 1, bldata
, 8)) {
114 PrintAndLog("Block data must include 8 HEX symbols");
118 if (strchr(Cmd
,'w') != 0 || strchr(Cmd
,'W') != 0 ) {
124 PrintAndLog("Access Denied");
126 PrintAndLog("--specialblock no:%02x", blockNo
);
127 PrintAndLog("--data: %s", sprint_hex(bldata
, 4));
128 UsbCommand d
= {CMD_MIFAREU_WRITEBL
, {blockNo
}};
129 memcpy(d
.d
.asBytes
,bldata
, 4);
131 if (WaitForResponseTimeout(CMD_ACK
,&resp
,1500)) {
132 uint8_t isOK
= resp
.arg
[0] & 0xff;
133 PrintAndLog("isOk:%02x", isOK
);
135 PrintAndLog("Command execute timeout");
139 PrintAndLog("--block no:%02x", blockNo
);
140 PrintAndLog("--data: %s", sprint_hex(bldata
, 4));
141 UsbCommand e
= {CMD_MIFAREU_WRITEBL
, {blockNo
}};
142 memcpy(e
.d
.asBytes
,bldata
, 4);
144 if (WaitForResponseTimeout(CMD_ACK
,&resp
,1500)) {
145 uint8_t isOK
= resp
.arg
[0] & 0xff;
146 PrintAndLog("isOk:%02x", isOK
);
148 PrintAndLog("Command execute timeout");
155 // Mifare Ultralight Read Single Block
157 int CmdHF14AMfURdBl(const char *Cmd
){
159 uint8_t blockNo
= -1;
161 char cmdp
= param_getchar(Cmd
, 0);
163 if (strlen(Cmd
) < 1 || cmdp
== 'h' || cmdp
== 'H') {
164 PrintAndLog("Usage: hf mfu rdbl <block number>");
165 PrintAndLog(" sample: hfu mfu rdbl 0");
169 blockNo
= param_get8(Cmd
, 0);
171 if (blockNo
> MAX_ULTRA_BLOCKS
){
172 PrintAndLog("Error: Maximum number of blocks is 15 for Ultralight Cards!");
176 PrintAndLog("--block no:0x%02X (%d)", (int)blockNo
, blockNo
);
177 UsbCommand c
= {CMD_MIFAREU_READBL
, {blockNo
}};
181 if (WaitForResponseTimeout(CMD_ACK
,&resp
,1500)) {
182 uint8_t isOK
= resp
.arg
[0] & 0xff;
183 uint8_t * data
= resp
.d
.asBytes
;
185 PrintAndLog("isOk: %02x", isOK
);
188 PrintAndLog("Data: %s", sprint_hex(data
, 4));
190 PrintAndLog("Command execute timeout");
196 // Mifare Ultralight / Ultralight-C; Read and Dump Card Contents
198 int CmdHF14AMfUDump(const char *Cmd
){
201 char filename
[FILE_PATH_SIZE
] = {0x00};
202 char * fnameptr
= filename
;
204 uint8_t *lockbytes_t
= NULL
;
205 uint8_t lockbytes
[2] = {0x00};
207 uint8_t *lockbytes_t2
= NULL
;
208 uint8_t lockbytes2
[2] = {0x00};
210 bool bit
[16] = {0x00};
211 bool bit2
[16] = {0x00};
217 bool tmplockbit
= false;
219 uint8_t *data
= NULL
;
221 char cmdp
= param_getchar(Cmd
, 0);
223 if (cmdp
== 'h' || cmdp
== 'H') {
224 PrintAndLog("Reads all pages from Mifare Ultralight or Ultralight-C tag.");
225 PrintAndLog("It saves binary dump into the file `filename.bin` or `cardUID.bin`");
226 PrintAndLog("Usage: hf mfu dump <c> <filename w/o .bin>");
227 PrintAndLog(" <c> optional cardtype c == Ultralight-C, if not defaults to Ultralight");
228 PrintAndLog(" sample: hf mfu dump");
229 PrintAndLog(" : hf mfu dump myfile");
230 PrintAndLog(" : hf mfu dump c myfile");
235 Pages
= (cmdp
== 'c' || cmdp
== 'C') ? 44 : 16;
237 PrintAndLog("Dumping Ultralight%s Card Data...", (Pages
==16)?"":"-C");
239 UsbCommand c
= {CMD_MIFAREU_READCARD
, {BlockNo
,Pages
}};
243 if (WaitForResponseTimeout(CMD_ACK
,&resp
,1500)) {
244 isOK
= resp
.arg
[0] & 0xff;
246 PrintAndLog("Command error");
249 data
= resp
.d
.asBytes
;
251 PrintAndLog("Command execute timeout");
258 lockbytes_t
= data
+ 8;
259 lockbytes
[0] = lockbytes_t
[2];
260 lockbytes
[1] = lockbytes_t
[3];
261 for(j
= 0; j
< 16; j
++){
262 bit
[j
] = lockbytes
[j
/8] & ( 1 <<(7-j
%8));
265 // Load bottom lockbytes if available
268 lockbytes_t2
= data
+ (40*4);
269 lockbytes2
[0] = lockbytes_t2
[2];
270 lockbytes2
[1] = lockbytes_t2
[3];
271 for (j
= 0; j
< 16; j
++) {
272 bit2
[j
] = lockbytes2
[j
/8] & ( 1 <<(7-j
%8));
276 for (i
= 0; i
< Pages
; ++i
) {
279 PrintAndLog("Block %02x:%s ", i
,sprint_hex(data
+ i
* 4, 4));
284 case 3: tmplockbit
= bit
[4]; break;
285 case 4: tmplockbit
= bit
[3]; break;
286 case 5: tmplockbit
= bit
[2]; break;
287 case 6: tmplockbit
= bit
[1]; break;
288 case 7: tmplockbit
= bit
[0]; break;
289 case 8: tmplockbit
= bit
[15]; break;
290 case 9: tmplockbit
= bit
[14]; break;
291 case 10: tmplockbit
= bit
[13]; break;
292 case 11: tmplockbit
= bit
[12]; break;
293 case 12: tmplockbit
= bit
[11]; break;
294 case 13: tmplockbit
= bit
[10]; break;
295 case 14: tmplockbit
= bit
[9]; break;
296 case 15: tmplockbit
= bit
[8]; break;
300 case 19: tmplockbit
= bit2
[6]; break;
304 case 23: tmplockbit
= bit2
[5]; break;
308 case 27: tmplockbit
= bit2
[4]; break;
312 case 31: tmplockbit
= bit2
[2]; break;
316 case 35: tmplockbit
= bit2
[1]; break;
320 case 39: tmplockbit
= bit2
[0]; break;
321 case 40: tmplockbit
= bit2
[12]; break;
322 case 41: tmplockbit
= bit2
[11]; break;
323 case 42: tmplockbit
= bit2
[10]; break; //auth0
324 case 43: tmplockbit
= bit2
[9]; break; //auth1
327 PrintAndLog("Block %02x:%s [%d]", i
,sprint_hex(data
+ i
* 4, 4),tmplockbit
);
332 len
= param_getstr(Cmd
,0,filename
);
334 len
= param_getstr(Cmd
,1,filename
);
336 if (len
> FILE_PATH_SIZE
-5) len
= FILE_PATH_SIZE
-5;
338 // user supplied filename?
341 // UID = data 0-1-2 4-5-6-7 (skips a beat)
342 sprintf(fnameptr
,"%02X%02X%02X%02X%02X%02X%02X.bin",
343 data
[0],data
[1], data
[2], data
[4],data
[5],data
[6], data
[7]);
346 sprintf(fnameptr
+ len
," .bin");
350 if ((fout
= fopen(filename
,"wb")) == NULL
) {
351 PrintAndLog("Could not create file name %s", filename
);
354 fwrite( data
, 1, Pages
*4, fout
);
357 PrintAndLog("Dumped %d pages, wrote %d bytes to %s", Pages
, Pages
*4, filename
);
361 // Needed to Authenticate to Ultralight C tags
362 void rol (uint8_t *data
, const size_t len
){
363 uint8_t first
= data
[0];
364 for (size_t i
= 0; i
< len
-1; i
++) {
370 //-------------------------------------------------------------------------------
371 // Ultralight C Methods
372 //-------------------------------------------------------------------------------
375 // Ultralight C Authentication Demo {currently uses hard-coded key}
377 int CmdHF14AMfucAuth(const char *Cmd
){
379 uint8_t default_keys
[5][16] = {
380 { 0x42,0x52,0x45,0x41,0x4b,0x4d,0x45,0x49,0x46,0x59,0x4f,0x55,0x43,0x41,0x4e,0x21 },// 3des std key
381 { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },// all zeroes
382 { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f },// 0x00-0x0F
383 { 0x49,0x45,0x4D,0x4B,0x41,0x45,0x52,0x42,0x21,0x4E,0x41,0x43,0x55,0x4F,0x59,0x46 },// NFC-key
384 { 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 } // all ones
387 char cmdp
= param_getchar(Cmd
, 0);
391 //Change key to user defined one
392 if (cmdp
== 'k' || cmdp
== 'K'){
393 keyNo
= param_get8(Cmd
, 1);
394 if(keyNo
>= 4) errors
= true;
397 if (cmdp
== 'h' || cmdp
== 'H') {
402 PrintAndLog("Usage: hf mfu cauth k <key number>");
403 PrintAndLog(" 0 (default): 3DES standard key");
404 PrintAndLog(" 1 : all zeros key");
405 PrintAndLog(" 2 : 0x00-0x0F key");
406 PrintAndLog(" 3 : nfc key");
407 PrintAndLog(" 4 : all ones key");
408 PrintAndLog(" sample : hf mfu cauth k");
409 PrintAndLog(" : hf mfu cauth k 3");
413 uint8_t random_a
[8] = { 1,1,1,1,1,1,1,1 };
414 //uint8_t enc_random_a[8] = { 0 };
415 uint8_t random_b
[8] = { 0 };
416 uint8_t enc_random_b
[8] = { 0 };
417 uint8_t random_a_and_b
[16] = { 0 };
418 des3_context ctx
= { 0 };
419 uint8_t *key
= default_keys
[keyNo
];
424 UsbCommand c
= {CMD_MIFAREUC_AUTH1
, {blockNo
}};
427 if (WaitForResponseTimeout(CMD_ACK
,&resp
,1500)) {
428 uint8_t isOK
= resp
.arg
[0] & 0xff;
430 uint8_t * data
= resp
.d
.asBytes
;
433 PrintAndLog("enc(RndB):%s", sprint_hex(data
+1, 8));
434 memcpy(enc_random_b
,data
+1,8);
436 PrintAndLog("Auth failed");
437 return 2; // auth failed.
440 PrintAndLog("Command execute timeout");
444 uint8_t iv
[8] = { 0 };
445 // Do we need random ? Right now we use all ones, is that random enough ?
446 // DES_random_key(&RndA);
448 PrintAndLog(" RndA :%s",sprint_hex(random_a
, 8));
449 PrintAndLog(" e_RndB:%s",sprint_hex(enc_random_b
, 8));
451 des3_set2key_dec(&ctx
, key
);
453 des3_crypt_cbc(&ctx
// des3_context *ctx
454 , DES_DECRYPT
// int mode
455 , sizeof(random_b
) // size_t length
456 , iv
// unsigned char iv[8]
457 , enc_random_b
// const unsigned char *input
458 , random_b
// unsigned char *output
461 PrintAndLog(" RndB:%s",sprint_hex(random_b
, 8));
464 memcpy(random_a_and_b
,random_a
,8);
465 memcpy(random_a_and_b
+8,random_b
,8);
467 PrintAndLog(" RA+B:%s",sprint_hex(random_a_and_b
, 16));
469 des3_set2key_enc(&ctx
, key
);
471 des3_crypt_cbc(&ctx
// des3_context *ctx
472 , DES_ENCRYPT
// int mode
473 , sizeof(random_a_and_b
) // size_t length
474 , enc_random_b
// unsigned char iv[8]
475 , random_a_and_b
// const unsigned char *input
476 , random_a_and_b
// unsigned char *output
479 PrintAndLog("enc(RA+B):%s",sprint_hex(random_a_and_b
, 16));
482 UsbCommand d
= {CMD_MIFAREUC_AUTH2
, {cuid
}};
483 memcpy(d
.d
.asBytes
,random_a_and_b
, 16);
487 if (WaitForResponseTimeout(CMD_ACK
,&respb
,1500)) {
488 uint8_t isOK
= respb
.arg
[0] & 0xff;
489 uint8_t * data2
= respb
.d
.asBytes
;
492 PrintAndLog("enc(RndA'):%s", sprint_hex(data2
+1, 8));
498 PrintAndLog("Command execute timeout");
504 A test function to validate that the polarssl-function works the same
505 was as the openssl-implementation.
506 Commented out, since it requires openssl
508 int CmdTestDES(const char * cmd)
510 uint8_t key[16] = {0x00};
512 memcpy(key,key3_3des_data,16);
513 DES_cblock RndA, RndB;
515 PrintAndLog("----------OpenSSL DES implementation----------");
517 uint8_t e_RndB[8] = {0x00};
518 unsigned char RndARndB[16] = {0x00};
520 DES_cblock iv = { 0 };
521 DES_key_schedule ks1,ks2;
522 DES_cblock key1,key2;
524 memcpy(key,key3_3des_data,16);
526 memcpy(key2,key+8,8);
529 DES_set_key((DES_cblock *)key1,&ks1);
530 DES_set_key((DES_cblock *)key2,&ks2);
532 DES_random_key(&RndA);
533 PrintAndLog(" RndA:%s",sprint_hex(RndA, 8));
534 PrintAndLog(" e_RndB:%s",sprint_hex(e_RndB, 8));
535 //void DES_ede2_cbc_encrypt(const unsigned char *input,
536 // unsigned char *output, long length, DES_key_schedule *ks1,
537 // DES_key_schedule *ks2, DES_cblock *ivec, int enc);
538 DES_ede2_cbc_encrypt(e_RndB,RndB,sizeof(e_RndB),&ks1,&ks2,&iv,0);
540 PrintAndLog(" RndB:%s",sprint_hex(RndB, 8));
542 memcpy(RndARndB,RndA,8);
543 memcpy(RndARndB+8,RndB,8);
544 PrintAndLog(" RA+B:%s",sprint_hex(RndARndB, 16));
545 DES_ede2_cbc_encrypt(RndARndB,RndARndB,sizeof(RndARndB),&ks1,&ks2,&e_RndB,1);
546 PrintAndLog("enc(RA+B):%s",sprint_hex(RndARndB, 16));
549 PrintAndLog("----------PolarSSL implementation----------");
551 uint8_t random_a[8] = { 0 };
552 uint8_t enc_random_a[8] = { 0 };
553 uint8_t random_b[8] = { 0 };
554 uint8_t enc_random_b[8] = { 0 };
555 uint8_t random_a_and_b[16] = { 0 };
556 des3_context ctx = { 0 };
558 memcpy(random_a, RndA,8);
560 uint8_t output[8] = { 0 };
561 uint8_t iv[8] = { 0 };
563 PrintAndLog(" RndA :%s",sprint_hex(random_a, 8));
564 PrintAndLog(" e_RndB:%s",sprint_hex(enc_random_b, 8));
566 des3_set2key_dec(&ctx, key);
568 des3_crypt_cbc(&ctx // des3_context *ctx
569 , DES_DECRYPT // int mode
570 , sizeof(random_b) // size_t length
571 , iv // unsigned char iv[8]
572 , enc_random_b // const unsigned char *input
573 , random_b // unsigned char *output
576 PrintAndLog(" RndB:%s",sprint_hex(random_b, 8));
579 memcpy(random_a_and_b ,random_a,8);
580 memcpy(random_a_and_b+8,random_b,8);
582 PrintAndLog(" RA+B:%s",sprint_hex(random_a_and_b, 16));
584 des3_set2key_enc(&ctx, key);
586 des3_crypt_cbc(&ctx // des3_context *ctx
587 , DES_ENCRYPT // int mode
588 , sizeof(random_a_and_b) // size_t length
589 , enc_random_b // unsigned char iv[8]
590 , random_a_and_b // const unsigned char *input
591 , random_a_and_b // unsigned char *output
594 PrintAndLog("enc(RA+B):%s",sprint_hex(random_a_and_b, 16));
600 // Ultralight C Read Single Block
602 int CmdHF14AMfUCRdBl(const char *Cmd
)
605 uint8_t blockNo
= -1;
606 unsigned char key
[16];
607 char cmdp
= param_getchar(Cmd
, 0);
609 if (strlen(Cmd
) < 1 || cmdp
== 'h' || cmdp
== 'H') {
610 PrintAndLog("Usage: hf mfu crdbl <block number> <password>");
612 PrintAndLog("sample: hf mfu crdbl 0");
613 PrintAndLog(" hf mfu crdbl 0 1122334455667788");
617 blockNo
= param_get8(Cmd
, 0);
619 PrintAndLog("Wrong block number");
623 if (blockNo
> MAX_ULTRAC_BLOCKS
){
624 PrintAndLog("Error: Maximum number of readable blocks is 47 for Ultralight-C Cards!");
629 if ( strlen(Cmd
) > 3){
630 if (param_gethex(Cmd
, 1, key
, 16)) {
631 PrintAndLog("Key must include %d HEX symbols", 16);
639 PrintAndLog("--block no: 0x%02X (%d) PWD: %s", (int)blockNo
, blockNo
, key
);
641 PrintAndLog("--block no: 0x%02X (%d)", (int)blockNo
, blockNo
);
644 UsbCommand c
= {CMD_MIFAREU_READBL
, {blockNo
}};
647 memcpy(c
.d
.asBytes
,key
,16);
651 if (WaitForResponseTimeout(CMD_ACK
,&resp
,1500)) {
652 uint8_t isOK
= resp
.arg
[0] & 0xff;
653 uint8_t *data
= resp
.d
.asBytes
;
655 PrintAndLog("isOk: %02x", isOK
);
657 PrintAndLog("Data: %s", sprint_hex(data
, 4));
660 PrintAndLog("Command execute timeout");
666 // Mifare Ultralight C Write Single Block
668 int CmdHF14AMfUCWrBl(const char *Cmd
){
670 uint8_t blockNo
= -1;
671 bool chinese_card
= FALSE
;
672 uint8_t bldata
[16] = {0x00};
675 char cmdp
= param_getchar(Cmd
, 0);
677 if (strlen(Cmd
) < 3 || cmdp
== 'h' || cmdp
== 'H') {
678 PrintAndLog("Usage: hf mfu cwrbl <block number> <block data (8 hex symbols)> [w]");
679 PrintAndLog(" [block number]");
680 PrintAndLog(" [block data] - (8 hex symbols)");
681 PrintAndLog(" [w] - Chinese magic ultralight tag");
683 PrintAndLog(" sample: hf mfu cwrbl 0 01020304");
688 blockNo
= param_get8(Cmd
, 0);
689 if (blockNo
> MAX_ULTRAC_BLOCKS
){
690 PrintAndLog("Error: Maximum number of blocks is 47 for Ultralight-C Cards!");
694 if (param_gethex(Cmd
, 1, bldata
, 8)) {
695 PrintAndLog("Block data must include 8 HEX symbols");
699 if (strchr(Cmd
,'w') != 0 || strchr(Cmd
,'W') != 0 ) {
703 if ( blockNo
<= 3 ) {
705 PrintAndLog("Access Denied");
707 PrintAndLog("--Special block no: 0x%02x", blockNo
);
708 PrintAndLog("--Data: %s", sprint_hex(bldata
, 4));
709 UsbCommand d
= {CMD_MIFAREU_WRITEBL
, {blockNo
}};
710 memcpy(d
.d
.asBytes
,bldata
, 4);
712 if (WaitForResponseTimeout(CMD_ACK
,&resp
,1500)) {
713 uint8_t isOK
= resp
.arg
[0] & 0xff;
714 PrintAndLog("isOk:%02x", isOK
);
716 PrintAndLog("Command execute timeout");
720 PrintAndLog("--Block no : 0x%02x", blockNo
);
721 PrintAndLog("--Data: %s", sprint_hex(bldata
, 4));
722 UsbCommand e
= {CMD_MIFAREU_WRITEBL
, {blockNo
}};
723 memcpy(e
.d
.asBytes
,bldata
, 4);
725 if (WaitForResponseTimeout(CMD_ACK
,&resp
,1500)) {
726 uint8_t isOK
= resp
.arg
[0] & 0xff;
727 PrintAndLog("isOk : %02x", isOK
);
729 PrintAndLog("Command execute timeout");
735 //------------------------------------
737 //------------------------------------
738 static command_t CommandTable
[] =
740 {"help", CmdHelp
, 1,"This help"},
741 {"dbg", CmdHF14AMfDbg
, 0,"Set default debug mode"},
742 {"info", CmdHF14AMfUInfo
, 0,"Taginfo"},
743 {"dump", CmdHF14AMfUDump
, 0,"Dump MIFARE Ultralight / Ultralight-C tag to binary file"},
744 {"rdbl", CmdHF14AMfURdBl
, 0,"Read block - MIFARE Ultralight"},
745 {"wrbl", CmdHF14AMfUWrBl
, 0,"Write block - MIFARE Ultralight"},
746 {"crdbl", CmdHF14AMfUCRdBl
, 0,"Read block - MIFARE Ultralight C"},
747 {"cwrbl", CmdHF14AMfUCWrBl
, 0,"Write MIFARE Ultralight C block"},
748 {"cauth", CmdHF14AMfucAuth
, 0,"try a Ultralight C Authentication"},
749 //{"testdes", CmdTestDES , 1, "Test DES"},
750 {NULL
, NULL
, 0, NULL
}
753 int CmdHFMFUltra(const char *Cmd
){
754 WaitForResponseTimeout(CMD_ACK
,NULL
,100);
755 CmdsParse(CommandTable
, Cmd
);
759 int CmdHelp(const char *Cmd
){
760 CmdsHelp(CommandTable
);