mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
Fix hf mf dump/auto/csave MFC JSON dumps - save real ATQA/SAK
This commit is contained in:
parent
347b5c9614
commit
1850e9fa40
4 changed files with 92 additions and 19 deletions
|
@ -375,29 +375,25 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
|
|||
break;
|
||||
}
|
||||
case jsfCardMemory: {
|
||||
iso14a_mf_extdump_t* xdump = (iso14a_mf_extdump_t*) data;
|
||||
JsonSaveStr(root, "FileType", "mfcard");
|
||||
for (size_t i = 0; i < (datalen / 16); i++) {
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.UID", xdump->card_info.uid, xdump->card_info.uidlen);
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.ATQA", xdump->card_info.atqa, 2);
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.SAK", &(xdump->card_info.sak), 1);
|
||||
for (size_t i = 0; i < (xdump->dumplen / 16); i++) {
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
sprintf(path, "$.blocks.%zu", i);
|
||||
JsonSaveBufAsHexCompact(root, path, &data[i * 16], 16);
|
||||
|
||||
if (i == 0) {
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.UID", &data[0], 4);
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.SAK", &data[5], 1);
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.ATQA", &data[6], 2);
|
||||
}
|
||||
|
||||
JsonSaveBufAsHexCompact(root, path, &xdump->dump[i * 16], 16);
|
||||
if (mfIsSectorTrailer(i)) {
|
||||
|
||||
snprintf(path, sizeof(path), "$.SectorKeys.%d.KeyA", mfSectorNum(i));
|
||||
JsonSaveBufAsHexCompact(root, path, &data[i * 16], 6);
|
||||
JsonSaveBufAsHexCompact(root, path, &xdump->dump[i * 16], 6);
|
||||
|
||||
snprintf(path, sizeof(path), "$.SectorKeys.%d.KeyB", mfSectorNum(i));
|
||||
JsonSaveBufAsHexCompact(root, path, &data[i * 16 + 10], 6);
|
||||
JsonSaveBufAsHexCompact(root, path, &xdump->dump[i * 16 + 10], 6);
|
||||
|
||||
uint8_t *adata = &data[i * 16 + 6];
|
||||
uint8_t *adata = &xdump->dump[i * 16 + 6];
|
||||
snprintf(path, sizeof(path), "$.SectorKeys.%d.AccessConditions", mfSectorNum(i));
|
||||
JsonSaveBufAsHexCompact(root, path, &data[i * 16 + 6], 4);
|
||||
JsonSaveBufAsHexCompact(root, path, &xdump->dump[i * 16 + 6], 4);
|
||||
|
||||
snprintf(path, sizeof(path), "$.SectorKeys.%d.AccessConditionsText.block%zu", mfSectorNum(i), i - 3);
|
||||
JsonSaveStr(root, path, mfGetAccessConditionsDesc(0, adata));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue