mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
client: fileutils: iso15sim: add jfs15_v4 JSON format to fit eml fmt
This commit is contained in:
parent
e5f519e085
commit
ddaba93d32
2 changed files with 64 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "cmdhficlass.h" // pagemap
|
#include "cmdhficlass.h" // pagemap
|
||||||
#include "iclass_cmd.h"
|
#include "iclass_cmd.h"
|
||||||
|
#include "iso15.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "scandir.h"
|
#include "scandir.h"
|
||||||
|
@ -518,6 +519,33 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// handles ISO15693 in iso15_tag_t format
|
||||||
|
case jsf15_v4: {
|
||||||
|
JsonSaveStr(root, "FileType", "15693 v4");
|
||||||
|
iso15_tag_t *tag = (iso15_tag_t *)data;
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.uid", tag->uid, 8);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.dsfid", &tag->dsfid, 1);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.dsfidLock", (uint8_t*)&tag->dsfidLock, 1);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.afi", &tag->afi, 1);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.afiLock", (uint8_t*)&tag->afiLock, 1);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.bytesPerPage", &tag->bytesPerPage, 1);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.pagesCount", &tag->pagesCount, 1);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.IC", &tag->ic, 1);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.locks", tag->locks, tag->pagesCount);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.random", tag->random, 2);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.privacyPasswd", tag->privacyPasswd, 4);
|
||||||
|
JsonSaveBufAsHexCompact(root, "$.Card.state", (uint8_t*)&tag->state, 1);
|
||||||
|
|
||||||
|
for (size_t i = 0 ; i < tag->pagesCount ; i++) {
|
||||||
|
if (((i+1) * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE)
|
||||||
|
break;
|
||||||
|
snprintf(path, sizeof(path), "$.blocks.%zu", i);
|
||||||
|
JsonSaveBufAsHexCompact(root, path,
|
||||||
|
&tag->data[i * tag->bytesPerPage],
|
||||||
|
tag->bytesPerPage);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case jsfLegic_v2: {
|
case jsfLegic_v2: {
|
||||||
JsonSaveStr(root, "FileType", "legic v2");
|
JsonSaveStr(root, "FileType", "legic v2");
|
||||||
JsonSaveBufAsHexCompact(root, "$.Card.UID", data, 4);
|
JsonSaveBufAsHexCompact(root, "$.Card.UID", data, 4);
|
||||||
|
@ -1673,6 +1701,41 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(ctype, "15693 v4")) {
|
||||||
|
iso15_tag_t *tag = (iso15_tag_t *)udata.bytes;
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.UID", tag->uid, 8, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.dsfid", &tag->dsfid, 1, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.dsfidLock", (uint8_t*)&tag->dsfidLock, 1, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.afi", &tag->afi, 1, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.afiLock", (uint8_t*)&tag->afiLock, 1, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.bytesPerPage", &tag->bytesPerPage, 1, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.pagesCount", &tag->pagesCount, 1, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.IC", &tag->ic, 1, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.locks", tag->locks, tag->pagesCount, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.random", tag->random, 2, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.privacyPasswd", tag->privacyPasswd, 4, datalen);
|
||||||
|
JsonLoadBufAsHex(root, "$.Card.state", (uint8_t*)&tag->state, 1, datalen);
|
||||||
|
|
||||||
|
size_t sptr = 0;
|
||||||
|
for (int i = 0; i < tag->pagesCount ; i++) {
|
||||||
|
if (((i+1) * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) {
|
||||||
|
PrintAndLogEx(ERR, "loadFileJSONex: maxdatalen=%zu (%04zx) block (i)=%4d (%04x) sptr=%zu (%04zx) -- exceeded maxdatalen", maxdatalen, maxdatalen, i, i, sptr, sptr);
|
||||||
|
retval = PM3_EMALLOC;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(blocks, sizeof(blocks), "$.blocks.%d", i);
|
||||||
|
JsonLoadBufAsHex(root, blocks, &tag->data[sptr], tag->bytesPerPage, &len);
|
||||||
|
if (load_file_sanity(ctype, tag->bytesPerPage, i, len) == false) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sptr += len;
|
||||||
|
}
|
||||||
|
|
||||||
|
*datalen = sptr;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp(ctype, "legic v2")) {
|
if (!strcmp(ctype, "legic v2")) {
|
||||||
size_t sptr = 0;
|
size_t sptr = 0;
|
||||||
for (int i = 0; i < 64; i++) {
|
for (int i = 0; i < 64; i++) {
|
||||||
|
|
|
@ -55,6 +55,7 @@ typedef enum {
|
||||||
jsf15,
|
jsf15,
|
||||||
jsf15_v2,
|
jsf15_v2,
|
||||||
jsf15_v3,
|
jsf15_v3,
|
||||||
|
jsf15_v4,
|
||||||
jsfLegic,
|
jsfLegic,
|
||||||
jsfLegic_v2,
|
jsfLegic_v2,
|
||||||
jsfT55x7,
|
jsfT55x7,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue