From e92bcbd8b1fabebae938b3bc0e373d7beea9b350 Mon Sep 17 00:00:00 2001 From: Marius Gripp Date: Mon, 2 Sep 2019 15:11:52 +0200 Subject: [PATCH] setup macsniff with ota trigger mac --- include/macsniff.h | 1 + src/macsniff.cpp | 12 ++++++++++++ src/main.cpp | 2 ++ 3 files changed, 15 insertions(+) diff --git a/include/macsniff.h b/include/macsniff.h index d41fc787..663a7749 100644 --- a/include/macsniff.h +++ b/include/macsniff.h @@ -12,6 +12,7 @@ #define MAC_SNIFF_WIFI 0 #define MAC_SNIFF_BLE 1 +void macsniff_setup(void); uint16_t get_salt(void); uint64_t macConvert(uint8_t *paddr); bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type); diff --git a/src/macsniff.cpp b/src/macsniff.cpp index 0b00e7c1..fdb37273 100644 --- a/src/macsniff.cpp +++ b/src/macsniff.cpp @@ -6,10 +6,22 @@ #include "vendor_array.h" #endif +#include +#include + // Local logging tag static const char TAG[] = __FILE__; uint16_t salt; +uint64_t fota_trigger_mac; + +void macsniff_setup() { + std::stringstream ss; + ss << std::hex << OTA_TRIGGER_MAC; + ESP_LOGI(TAG, "OTA_TRIGGER_MAC %X", OTA_TRIGGER_MAC); + ss >> fota_trigger_mac; + std::cout << static_cast(fota_trigger_mac) << std::endl; +} uint16_t get_salt(void) { salt = (uint16_t)random(65536); // get new 16bit random for salting hashes diff --git a/src/main.cpp b/src/main.cpp index 2a7aab1a..a8e50ea5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -444,6 +444,8 @@ void setup() { // show compiled features ESP_LOGI(TAG, "Features:%s", features); + macsniff_setup(); + uart_setup(); } // setup()