mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-09 01:36:52 +08:00
change 'hf 15 restore' now supports EML/JSON
This commit is contained in:
parent
097d24347f
commit
46bf529763
3 changed files with 37 additions and 3 deletions
|
@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
|
|||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Change `hf 15 restore` - now also support EML/JSON (@iceman1001)
|
||||
- Change - all commands now use cliparser (@iceman1001)
|
||||
- Change `lf t55xx restore` - now also support JSON (@iceman1001)
|
||||
- Change `hf mf csetuid` - adapted to accept 7byte uids. ~untested~ (@iceman1001)
|
||||
- Added `hf mf view/eload/cload` - now accepts bin/eml/json (@iceman1001)
|
||||
|
|
|
@ -1982,10 +1982,38 @@ static int CmdHF15Restore(const char *Cmd) {
|
|||
}
|
||||
PrintAndLogEx(INFO, "Using block size... %zu", blocksize);
|
||||
|
||||
// 4bytes * 256 blocks. Should be enough..
|
||||
uint8_t *data = calloc(4 * 256, sizeof(uint8_t));
|
||||
if (data == NULL) {
|
||||
PrintAndLogEx(WARNING, "Fail, cannot allocate memory");
|
||||
return PM3_EMALLOC;
|
||||
}
|
||||
|
||||
size_t datalen = 0;
|
||||
uint8_t *data = NULL;
|
||||
if (loadFile_safe(filename, ".bin", (void **)&data, &datalen) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(WARNING, "could not find file " _YELLOW_("%s"), filename);
|
||||
int res = PM3_SUCCESS;
|
||||
DumpFileType_t dftype = getfiletype(filename);
|
||||
switch (dftype) {
|
||||
case BIN: {
|
||||
res = loadFile_safe(filename, ".bin", (void **)&data, &datalen);
|
||||
break;
|
||||
}
|
||||
case EML: {
|
||||
res = loadFileEML_safe(filename, (void **)&data, &datalen);
|
||||
break;
|
||||
}
|
||||
case JSON: {
|
||||
res = loadFileJSON(filename, data, 256 * 4, &datalen, NULL);
|
||||
break;
|
||||
}
|
||||
case DICTIONARY: {
|
||||
PrintAndLogEx(ERR, "Error: Only BIN/JSON/EML formats allowed");
|
||||
free(data);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
|
||||
if (res != PM3_SUCCESS) {
|
||||
free(data);
|
||||
return PM3_EFILE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1210,6 +1210,10 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz
|
|||
*datalen = sptr;
|
||||
}
|
||||
|
||||
if (!strcmp(ctype, "15693")) {
|
||||
JsonLoadBufAsHex(root, "$.raw", udata, maxdatalen, datalen);
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
if (callback != NULL) {
|
||||
|
|
Loading…
Reference in a new issue