diff --git a/CHANGELOG.md b/CHANGELOG.md index e20b440f8..dff4bcf59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 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] + - Changed `nfc decode -f` - now can detect and convert MFC dumpfiles to NDEF byte arrays (@iceman1001) - Changed `nfc decode` - now handles EXTERNAL RECORDS better (@iceman1001) - Fixed `nfc decode` - now handles NDEF Signature version1 records better (@iceman1001) - Added new standalone mode `LF_MULTIHID` - HID26 (H1031) multi simulator (@flamebarke) diff --git a/client/src/cmdnfc.c b/client/src/cmdnfc.c index df87ee6f8..6f9561783 100644 --- a/client/src/cmdnfc.c +++ b/client/src/cmdnfc.c @@ -30,6 +30,8 @@ #include "cmdhftopaz.h" #include "cmdnfc.h" #include "fileutils.h" +#include "mifare/mifaredefault.h" +#include "mifare/mad.h" void print_type4_cc_info(uint8_t *d, uint8_t n) { if (n < 0x0F) { @@ -111,6 +113,17 @@ static int CmdNfcDecode(const char *Cmd) { return res; } + // convert from MFC dump file to a pure NDEF byte array + if (HasMADKey(dump)) { + PrintAndLogEx(SUCCESS, "MFC dump file detected. Converting..."); + uint8_t ndef[4096] = {0}; + uint16_t ndeflen = 0; + uint8_t skip = (4 * MFBLOCK_SIZE); + convert_mfc_2_arr(dump + skip, bytes_read - skip, ndef, &ndeflen); + memcpy(dump, ndef, ndeflen); + bytes_read = ndeflen; + } + res = NDEFDecodeAndPrint(dump, bytes_read, verbose); if (res != PM3_SUCCESS) { PrintAndLogEx(INFO, "Trying to parse NDEF records w/o NDEF header");