diff --git a/client/src/cmdlfem4x50.c b/client/src/cmdlfem4x50.c index 28cea1244..a20808d43 100644 --- a/client/src/cmdlfem4x50.c +++ b/client/src/cmdlfem4x50.c @@ -683,9 +683,11 @@ int CmdEM4x50Dump(const char *Cmd) { // saveFileEML will add .eml extension to filename // saveFile (binary) passes in the .bin extension. + // saveFileJSON adds .json extension saveFileEML(filename, data, sizeof(data), 4); saveFile(filename, ".bin", data, sizeof(data)); - //saveFileJSON... + saveFileJSON(filename, jsfEM4x50, data, sizeof(data), NULL); + return PM3_SUCCESS; } diff --git a/client/src/fileutils.c b/client/src/fileutils.c index ab4a7d241..a304a4f42 100644 --- a/client/src/fileutils.c +++ b/client/src/fileutils.c @@ -521,6 +521,20 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data, } break; } + case jsfEM4x50: { + JsonSaveStr(root, "FileType", "EM4X50"); + JsonSaveBufAsHexCompact(root, "$.Card.Protection", data + (1 * 4), 4); + JsonSaveBufAsHexCompact(root, "$.Card.Config", data + (2 * 4), 4); + JsonSaveBufAsHexCompact(root, "$.Card.Serial", data + (32 * 4), 4); + JsonSaveBufAsHexCompact(root, "$.Card.UID", data + (33 * 4), 4); + + for (size_t i = 0; i < (datalen / 4); i++) { + char path[PATH_MAX_LENGTH] = {0}; + sprintf(path, "$.blocks.%zu", i); + JsonSaveBufAsHexCompact(root, path, data + (i * 4), 4); + } + break; + } case jsfMfPlusKeys: { JsonSaveStr(root, "FileType", "mfp"); JsonSaveBufAsHexCompact(root, "$.Card.UID", &data[0], 7); diff --git a/client/src/fileutils.h b/client/src/fileutils.h index 49992c998..e307a2492 100644 --- a/client/src/fileutils.h +++ b/client/src/fileutils.h @@ -66,6 +66,7 @@ typedef enum { jsfMfDesfireKeys, jsfEM4x05, jsfEM4x69, + jsfEM4x50, } JSONFileType; typedef enum {