uint8_t isOK = resp.arg[0] & 0xff;\r
uint8_t *data = resp.d.asBytes;\r
\r
- if (isOK)\r
+ if (isOK) {\r
PrintAndLog("isOk:%02x data:%s", isOK, sprint_hex(data, 16));\r
- else\r
+ } else {\r
PrintAndLog("isOk:%02x", isOK);\r
+ return 1;\r
+ }\r
+\r
+ if (mfIsSectorTrailer(blockNo) && (data[6] || data[7] || data[8])) {\r
+ PrintAndLogEx(NORMAL, "Trailer decoded:");\r
+ int bln = mfFirstBlockOfSector(mfSectorNum(blockNo));\r
+ int blinc = (mfNumBlocksPerSector(mfSectorNum(blockNo)) > 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, &data[6]));\r
+ bln += blinc;\r
+ }\r
+ PrintAndLogEx(NORMAL, "UserData: %s", sprint_hex_inrow(&data[9], 1));\r
+ }\r
} else {\r
PrintAndLog("Command execute timeout");\r
+ return 2;\r
}\r
\r
return 0;\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
+ 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
}\r
} else {\r
PrintAndLog("Command execute timeout");\r
}\r
\r
PrintAndLog("block data:%s", sprint_hex(memBlock, 16));\r
+ \r
+ if (mfIsSectorTrailer(blockNo)) {\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 = mfFirstBlockOfSector(mfSectorNum(blockNo));\r
+ int blinc = (mfNumBlocksPerSector(mfSectorNum(blockNo)) > 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
\r
}\r
\r
PrintAndLog("block %3d data:%s", baseblock + i, sprint_hex(memBlock, 16));\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
}\r
return 0;\r
}\r