#include "mifare/ndef.h"\r
#include "emv/dump.h"\r
\r
-#define NESTED_SECTOR_RETRY 10 // how often we try mfested() until we give up\r
+#define NESTED_SECTOR_RETRY 10 // how often we try mfested() until we give up\r
\r
static int CmdHelp(const char *Cmd);\r
\r
uint8_t key[6] = {0, 0, 0, 0, 0, 0};\r
uint8_t bldata[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};\r
\r
- char cmdp = 0x00;\r
+ char cmdp = 0x00;\r
\r
if (strlen(Cmd)<3) {\r
PrintAndLog("Usage: hf mf wrbl <block number> <key A/B> <key (12 hex symbols)> <block data (32 hex symbols)>");\r
uint8_t keyType = 0;\r
uint8_t key[6] = {0, 0, 0, 0, 0, 0};\r
\r
- char cmdp = 0x00;\r
+ char cmdp = 0x00;\r
\r
\r
if (strlen(Cmd)<3) {\r
uint8_t key[6] = {0, 0, 0, 0, 0, 0};\r
uint8_t isOK = 0;\r
uint8_t *data = NULL;\r
- char cmdp = 0x00;\r
+ char cmdp = 0x00;\r
\r
if (strlen(Cmd)<3) {\r
PrintAndLog("Usage: hf mf rdsc <sector number> <key A/B> <key (12 hex symbols)>");\r
PrintAndLog("data : %s", sprint_hex(data + i * 16, 16));\r
}\r
PrintAndLog("trailer: %s", sprint_hex(data + (sectorNo<32?3:15) * 16, 16));\r
- \r
+\r
PrintAndLogEx(NORMAL, "Trailer decoded:");\r
- int bln = mfFirstBlockOfSector(sectorNo);\r
- int blinc = (mfNumBlocksPerSector(sectorNo) > 4) ? 5 : 1;\r
- for (i = 0; i < 4; i++) {\r
- PrintAndLogEx(NORMAL, "Access block %d%s: %s", bln, ((blinc > 1) && (i < 3) ? "+" : "") , mfGetAccessConditionsDesc(i, &(data + (sectorNo<32?3:15) * 16)[6]));\r
- bln += blinc;\r
- }\r
- PrintAndLogEx(NORMAL, "UserData: %s", sprint_hex_inrow(&(data + (sectorNo<32?3:15) * 16)[9], 1));\r
+ int bln = mfFirstBlockOfSector(sectorNo);\r
+ int blinc = (mfNumBlocksPerSector(sectorNo) > 4) ? 5 : 1;\r
+ for (i = 0; i < 4; i++) {\r
+ PrintAndLogEx(NORMAL, "Access block %d%s: %s", bln, ((blinc > 1) && (i < 3) ? "+" : "") , mfGetAccessConditionsDesc(i, &(data + (sectorNo<32?3:15) * 16)[6]));\r
+ bln += blinc;\r
+ }\r
+ PrintAndLogEx(NORMAL, "UserData: %s", sprint_hex_inrow(&(data + (sectorNo<32?3:15) * 16)[9], 1));\r
}\r
} else {\r
PrintAndLog("Command execute timeout");\r
fclose(fin);\r
return 2;\r
}\r
- } \r
+ }\r
}\r
\r
fclose(fin);\r
for (blockNo = 0; isOK && blockNo < NumBlocksPerSector(sectorNo); blockNo++) {\r
bool received = false;\r
for (tries = 0; tries < 3; tries++) {\r
- if (blockNo == NumBlocksPerSector(sectorNo) - 1) { // sector trailer. At least the Access Conditions can always be read with key A.\r
+ if (blockNo == NumBlocksPerSector(sectorNo) - 1) { // sector trailer. At least the Access Conditions can always be read with key A.\r
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + blockNo, 0, 0}};\r
memcpy(c.d.asBytes, keys[0][sectorNo], 6);\r
SendCommand(&c);\r
// Don't try the other one on success.\r
if (resp.arg[0] & 0xff) break;\r
}\r
- } else { // data block. Check if it can be read with key A or key B\r
+ } else { // data block. Check if it can be read with key A or key B\r
uint8_t data_area = sectorNo<32?blockNo:blockNo/5;\r
- if ((rights[sectorNo][data_area] == 0x03) || (rights[sectorNo][data_area] == 0x05)) { // only key B would work\r
+ if ((rights[sectorNo][data_area] == 0x03) || (rights[sectorNo][data_area] == 0x05)) { // only key B would work\r
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + blockNo, 1, 0}};\r
memcpy(c.d.asBytes, keys[1][sectorNo], 6);\r
SendCommand(&c);\r
received = WaitForResponseTimeout(CMD_ACK,&resp,1500);\r
- } else if (rights[sectorNo][data_area] == 0x07) { // no key would work\r
+ } else if (rights[sectorNo][data_area] == 0x07) { // no key would work\r
PrintAndLog("Access rights do not allow reading of sector %2d block %3d", sectorNo, blockNo);\r
if (nullMissingKeys) {\r
memset(resp.d.asBytes, 0, 16);\r
isOK = false;\r
tries = 2;\r
}\r
- } else { // key A would work\r
+ } else { // key A would work\r
UsbCommand c = {CMD_MIFARE_READBL, {FirstBlockOfSector(sectorNo) + blockNo, 0, 0}};\r
memcpy(c.d.asBytes, keys[0][sectorNo], 6);\r
SendCommand(&c);\r
if (received) {\r
isOK = resp.arg[0] & 0xff;\r
uint8_t *data = resp.d.asBytes;\r
- if (blockNo == NumBlocksPerSector(sectorNo) - 1) { // sector trailer. Fill in the keys.\r
+ if (blockNo == NumBlocksPerSector(sectorNo) - 1) { // sector trailer. Fill in the keys.\r
memcpy(data, keys[0][sectorNo], 6);\r
memcpy(data + 10, keys[1][sectorNo], 6);\r
}\r
if (isOK) {\r
memcpy(carddata[FirstBlockOfSector(sectorNo) + blockNo], data, 16);\r
- PrintAndLog("Successfully read block %2d of sector %2d.", blockNo, sectorNo);\r
+ PrintAndLog("Successfully read block %2d of sector %2d.", blockNo, sectorNo);\r
} else {\r
PrintAndLog("Could not read block %2d of sector %2d", blockNo, sectorNo);\r
break;\r
return 2;\r
}\r
\r
- if (blockNo == NumBlocksPerSector(sectorNo) - 1) { // sector trailer\r
+ if (blockNo == NumBlocksPerSector(sectorNo) - 1) { // sector trailer\r
bldata[0] = (keyA[sectorNo][0]);\r
bldata[1] = (keyA[sectorNo][1]);\r
bldata[2] = (keyA[sectorNo][2]);\r
int len = param_getlength(Cmd, indx);\r
if (len > 0 && len < 4){\r
param_getstr(Cmd, indx, ctmp3, sizeof(ctmp3));\r
- \r
+\r
*paramT |= (ctmp3[0] == 't' || ctmp3[0] == 'T');\r
*paramD |= (ctmp3[0] == 'd' || ctmp3[0] == 'D');\r
bool paramS1 = *paramT || *paramD;\r
// slow and very slow\r
if (ctmp3[0] == 's' || ctmp3[0] == 'S' || ctmp3[1] == 's' || ctmp3[1] == 'S') {\r
*timeout = 11; // slow\r
- \r
+\r
if (!paramS1 && (ctmp3[1] == 's' || ctmp3[1] == 'S')) {\r
*timeout = 53; // very slow\r
}\r
uint64_t key64 = 0;\r
// timeout in units. (ms * 106)/10 or us*0.0106\r
uint8_t btimeout14a = MF_CHKKEYS_DEFTIMEOUT; // fast by default\r
- \r
+\r
bool autosearchKey = false;\r
\r
bool transferToEml = false;\r
} else {\r
SectorsCnt = ParamCardSizeSectors(cmdp);\r
}\r
- \r
+\r
// <block number>. number or autosearch key (*)\r
if (param_getchar(Cmd, 1) == '*') {\r
autosearchKey = true;\r
\r
parseParamTDS(Cmd, 2, &transferToEml, &createDumpFile, &btimeout14a);\r
\r
- PrintAndLog("--nested. sectors:%2d, block no:*, eml:%c, dmp=%c checktimeout=%d us", \r
+ PrintAndLog("--nested. sectors:%2d, block no:*, eml:%c, dmp=%c checktimeout=%d us",\r
SectorsCnt, transferToEml?'y':'n', createDumpFile?'y':'n', ((int)btimeout14a * 10000) / 106);\r
} else {\r
blockNo = param_get8(Cmd, 1);\r
}\r
\r
// one sector nested\r
- if (cmdp == 'o') { \r
+ if (cmdp == 'o') {\r
trgBlockNo = param_get8(Cmd, 4);\r
\r
ctmp = param_getchar(Cmd, 5);\r
parseParamTDS(Cmd, 4, &transferToEml, &createDumpFile, &btimeout14a);\r
}\r
\r
- PrintAndLog("--nested. sectors:%2d, block no:%3d, key type:%c, eml:%c, dmp=%c checktimeout=%d us", \r
+ PrintAndLog("--nested. sectors:%2d, block no:%3d, key type:%c, eml:%c, dmp=%c checktimeout=%d us",\r
SectorsCnt, blockNo, keyType?'B':'A', transferToEml?'y':'n', createDumpFile?'y':'n', ((int)btimeout14a * 10000) / 106);\r
}\r
\r
// transfer key to the emulator\r
if (transferToEml) {\r
uint8_t sectortrailer;\r
- if (trgBlockNo < 32*4) { // 4 block sector\r
+ if (trgBlockNo < 32*4) { // 4 block sector\r
sectortrailer = trgBlockNo | 0x03;\r
- } else { // 16 block sector\r
+ } else { // 16 block sector\r
sectortrailer = trgBlockNo | 0x0f;\r
}\r
mfEmlGetMem(keyBlock, sectortrailer, 1);\r
\r
PrintAndLog("Testing known keys. Sector count=%d", SectorsCnt);\r
mfCheckKeysSec(SectorsCnt, 2, btimeout14a, true, MifareDefaultKeysSize, keyBlock, e_sector);\r
- \r
+\r
// get known key from array\r
bool keyFound = false;\r
if (autosearchKey) {\r
}\r
}\r
if (keyFound) break;\r
- } \r
+ }\r
\r
// Can't found a key....\r
if (!keyFound) {\r
PrintAndLog("Found valid key:%012" PRIx64, key64);\r
e_sector[sectorNo].foundKey[trgKeyType] = 1;\r
e_sector[sectorNo].Key[trgKeyType] = key64;\r
- \r
+\r
// try to check this key as a key to the other sectors\r
mfCheckKeysSec(SectorsCnt, 2, btimeout14a, true, 1, keyBlock, e_sector);\r
}\r
// print nested statistic\r
PrintAndLog("\n\n-----------------------------------------------\nNested statistic:\nIterations count: %d", iterations);\r
PrintAndLog("Time in nested: %1.3f (%1.3f sec per key)", ((float)(msclock() - msclock1))/1000.0, ((float)(msclock() - msclock1))/iterations/1000.0);\r
- \r
+\r
// print result\r
PrintAndLog("|---|----------------|---|----------------|---|");\r
PrintAndLog("|sec|key A |res|key B |res|");\r
i++;\r
}\r
}\r
- \r
+\r
SetSIMDInstr(SIMD_AUTO);\r
if (iindx > 0) {\r
while ((ctmp = param_getchar(Cmd, iindx))) {\r
}\r
}\r
iindx++;\r
- } \r
+ }\r
}\r
\r
PrintAndLog("--target block no:%3d, target key type:%c, known target key: 0x%02x%02x%02x%02x%02x%02x%s, file action: %s, Slow: %s, Tests: %d ",\r
uint16_t stKeyBlock = 20;\r
\r
int i, res;\r
- int keycnt = 0;\r
- char ctmp = 0x00;\r
+ int keycnt = 0;\r
+ char ctmp = 0x00;\r
int clen = 0;\r
uint8_t blockNo = 0;\r
uint8_t SectorsCnt = 0;\r
\r
bool transferToEml = 0;\r
bool createDumpFile = 0;\r
- \r
+\r
sector_t *e_sector = NULL;\r
\r
keyBlock = calloc(stKeyBlock, 6);\r
}\r
\r
parseParamTDS(Cmd, 2, &transferToEml, &createDumpFile, &btimeout14a);\r
- \r
+\r
param3InUse = transferToEml | createDumpFile | (btimeout14a != MF_CHKKEYS_DEFTIMEOUT);\r
\r
- PrintAndLog("--chk keys. sectors:%2d, block no:%3d, key type:%c, eml:%c, dmp=%c checktimeout=%d us", \r
+ PrintAndLog("--chk keys. sectors:%2d, block no:%3d, key type:%c, eml:%c, dmp=%c checktimeout=%d us",\r
SectorsCnt, blockNo, keyType?'B':'A', transferToEml?'y':'n', createDumpFile?'y':'n', ((int)btimeout14a * 10000) / 106);\r
- \r
+\r
for (i = param3InUse; param_getchar(Cmd, 2 + i); i++) {\r
if (!param_gethex(Cmd, 2 + i, keyBlock + 6 * keycnt, 12)) {\r
if ( stKeyBlock - keycnt < 2) {\r
}\r
PrintAndLog("chk key[%2d] %02x%02x%02x%02x%02x%02x", keycnt,\r
(keyBlock + 6*keycnt)[0],(keyBlock + 6*keycnt)[1], (keyBlock + 6*keycnt)[2],\r
- (keyBlock + 6*keycnt)[3], (keyBlock + 6*keycnt)[4], (keyBlock + 6*keycnt)[5], 6);\r
+ (keyBlock + 6*keycnt)[3], (keyBlock + 6*keycnt)[4], (keyBlock + 6*keycnt)[5], 6);\r
keycnt++;\r
} else {\r
// May be a dic file\r
\r
while (fgetc(f) != '\n' && !feof(f)) ; //goto next line\r
\r
- if( buf[0]=='#' ) continue; //The line start with # is comment, skip\r
+ if( buf[0]=='#' ) continue; //The line start with # is comment, skip\r
\r
if (!isxdigit((unsigned char)buf[0])){\r
PrintAndLog("File content error. '%s' must include 12 HEX symbols",buf);\r
for (;keycnt < defaultKeysSize; keycnt++)\r
PrintAndLog("chk default key[%2d] %02x%02x%02x%02x%02x%02x", keycnt,\r
(keyBlock + 6*keycnt)[0],(keyBlock + 6*keycnt)[1], (keyBlock + 6*keycnt)[2],\r
- (keyBlock + 6*keycnt)[3], (keyBlock + 6*keycnt)[4], (keyBlock + 6*keycnt)[5], 6);\r
+ (keyBlock + 6*keycnt)[3], (keyBlock + 6*keycnt)[4], (keyBlock + 6*keycnt)[5], 6);\r
}\r
\r
// initialize storage for found keys\r
for (uint32_t c = 0; c < keycnt; c+=max_keys) {\r
\r
uint32_t size = keycnt-c > max_keys ? max_keys : keycnt-c;\r
- res = mfCheckKeys(blockNo, keyAB & 0x01, true, size, &keyBlock[6 * c], &key64); \r
+ res = mfCheckKeys(blockNo, keyAB & 0x01, true, size, &keyBlock[6 * c], &key64);\r
\r
if (res != 1) {\r
if (!res) {\r
}\r
} while(--keyAB > 0);\r
}\r
- \r
+\r
// print result\r
if (foundAKey) {\r
if (SectorsCnt) {\r
} else {\r
PrintAndLog("");\r
PrintAndLog("No valid keys found.");\r
- } \r
- \r
+ }\r
+\r
if (transferToEml) {\r
uint8_t block[16];\r
for (uint16_t sectorNo = 0; sectorNo < SectorsCnt; sectorNo++) {\r
\r
void readerAttack(nonces_t ar_resp[], bool setEmulatorMem, bool doStandardAttack) {\r
#define ATTACK_KEY_COUNT 7 // keep same as define in iso14443a.c -> Mifare1ksim()\r
- // cannot be more than 7 or it will overrun c.d.asBytes(512)\r
+ // cannot be more than 7 or it will overrun c.d.asBytes(512)\r
uint64_t key = 0;\r
typedef struct {\r
uint64_t keyA;\r
st_t sector_trailer[ATTACK_KEY_COUNT];\r
memset(sector_trailer, 0x00, sizeof(sector_trailer));\r
\r
- uint8_t stSector[ATTACK_KEY_COUNT];\r
+ uint8_t stSector[ATTACK_KEY_COUNT];\r
memset(stSector, 0x00, sizeof(stSector));\r
uint8_t key_cnt[ATTACK_KEY_COUNT];\r
memset(key_cnt, 0x00, sizeof(key_cnt));\r
if (setEmulatorMem) {\r
for (uint8_t i = 0; i<ATTACK_KEY_COUNT; i++) {\r
if (key_cnt[i]>0) {\r
- uint8_t memBlock[16];\r
+ uint8_t memBlock[16];\r
memset(memBlock, 0x00, sizeof(memBlock));\r
char cmd1[36];\r
memset(cmd1,0x00,sizeof(cmd1));\r
\r
while(param_getchar(Cmd, cmdp) != 0x00) {\r
switch(param_getchar(Cmd, cmdp)) {\r
- case '*': \r
+ case '*':\r
cardsize = param_getchar(Cmd + 1, cmdp);\r
switch(cardsize) {\r
case '0':\r
cardsize == '2' ? "2K" :\r
cardsize == '4' ? "4K" : "1K",\r
flags & FLAG_4B_UID_IN_DATA ? sprint_hex(uid,4):\r
- flags & FLAG_7B_UID_IN_DATA ? sprint_hex(uid,7): "N/A",\r
+ flags & FLAG_7B_UID_IN_DATA ? sprint_hex(uid,7): "N/A",\r
exitAfterNReads,\r
flags,\r
flags);\r
cardsize == '2' ? "2K" :\r
cardsize == '4' ? "4K" : "1K",\r
flags & FLAG_4B_UID_IN_DATA ? sprint_hex(uid,4):\r
- flags & FLAG_7B_UID_IN_DATA ? sprint_hex(uid,7): "N/A",\r
+ flags & FLAG_7B_UID_IN_DATA ? sprint_hex(uid,7): "N/A",\r
exitAfterNReads,\r
flags,\r
flags);\r
return 0;\r
}\r
\r
+\r
int CmdHF14AMfEKeyPrn(const char *Cmd)\r
{\r
int i;\r
- uint8_t numSectors;\r
+ uint8_t numSectors = 16;\r
uint8_t data[16];\r
uint64_t keyA, keyB;\r
+ bool createDumpFile = false;\r
\r
if (param_getchar(Cmd, 0) == 'h') {\r
PrintAndLog("It prints the keys loaded in the emulator memory");\r
- PrintAndLog("Usage: hf mf ekeyprn [card memory]");\r
+ PrintAndLog("Usage: hf mf ekeyprn [card memory] [d]");\r
PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K");\r
+ PrintAndLog(" [d] : write keys to binary file dumpkeys.bin");\r
PrintAndLog("");\r
PrintAndLog(" sample: hf mf ekeyprn 1");\r
return 0;\r
}\r
\r
- char cmdp = param_getchar(Cmd, 0);\r
-\r
- switch (cmdp) {\r
- case '0' : numSectors = 5; break;\r
- case '1' :\r
- case '\0': numSectors = 16; break;\r
- case '2' : numSectors = 32; break;\r
- case '4' : numSectors = 40; break;\r
- default: numSectors = 16;\r
+ uint8_t cmdp = 0;\r
+ while (param_getchar(Cmd, cmdp) != 0x00) {\r
+ switch (param_getchar(Cmd, cmdp)) {\r
+ case '0' : numSectors = 5; break;\r
+ case '1' :\r
+ case '\0': numSectors = 16; break;\r
+ case '2' : numSectors = 32; break;\r
+ case '4' : numSectors = 40; break;\r
+ case 'd' : \r
+ case 'D' : createDumpFile = true; break;\r
+ }\r
+ cmdp++;\r
}\r
\r
PrintAndLog("|---|----------------|----------------|");\r
}\r
PrintAndLog("|---|----------------|----------------|");\r
\r
+ // Create dump file\r
+ if (createDumpFile) {\r
+ FILE *fkeys;\r
+ if ((fkeys = fopen("dumpkeys.bin","wb")) == NULL) {\r
+ PrintAndLog("Could not create file dumpkeys.bin");\r
+ return 1;\r
+ }\r
+ PrintAndLog("Printing keys to binary file dumpkeys.bin...");\r
+ for(i = 0; i < numSectors; i++) {\r
+ if (mfEmlGetMem(data, FirstBlockOfSector(i) + NumBlocksPerSector(i) - 1, 1)) {\r
+ PrintAndLog("error get block %d", FirstBlockOfSector(i) + NumBlocksPerSector(i) - 1);\r
+ break;\r
+ }\r
+ fwrite(data+6, 1, 6, fkeys);\r
+ }\r
+ for(i = 0; i < numSectors; i++) {\r
+ if (mfEmlGetMem(data, FirstBlockOfSector(i) + NumBlocksPerSector(i) - 1, 1)) {\r
+ PrintAndLog("error get block %d", FirstBlockOfSector(i) + NumBlocksPerSector(i) - 1);\r
+ break;\r
+ }\r
+ fwrite(data+10, 1, 6, fkeys);\r
+ }\r
+ fclose(fkeys);\r
+ }\r
+\r
return 0;\r
}\r
\r
+\r
int CmdHF14AMfCSetUID(const char *Cmd)\r
{\r
uint8_t uid[8] = {0x00};\r
\r
uint8_t needHelp = 0;\r
char cmdp = 1;\r
- \r
+\r
if (param_getchar(Cmd, 0) && param_gethex(Cmd, 0, uid, 8)) {\r
PrintAndLog("UID must include 8 HEX symbols");\r
return 1;\r
if (param_getlength(Cmd, 1) > 1 && param_getlength(Cmd, 2) > 1) {\r
atqaPresent = 1;\r
cmdp = 3;\r
- \r
+\r
if (param_gethex(Cmd, 1, atqa, 4)) {\r
PrintAndLog("ATQA must include 4 HEX symbols");\r
return 1;\r
}\r
- \r
+\r
if (param_gethex(Cmd, 2, sak, 2)) {\r
PrintAndLog("SAK must include 2 HEX symbols");\r
return 1;\r
int numBlocks = 16 * 4;\r
bool wipeCard = false;\r
bool fillCard = false;\r
- \r
+\r
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {\r
PrintAndLog("Usage: hf mf cwipe [card size] [w] [f]");\r
PrintAndLog("sample: hf mf cwipe 1 w f");\r
}\r
\r
gen = mfCIdentify();\r
- if ((gen != 1) && (gen != 2)) \r
+ if ((gen != 1) && (gen != 2))\r
return 1;\r
- \r
+\r
numBlocks = ParamCardSizeBlocks(param_getchar(Cmd, 0));\r
\r
char cmdp = 0;\r
cmdp++;\r
}\r
\r
- if (!wipeCard && !fillCard) \r
+ if (!wipeCard && !fillCard)\r
wipeCard = true;\r
\r
PrintAndLog("--blocks count:%2d wipe:%c fill:%c", numBlocks, (wipeCard)?'y':'n', (fillCard)?'y':'n');\r
if (wipeCard) {\r
PrintAndLog("WARNING: can't wipe magic card 1b generation");\r
}\r
- res = mfCWipe(numBlocks, true, false, fillCard); \r
+ res = mfCWipe(numBlocks, true, false, fillCard);\r
} else {\r
/* generation 1a magic card by default */\r
- res = mfCWipe(numBlocks, false, wipeCard, fillCard); \r
+ res = mfCWipe(numBlocks, false, wipeCard, fillCard);\r
}\r
\r
if (res) {\r
}\r
\r
gen = mfCIdentify();\r
- if ((gen != 1) && (gen != 2)) \r
+ if ((gen != 1) && (gen != 2))\r
return 1;\r
\r
blockNo = param_get8(Cmd, 0);\r
PrintAndLog("Cant get block: %d", blockNum);\r
return 2;\r
}\r
- if (blockNum == 0) flags = CSETBLOCK_INIT_FIELD + CSETBLOCK_WUPC; // switch on field and send magic sequence\r
- if (blockNum == 1) flags = 0; // just write\r
- if (blockNum == numblock - 1) flags = CSETBLOCK_HALT + CSETBLOCK_RESET_FIELD; // Done. Magic Halt and switch off field.\r
+ if (blockNum == 0) flags = CSETBLOCK_INIT_FIELD + CSETBLOCK_WUPC; // switch on field and send magic sequence\r
+ if (blockNum == 1) flags = 0; // just write\r
+ if (blockNum == numblock - 1) flags = CSETBLOCK_HALT + CSETBLOCK_RESET_FIELD; // Done. Magic Halt and switch off field.\r
\r
if (gen == 2)\r
/* generation 1b magic card */\r
for (i = 0; i < 32; i += 2)\r
sscanf(&buf[i], "%02x", (unsigned int *)&buf8[i / 2]);\r
\r
- if (blockNum == 0) flags = CSETBLOCK_INIT_FIELD + CSETBLOCK_WUPC; // switch on field and send magic sequence\r
- if (blockNum == 1) flags = 0; // just write\r
- if (blockNum == numblock - 1) flags = CSETBLOCK_HALT + CSETBLOCK_RESET_FIELD; // Done. Switch off field.\r
+ if (blockNum == 0) flags = CSETBLOCK_INIT_FIELD + CSETBLOCK_WUPC; // switch on field and send magic sequence\r
+ if (blockNum == 1) flags = 0; // just write\r
+ if (blockNum == numblock - 1) flags = CSETBLOCK_HALT + CSETBLOCK_RESET_FIELD; // Done. Switch off field.\r
\r
if (gen == 2)\r
/* generation 1b magic card */\r
}\r
\r
PrintAndLog("block data:%s", sprint_hex(memBlock, 16));\r
- \r
+\r
if (mfIsSectorTrailer(blockNo)) {\r
PrintAndLogEx(NORMAL, "Trailer decoded:");\r
PrintAndLogEx(NORMAL, "Key A: %s", sprint_hex_inrow(memBlock, 6));\r
}\r
PrintAndLogEx(NORMAL, "UserData: %s", sprint_hex_inrow(&memBlock[9], 1));\r
}\r
- \r
+\r
return 0;\r
}\r
\r
}\r
\r
PrintAndLog("block %3d data:%s", baseblock + i, sprint_hex(memBlock, 16));\r
- \r
+\r
if (mfIsSectorTrailer(baseblock + i)) {\r
- PrintAndLogEx(NORMAL, "Trailer decoded:");\r
- PrintAndLogEx(NORMAL, "Key A: %s", sprint_hex_inrow(memBlock, 6));\r
- PrintAndLogEx(NORMAL, "Key B: %s", sprint_hex_inrow(&memBlock[10], 6));\r
- int bln = baseblock;\r
- int blinc = (mfNumBlocksPerSector(sectorNo) > 4) ? 5 : 1;\r
- for (int i = 0; i < 4; i++) {\r
- PrintAndLogEx(NORMAL, "Access block %d%s: %s", bln, ((blinc > 1) && (i < 3) ? "+" : "") , mfGetAccessConditionsDesc(i, &memBlock[6]));\r
- bln += blinc;\r
- }\r
- PrintAndLogEx(NORMAL, "UserData: %s", sprint_hex_inrow(&memBlock[9], 1));\r
- }\r
+ PrintAndLogEx(NORMAL, "Trailer decoded:");\r
+ PrintAndLogEx(NORMAL, "Key A: %s", sprint_hex_inrow(memBlock, 6));\r
+ PrintAndLogEx(NORMAL, "Key B: %s", sprint_hex_inrow(&memBlock[10], 6));\r
+ int bln = baseblock;\r
+ int blinc = (mfNumBlocksPerSector(sectorNo) > 4) ? 5 : 1;\r
+ for (int i = 0; i < 4; i++) {\r
+ PrintAndLogEx(NORMAL, "Access block %d%s: %s", bln, ((blinc > 1) && (i < 3) ? "+" : "") , mfGetAccessConditionsDesc(i, &memBlock[6]));\r
+ bln += blinc;\r
+ }\r
+ PrintAndLogEx(NORMAL, "UserData: %s", sprint_hex_inrow(&memBlock[9], 1));\r
+ }\r
}\r
return 0;\r
}\r
uint16_t traceLen = resp.arg[1];\r
len = resp.arg[2];\r
\r
- if (res == 0) { // we are done\r
+ if (res == 0) { // we are done\r
break;\r
}\r
\r
- if (res == 1) { // there is (more) data to be transferred\r
- if (pckNum == 0) { // first packet, (re)allocate necessary buffer\r
+ if (res == 1) { // there is (more) data to be transferred\r
+ if (pckNum == 0) { // first packet, (re)allocate necessary buffer\r
if (traceLen > bufsize || buf == NULL) {\r
uint8_t *p;\r
- if (buf == NULL) { // not yet allocated\r
+ if (buf == NULL) { // not yet allocated\r
p = malloc(traceLen);\r
- } else { // need more memory\r
+ } else { // need more memory\r
p = realloc(buf, traceLen);\r
}\r
if (p == NULL) {\r
pckNum++;\r
}\r
\r
- if (res == 2) { // received all data, start displaying\r
+ if (res == 2) { // received all data, start displaying\r
blockLen = bufPtr - buf;\r
bufPtr = buf;\r
printf(">\n");\r
PrintAndLog("received trace len: %d packages: %d", blockLen, pckNum);\r
while (bufPtr - buf < blockLen) {\r
- bufPtr += 6; // skip (void) timing information\r
+ bufPtr += 6; // skip (void) timing information\r
len = *((uint16_t *)bufPtr);\r
if(len & 0x8000) {\r
isTag = true;\r
mfTraceInit(uid, atqa, sak, wantSaveToEmlFile);\r
} else {\r
oddparitybuf(bufPtr, len, parity);\r
- PrintAndLog("%s(%d):%s [%s] c[%s]%c", \r
- isTag ? "TAG":"RDR", \r
- num, \r
- sprint_hex(bufPtr, len), \r
- printBitsPar(bufPtr + len, len), \r
+ PrintAndLog("%s(%d):%s [%s] c[%s]%c",\r
+ isTag ? "TAG":"RDR",\r
+ num,\r
+ sprint_hex(bufPtr, len),\r
+ printBitsPar(bufPtr + len, len),\r
printBitsPar(parity, len),\r
memcmp(bufPtr + len, parity, len / 8 + 1) ? '!' : ' ');\r
if (wantLogToFile)\r
num++;\r
}\r
bufPtr += len;\r
- bufPtr += parlen; // ignore parity\r
+ bufPtr += parlen; // ignore parity\r
}\r
pckNum = 0;\r
}\r
} // while (true)\r
\r
free(buf);\r
- \r
+\r
msleep(300); // wait for exiting arm side.\r
PrintAndLog("Done.");\r
return 0;\r
uint8_t key[16] = {0};\r
int keylen = 0;\r
\r
- CLIParserInit("hf mf auth4", \r
- "Executes AES authentication command in ISO14443-4", \r
+ CLIParserInit("hf mf auth4",\r
+ "Executes AES authentication command in ISO14443-4",\r
"Usage:\n\thf mf auth4 4000 000102030405060708090a0b0c0d0e0f -> executes authentication\n"\r
"\thf mf auth4 9003 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -> executes authentication\n");\r
\r
arg_param_end\r
};\r
CLIExecWithReturn(cmd, argtable, true);\r
- \r
+\r
CLIGetHexWithReturn(1, keyn, &keynlen);\r
CLIGetHexWithReturn(2, key, &keylen);\r
CLIParserFree();\r
- \r
+\r
if (keynlen != 2) {\r
PrintAndLog("ERROR: <Key Num> must be 2 bytes long instead of: %d", keynlen);\r
return 1;\r
}\r
- \r
+\r
if (keylen != 16) {\r
PrintAndLog("ERROR: <Key Value> must be 16 bytes long instead of: %d", keylen);\r
return 1;\r
// https://www.nxp.com/docs/en/application-note/AN10787.pdf\r
int CmdHF14AMfMAD(const char *cmd) {\r
\r
- CLIParserInit("hf mf mad",\r
- "Checks and prints Mifare Application Directory (MAD)",\r
- "Usage:\n\thf mf mad -> shows MAD if exists\n"\r
- "\thf mf mad -a 03e1 -k ffffffffffff -b -> shows NDEF data if exists. read card with custom key and key B\n");\r
-\r
- void *argtable[] = {\r
- arg_param_begin,\r
- arg_lit0("vV", "verbose", "show technical data"),\r
- arg_str0("aA", "aid", "print all sectors with aid", NULL),\r
- arg_str0("kK", "key", "key for printing sectors", NULL),\r
- arg_lit0("bB", "keyb", "use key B for access printing sectors (by default: key A)"),\r
- arg_param_end\r
- };\r
- CLIExecWithReturn(cmd, argtable, true);\r
- bool verbose = arg_get_lit(1);\r
- uint8_t aid[2] = {0};\r
- int aidlen;\r
- CLIGetHexWithReturn(2, aid, &aidlen);\r
- uint8_t key[6] = {0};\r
- int keylen;\r
- CLIGetHexWithReturn(3, key, &keylen);\r
- bool keyB = arg_get_lit(4);\r
-\r
- CLIParserFree();\r
-\r
- if (aidlen != 2 && keylen > 0) {\r
- PrintAndLogEx(WARNING, "do not need a key without aid.");\r
- }\r
-\r
- uint8_t sector0[16 * 4] = {0};\r
- uint8_t sector10[16 * 4] = {0};\r
- if (mfReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector0)) {\r
- PrintAndLogEx(ERR, "read sector 0 error. card don't have MAD or don't have MAD on default keys.");\r
- return 2;\r
- }\r
-\r
- if (verbose) {\r
- for (int i = 0; i < 4; i ++)\r
- PrintAndLogEx(NORMAL, "[%d] %s", i, sprint_hex(§or0[i * 16], 16));\r
- }\r
-\r
- bool haveMAD2 = false;\r
- MAD1DecodeAndPrint(sector0, verbose, &haveMAD2);\r
-\r
- if (haveMAD2) {\r
- if (mfReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector10)) {\r
- PrintAndLogEx(ERR, "read sector 0x10 error. card don't have MAD or don't have MAD on default keys.");\r
- return 2;\r
- }\r
-\r
- MAD2DecodeAndPrint(sector10, verbose);\r
- }\r
-\r
- if (aidlen == 2) {\r
- uint16_t aaid = (aid[0] << 8) + aid[1];\r
- PrintAndLogEx(NORMAL, "\n-------------- AID 0x%04x ---------------", aaid);\r
-\r
- uint16_t mad[7 + 8 + 8 + 8 + 8] = {0};\r
- size_t madlen = 0;\r
- if (MADDecode(sector0, sector10, mad, &madlen)) {\r
- PrintAndLogEx(ERR, "can't decode mad.");\r
- return 10;\r
- }\r
-\r
- uint8_t akey[6] = {0};\r
- memcpy(akey, g_mifare_ndef_key, 6);\r
- if (keylen == 6) {\r
- memcpy(akey, key, 6);\r
- }\r
-\r
- for (int i = 0; i < madlen; i++) {\r
- if (aaid == mad[i]) {\r
- uint8_t vsector[16 * 4] = {0};\r
- if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, akey, vsector)) {\r
- PrintAndLogEx(NORMAL, "");\r
- PrintAndLogEx(ERR, "read sector %d error.", i + 1);\r
- return 2;\r
- }\r
-\r
- for (int j = 0; j < (verbose ? 4 : 3); j ++)\r
- PrintAndLogEx(NORMAL, " [%03d] %s", (i + 1) * 4 + j, sprint_hex(&vsector[j * 16], 16));\r
- }\r
- }\r
- }\r
-\r
- return 0;\r
+ CLIParserInit("hf mf mad",\r
+ "Checks and prints Mifare Application Directory (MAD)",\r
+ "Usage:\n\thf mf mad -> shows MAD if exists\n"\r
+ "\thf mf mad -a 03e1 -k ffffffffffff -b -> shows NDEF data if exists. read card with custom key and key B\n");\r
+\r
+ void *argtable[] = {\r
+ arg_param_begin,\r
+ arg_lit0("vV", "verbose", "show technical data"),\r
+ arg_str0("aA", "aid", "print all sectors with aid", NULL),\r
+ arg_str0("kK", "key", "key for printing sectors", NULL),\r
+ arg_lit0("bB", "keyb", "use key B for access printing sectors (by default: key A)"),\r
+ arg_param_end\r
+ };\r
+ CLIExecWithReturn(cmd, argtable, true);\r
+ bool verbose = arg_get_lit(1);\r
+ uint8_t aid[2] = {0};\r
+ int aidlen;\r
+ CLIGetHexWithReturn(2, aid, &aidlen);\r
+ uint8_t key[6] = {0};\r
+ int keylen;\r
+ CLIGetHexWithReturn(3, key, &keylen);\r
+ bool keyB = arg_get_lit(4);\r
+\r
+ CLIParserFree();\r
+\r
+ if (aidlen != 2 && keylen > 0) {\r
+ PrintAndLogEx(WARNING, "do not need a key without aid.");\r
+ }\r
+\r
+ uint8_t sector0[16 * 4] = {0};\r
+ uint8_t sector10[16 * 4] = {0};\r
+ if (mfReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector0)) {\r
+ PrintAndLogEx(ERR, "read sector 0 error. card don't have MAD or don't have MAD on default keys.");\r
+ return 2;\r
+ }\r
+\r
+ if (verbose) {\r
+ for (int i = 0; i < 4; i ++)\r
+ PrintAndLogEx(NORMAL, "[%d] %s", i, sprint_hex(§or0[i * 16], 16));\r
+ }\r
+\r
+ bool haveMAD2 = false;\r
+ MAD1DecodeAndPrint(sector0, verbose, &haveMAD2);\r
+\r
+ if (haveMAD2) {\r
+ if (mfReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector10)) {\r
+ PrintAndLogEx(ERR, "read sector 0x10 error. card don't have MAD or don't have MAD on default keys.");\r
+ return 2;\r
+ }\r
+\r
+ MAD2DecodeAndPrint(sector10, verbose);\r
+ }\r
+\r
+ if (aidlen == 2) {\r
+ uint16_t aaid = (aid[0] << 8) + aid[1];\r
+ PrintAndLogEx(NORMAL, "\n-------------- AID 0x%04x ---------------", aaid);\r
+\r
+ uint16_t mad[7 + 8 + 8 + 8 + 8] = {0};\r
+ size_t madlen = 0;\r
+ if (MADDecode(sector0, sector10, mad, &madlen)) {\r
+ PrintAndLogEx(ERR, "can't decode mad.");\r
+ return 10;\r
+ }\r
+\r
+ uint8_t akey[6] = {0};\r
+ memcpy(akey, g_mifare_ndef_key, 6);\r
+ if (keylen == 6) {\r
+ memcpy(akey, key, 6);\r
+ }\r
+\r
+ for (int i = 0; i < madlen; i++) {\r
+ if (aaid == mad[i]) {\r
+ uint8_t vsector[16 * 4] = {0};\r
+ if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, akey, vsector)) {\r
+ PrintAndLogEx(NORMAL, "");\r
+ PrintAndLogEx(ERR, "read sector %d error.", i + 1);\r
+ return 2;\r
+ }\r
+\r
+ for (int j = 0; j < (verbose ? 4 : 3); j ++)\r
+ PrintAndLogEx(NORMAL, " [%03d] %s", (i + 1) * 4 + j, sprint_hex(&vsector[j * 16], 16));\r
+ }\r
+ }\r
+ }\r
+\r
+ return 0;\r
}\r
\r
int CmdHFMFNDEF(const char *cmd) {\r
\r
- CLIParserInit("hf mf ndef",\r
- "Prints NFC Data Exchange Format (NDEF)",\r
- "Usage:\n\thf mf ndef -> shows NDEF data\n"\r
- "\thf mf ndef -a 03e1 -k ffffffffffff -b -> shows NDEF data with custom AID, key and with key B\n");\r
-\r
- void *argtable[] = {\r
- arg_param_begin,\r
- arg_litn("vV", "verbose", 0, 2, "show technical data"),\r
- arg_str0("aA", "aid", "replace default aid for NDEF", NULL),\r
- arg_str0("kK", "key", "replace default key for NDEF", NULL),\r
- arg_lit0("bB", "keyb", "use key B for access sectors (by default: key A)"),\r
- arg_param_end\r
- };\r
- CLIExecWithReturn(cmd, argtable, true);\r
-\r
- bool verbose = arg_get_lit(1);\r
- bool verbose2 = arg_get_lit(1) > 1;\r
- uint8_t aid[2] = {0};\r
- int aidlen;\r
- CLIGetHexWithReturn(2, aid, &aidlen);\r
- uint8_t key[6] = {0};\r
- int keylen;\r
- CLIGetHexWithReturn(3, key, &keylen);\r
- bool keyB = arg_get_lit(4);\r
-\r
- CLIParserFree();\r
-\r
- uint16_t ndefAID = 0x03e1;\r
- if (aidlen == 2)\r
- ndefAID = (aid[0] << 8) + aid[1];\r
-\r
- uint8_t ndefkey[6] = {0};\r
- memcpy(ndefkey, g_mifare_ndef_key, 6);\r
- if (keylen == 6) {\r
- memcpy(ndefkey, key, 6);\r
- }\r
-\r
- uint8_t sector0[16 * 4] = {0};\r
- uint8_t sector10[16 * 4] = {0};\r
- uint8_t data[4096] = {0};\r
- int datalen = 0;\r
-\r
- PrintAndLogEx(NORMAL, "");\r
-\r
- if (mfReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector0)) {\r
- PrintAndLogEx(ERR, "read sector 0 error. card don't have MAD or don't have MAD on default keys.");\r
- return 2;\r
- }\r
-\r
- bool haveMAD2 = false;\r
- int res = MADCheck(sector0, NULL, verbose, &haveMAD2);\r
- if (res) {\r
- PrintAndLogEx(ERR, "MAD error %d.", res);\r
- return res;\r
- }\r
-\r
- if (haveMAD2) {\r
- if (mfReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector10)) {\r
- PrintAndLogEx(ERR, "read sector 0x10 error. card don't have MAD or don't have MAD on default keys.");\r
- return 2;\r
- }\r
- }\r
-\r
- uint16_t mad[7 + 8 + 8 + 8 + 8] = {0};\r
- size_t madlen = 0;\r
- if (MADDecode(sector0, (haveMAD2 ? sector10 : NULL), mad, &madlen)) {\r
- PrintAndLogEx(ERR, "can't decode mad.");\r
- return 10;\r
- }\r
-\r
- printf("data reading:");\r
- for (int i = 0; i < madlen; i++) {\r
- if (ndefAID == mad[i]) {\r
- uint8_t vsector[16 * 4] = {0};\r
- if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, ndefkey, vsector)) {\r
- PrintAndLogEx(ERR, "read sector %d error.", i + 1);\r
- return 2;\r
- }\r
-\r
- memcpy(&data[datalen], vsector, 16 * 3);\r
- datalen += 16 * 3;\r
-\r
- printf(".");\r
- }\r
- }\r
- printf(" OK\n");\r
-\r
- if (!datalen) {\r
- PrintAndLogEx(ERR, "no NDEF data.");\r
- return 11;\r
- }\r
-\r
- if (verbose2) {\r
- PrintAndLogEx(NORMAL, "NDEF data:");\r
- dump_buffer(data, datalen, stdout, 1);\r
- }\r
-\r
- NDEFDecodeAndPrint(data, datalen, verbose);\r
-\r
- return 0;\r
+ CLIParserInit("hf mf ndef",\r
+ "Prints NFC Data Exchange Format (NDEF)",\r
+ "Usage:\n\thf mf ndef -> shows NDEF data\n"\r
+ "\thf mf ndef -a 03e1 -k ffffffffffff -b -> shows NDEF data with custom AID, key and with key B\n");\r
+\r
+ void *argtable[] = {\r
+ arg_param_begin,\r
+ arg_litn("vV", "verbose", 0, 2, "show technical data"),\r
+ arg_str0("aA", "aid", "replace default aid for NDEF", NULL),\r
+ arg_str0("kK", "key", "replace default key for NDEF", NULL),\r
+ arg_lit0("bB", "keyb", "use key B for access sectors (by default: key A)"),\r
+ arg_param_end\r
+ };\r
+ CLIExecWithReturn(cmd, argtable, true);\r
+\r
+ bool verbose = arg_get_lit(1);\r
+ bool verbose2 = arg_get_lit(1) > 1;\r
+ uint8_t aid[2] = {0};\r
+ int aidlen;\r
+ CLIGetHexWithReturn(2, aid, &aidlen);\r
+ uint8_t key[6] = {0};\r
+ int keylen;\r
+ CLIGetHexWithReturn(3, key, &keylen);\r
+ bool keyB = arg_get_lit(4);\r
+\r
+ CLIParserFree();\r
+\r
+ uint16_t ndefAID = 0x03e1;\r
+ if (aidlen == 2)\r
+ ndefAID = (aid[0] << 8) + aid[1];\r
+\r
+ uint8_t ndefkey[6] = {0};\r
+ memcpy(ndefkey, g_mifare_ndef_key, 6);\r
+ if (keylen == 6) {\r
+ memcpy(ndefkey, key, 6);\r
+ }\r
+\r
+ uint8_t sector0[16 * 4] = {0};\r
+ uint8_t sector10[16 * 4] = {0};\r
+ uint8_t data[4096] = {0};\r
+ int datalen = 0;\r
+\r
+ PrintAndLogEx(NORMAL, "");\r
+\r
+ if (mfReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector0)) {\r
+ PrintAndLogEx(ERR, "read sector 0 error. card don't have MAD or don't have MAD on default keys.");\r
+ return 2;\r
+ }\r
+\r
+ bool haveMAD2 = false;\r
+ int res = MADCheck(sector0, NULL, verbose, &haveMAD2);\r
+ if (res) {\r
+ PrintAndLogEx(ERR, "MAD error %d.", res);\r
+ return res;\r
+ }\r
+\r
+ if (haveMAD2) {\r
+ if (mfReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector10)) {\r
+ PrintAndLogEx(ERR, "read sector 0x10 error. card don't have MAD or don't have MAD on default keys.");\r
+ return 2;\r
+ }\r
+ }\r
+\r
+ uint16_t mad[7 + 8 + 8 + 8 + 8] = {0};\r
+ size_t madlen = 0;\r
+ if (MADDecode(sector0, (haveMAD2 ? sector10 : NULL), mad, &madlen)) {\r
+ PrintAndLogEx(ERR, "can't decode mad.");\r
+ return 10;\r
+ }\r
+\r
+ printf("data reading:");\r
+ for (int i = 0; i < madlen; i++) {\r
+ if (ndefAID == mad[i]) {\r
+ uint8_t vsector[16 * 4] = {0};\r
+ if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, ndefkey, vsector)) {\r
+ PrintAndLogEx(ERR, "read sector %d error.", i + 1);\r
+ return 2;\r
+ }\r
+\r
+ memcpy(&data[datalen], vsector, 16 * 3);\r
+ datalen += 16 * 3;\r
+\r
+ printf(".");\r
+ }\r
+ }\r
+ printf(" OK\n");\r
+\r
+ if (!datalen) {\r
+ PrintAndLogEx(ERR, "no NDEF data.");\r
+ return 11;\r
+ }\r
+\r
+ if (verbose2) {\r
+ PrintAndLogEx(NORMAL, "NDEF data:");\r
+ dump_buffer(data, datalen, stdout, 1);\r
+ }\r
+\r
+ NDEFDecodeAndPrint(data, datalen, verbose);\r
+\r
+ return 0;\r
}\r
\r
static command_t CommandTable[] =\r
{"rdbl", CmdHF14AMfRdBl, 0, "Read MIFARE classic block"},\r
{"rdsc", CmdHF14AMfRdSc, 0, "Read MIFARE classic sector"},\r
{"dump", CmdHF14AMfDump, 0, "Dump MIFARE classic tag to binary file"},\r
- {"restore", CmdHF14AMfRestore, 0, "Restore MIFARE classic binary file to BLANK tag"},\r
+ {"restore", CmdHF14AMfRestore, 0, "Restore MIFARE classic binary file to BLANK tag"},\r
{"wrbl", CmdHF14AMfWrBl, 0, "Write MIFARE classic block"},\r
{"auth4", CmdHF14AMfAuth4, 0, "ISO14443-4 AES authentication"},\r
{"chk", CmdHF14AMfChk, 0, "Test block keys"},\r