mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 02:27:26 -07:00
CHG: 'lf hitag sim' - now loads from BIN/EML/JSON. Also merged it with 'lf hitag simS', which is removed.
This commit is contained in:
parent
072e83bc49
commit
e3afad8758
3 changed files with 132 additions and 66 deletions
|
@ -463,8 +463,29 @@ int loadFileJSON(const char *preferredName, const char *suffix, void *data, size
|
|||
*datalen = sptr;
|
||||
}
|
||||
|
||||
if (!strcmp(ctype, "hitag")) {
|
||||
size_t sptr = 0;
|
||||
for (int i = 0; i < (maxdatalen/4); i++) {
|
||||
if (sptr + 4 > maxdatalen) {
|
||||
retval = 5;
|
||||
goto out;
|
||||
}
|
||||
|
||||
PrintAndLog("loaded from JSON file " _YELLOW_("%s"), fileName);
|
||||
char path[30] = {0};
|
||||
sprintf(path, "$.blocks.%d", i);
|
||||
|
||||
size_t len = 0;
|
||||
JsonLoadBufAsHex(root, path, &udata[sptr], 4, &len);
|
||||
if (!len)
|
||||
break;
|
||||
|
||||
sptr += len;
|
||||
}
|
||||
|
||||
*datalen = sptr;
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, "loaded from JSON file " _YELLOW_("%s"), fileName);
|
||||
out:
|
||||
json_decref(root);
|
||||
free(fileName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue