mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
refactor fido2 commands to use load and save fcts from fileutils.c. They will now load from /client/resources and save a new file in working dir
This commit is contained in:
parent
25cdc321cd
commit
cbf045dddb
4 changed files with 192 additions and 245 deletions
|
@ -639,6 +639,9 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case jsfFido: {
|
||||
break;
|
||||
}
|
||||
case jsfCustom: {
|
||||
(*callback)(root);
|
||||
break;
|
||||
|
@ -663,6 +666,28 @@ out:
|
|||
free(fileName);
|
||||
return retval;
|
||||
}
|
||||
int saveFileJSONroot(const char *preferredName, void *root, size_t flags, bool verbose) {
|
||||
if (root == NULL)
|
||||
return PM3_EINVARG;
|
||||
|
||||
char *filename = newfilenamemcopy(preferredName, ".json");
|
||||
if (filename == NULL)
|
||||
return PM3_EMALLOC;
|
||||
|
||||
int res = json_dump_file(root, filename, flags);
|
||||
|
||||
free(filename);
|
||||
|
||||
if ( res == 0 ) {
|
||||
if (verbose) {
|
||||
PrintAndLogEx(SUCCESS, "saved to json file " _YELLOW_("%s"), filename);
|
||||
}
|
||||
return PM3_SUCCESS;
|
||||
} else {
|
||||
PrintAndLogEx(FAILED, "error: can't save the file: " _YELLOW_("%s"), filename);
|
||||
}
|
||||
return PM3_EFILE;
|
||||
}
|
||||
|
||||
int saveFileWAVE(const char *preferredName, int *data, size_t datalen) {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue