diff --git a/CHANGELOG.md b/CHANGELOG.md index a6fa13eb7..1fda7b23c 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` - now supports Android Managed Provision NDEF message decoding (@iceman1001) - Changed `hf_cardhopper` - Allow button presses to break, handle non-zero CID from reader by relaying RATS and improving PPS and WTX handling, more reliably cook ATS, ignore client packets on serial line (@nvx) - Fixed `data diff` - client no longer crashes when using short widths on long filenames (@iceman1001) - Added `hf 15 wipe` - fills card memory with zeros (@iceman1001) diff --git a/client/src/nfc/ndef.c b/client/src/nfc/ndef.c index a8227ddc7..8163abe59 100644 --- a/client/src/nfc/ndef.c +++ b/client/src/nfc/ndef.c @@ -42,6 +42,8 @@ #define NDEF_BLUEAPPL_LE "application/vnd.bluetooth.le.oob" #define NDEF_BLUEAPPL_SECURE_LE "application/vnd.bluetooth.secure.le.oob" +#define NDEF_ANDROID_PROVISION "application/com.android.managedprovisioning" + static const char *TypeNameFormat_s[] = { "Empty Record", @@ -592,7 +594,6 @@ static int ndefDecodePayloadSmartPoster(uint8_t *ndef, size_t ndeflen, bool prin return PM3_SUCCESS; } - typedef struct ndef_wifi_type_s { const char *description; uint8_t bytes[2]; @@ -943,6 +944,17 @@ static int ndefDecodeMime_bt(NDEFHeader_t *ndef) { return PM3_SUCCESS; } +static int ndefDecodeMime_android_provision(NDEFHeader_t *ndef) { + if (ndef->PayloadLen == 0) { + PrintAndLogEx(INFO, "no payload"); + return PM3_SUCCESS; + } + PrintAndLogEx(INFO, _CYAN_("Android Managed Provision")); + PrintAndLogEx(INFO, ""); + PrintAndLogEx(INFO, "%.*s", (int)ndef->PayloadLen, ndef->Payload); + return PM3_SUCCESS; +} + // https://raw.githubusercontent.com/haldean/ndef/master/docs/NFCForum-TS-RTD_1.0.pdf static int ndefDecodeExternal_record(NDEFHeader_t *ndef) { @@ -1079,6 +1091,10 @@ static int ndefDecodePayload(NDEFHeader_t *ndef, bool verbose) { ndefDecodeMime_json(ndef); } + if (str_startswith(begin, NDEF_ANDROID_PROVISION)) { + ndefDecodeMime_android_provision(ndef); + } + free(begin); begin = NULL; break; @@ -1297,7 +1313,6 @@ int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose) { return PM3_SUCCESS; } - int NDEFGetTotalLength(uint8_t *ndef, size_t ndeflen, size_t *outlen) { size_t idx = 0;