mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
nfc decode - now acts text files as input if they have the extension EML. hacky..
This commit is contained in:
parent
e6cc0ed836
commit
0bcaf5b47a
1 changed files with 25 additions and 4 deletions
|
@ -93,17 +93,38 @@ static int CmdNfcDecode(const char *Cmd) {
|
||||||
}
|
}
|
||||||
int res = PM3_SUCCESS;
|
int res = PM3_SUCCESS;
|
||||||
if (fnlen != 0) {
|
if (fnlen != 0) {
|
||||||
size_t dumplen = 0;
|
|
||||||
uint8_t *dump = NULL;
|
uint8_t *dump = NULL;
|
||||||
if (loadFile_safe(filename, ".bin", (void **)&dump, &dumplen) != PM3_SUCCESS) {
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(ERR, "error, something went wrong when loading file");
|
PrintAndLogEx(ERR, "error, something went wrong when loading file");
|
||||||
free(dump);
|
free(dump);
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
res = NDEFDecodeAndPrint(dump, dumplen, verbose);
|
|
||||||
|
|
||||||
|
res = NDEFDecodeAndPrint(dump, bytes_read, verbose);
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(INFO, "Trying to parse NDEF records w/o NDEF header");
|
PrintAndLogEx(INFO, "Trying to parse NDEF records w/o NDEF header");
|
||||||
res = NDEFRecordsDecodeAndPrint(dump, dumplen);
|
res = NDEFRecordsDecodeAndPrint(dump, bytes_read);
|
||||||
}
|
}
|
||||||
free(dump);
|
free(dump);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue