adapt load dump file refactoring else where
This commit is contained in:
1 parent
d4c3082741
commit
f38a3ad762
11 files changed
+85
-493
No files matched your search
+5
-22
@@ -103,39 +103,22 @@ static int CmdNfcDecode(const char *Cmd) {
|
||||
int res = PM3_SUCCESS;
|
||||
if (fnlen != 0) {
|
||||
|
||||
// read dump file
|
||||
uint8_t *dump = NULL;
|
||||
size_t bytes_read = 4096;
|
||||
DumpFileType_t dftype = getfiletype(filename);
|
||||
switch (dftype) {
|
||||
case BIN: {
|
||||
res = loadFile_safe(filename, ".bin", (void **)&dump, &bytes_read);
|
||||
break;
|
||||
}
|
||||
case EML: {
|
||||
res = loadFileEML_safe(filename, (void **)&dump, &bytes_read);
|
||||
break;
|
||||
}
|
||||
case JSON:
|
||||
case DICTIONARY: {
|
||||
free(dump);
|
||||
PrintAndLogEx(ERR, "Error: Only BIN/EML formats allowed");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
|
||||
res = pm3_load_dump(filename, (void **)&dump, &bytes_read, 4096);
|
||||
if (res != PM3_SUCCESS) {
|
||||
PrintAndLogEx(ERR, "error, something went wrong when loading file");
|
||||
free(dump);
|
||||
return PM3_EFILE;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
res = NDEFDecodeAndPrint(dump, bytes_read, verbose);
|
||||
if (res != PM3_SUCCESS) {
|
||||
PrintAndLogEx(INFO, "Trying to parse NDEF records w/o NDEF header");
|
||||
res = NDEFRecordsDecodeAndPrint(dump, bytes_read);
|
||||
}
|
||||
|
||||
free(dump);
|
||||
|
||||
} else {
|
||||
res = NDEFDecodeAndPrint(data, datalen, verbose);
|
||||
if (res != PM3_SUCCESS) {
|
||||
|
||||
Reference in new issue
Block a user