From 33d90993e32992434ac17038cab5f00a77d1ca83 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 11 Jul 2023 14:39:13 +0200 Subject: [PATCH] more bluetooth simple pairing options. No decoder yet. --- client/src/nfc/ndef.c | 49 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/client/src/nfc/ndef.c b/client/src/nfc/ndef.c index e03913fbc..3e2e1973f 100644 --- a/client/src/nfc/ndef.c +++ b/client/src/nfc/ndef.c @@ -32,12 +32,16 @@ #define STRBOOL(p) ((p) ? "1" : "0") -#define NDEF_WIFIAPPL_WSC "application/vnd.wfa.wsc" -#define NDEF_WIFIAPPL_P2P "application/vnd.wfa.p2p" -#define NDEF_BLUEAPPL "application/vnd.bluetooth" -#define NDEF_JSONAPPL "application/json" -#define NDEF_VCARDTEXT "text/vcard" -#define NDEF_XVCARDTEXT "text/x-vcard" +#define NDEF_WIFIAPPL_WSC "application/vnd.wfa.wsc" +#define NDEF_WIFIAPPL_P2P "application/vnd.wfa.p2p" +#define NDEF_JSONAPPL "application/json" +#define NDEF_VCARDTEXT "text/vcard" +#define NDEF_XVCARDTEXT "text/x-vcard" + +#define NDEF_BLUEAPPL_EP "application/vnd.bluetooth.ep.oob" +#define NDEF_BLUEAPPL_LE "application/vnd.bluetooth.le.oob" +#define NDEF_BLUEAPPL_SECURE_LE "application/vnd.bluetooth.secure.le.oob" + static const char *TypeNameFormat_s[] = { "Empty Record", @@ -854,6 +858,26 @@ static int ndefDecodeMime_json(NDEFHeader_t *ndef) { return PM3_SUCCESS; } +static int ndefDecodeMime_bt_secure_le_oob(NDEFHeader_t *ndef) { + if (ndef->PayloadLen == 0) { + PrintAndLogEx(INFO, "no payload"); + return PM3_SUCCESS; + } + PrintAndLogEx(INFO, "Type............ " _YELLOW_("%.*s"), (int)ndef->TypeLen, ndef->Type); + PrintAndLogEx(INFO, "To be implemented. Feel free to contribute!"); + return PM3_SUCCESS; +} + +static int ndefDecodeMime_bt_le_oob(NDEFHeader_t *ndef) { + if (ndef->PayloadLen == 0) { + PrintAndLogEx(INFO, "no payload"); + return PM3_SUCCESS; + } + PrintAndLogEx(INFO, "Type............ " _YELLOW_("%.*s"), (int)ndef->TypeLen, ndef->Type); + PrintAndLogEx(INFO, "To be implemented. Feel free to contribute!"); + return PM3_SUCCESS; +} + static int ndefDecodeMime_bt(NDEFHeader_t *ndef) { if (ndef->PayloadLen == 0) { PrintAndLogEx(INFO, "no payload"); @@ -1023,9 +1047,18 @@ static int ndefDecodePayload(NDEFHeader_t *ndef, bool verbose) { if (str_startswith(begin, NDEF_VCARDTEXT) || str_startswith(begin, NDEF_XVCARDTEXT)) { ndefDecodeMime_vcard(ndef); } - if (str_startswith(begin, NDEF_BLUEAPPL)) { - ndefDecodeMime_bt(ndef); + + + if (str_startswith(begin, NDEF_BLUEAPPL_EP)) { + ndefDecodeMime_bt(ndef); } + if (str_startswith(begin, NDEF_BLUEAPPL_SECURE_LE)) { + ndefDecodeMime_bt_secure_le_oob(ndef); + } + if (str_startswith(begin, NDEF_BLUEAPPL_LE)) { + ndefDecodeMime_bt_le_oob(ndef); + } + if (str_startswith(begin, NDEF_JSONAPPL)) { ndefDecodeMime_json(ndef); }