From 5d6d06005afff33fe311bd17e19f26c679248723 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sun, 1 Apr 2018 16:52:07 +0200 Subject: [PATCH] modified salt logic --- src/main.cpp | 4 +--- src/wifisniffer.cpp | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5eab563d..7961255a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -189,8 +189,7 @@ void wifi_sniffer_loop(void * pvParameters) { configASSERT( ( ( uint32_t ) pvParameters ) == 1 ); // FreeRTOS check uint8_t channel = 1; int nloop=0, lorawait=0; - ESP_LOGI(TAG, "Scan initialized, salt value: %i", salt); - + while (true) { nloop++; vTaskDelay(cfg.wifichancycle*10 / portTICK_PERIOD_MS); @@ -222,7 +221,6 @@ void wifi_sniffer_loop(void * pvParameters) { salt = random(65536); // get new 16bit random for salting hashes macnum = 0; u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter - ESP_LOGI(TAG, "Scan cycle completed, new salt value: %i", salt); } // wait until payload is sent, while wifi scanning and mac counting task continues diff --git a/src/wifisniffer.cpp b/src/wifisniffer.cpp index 0e02ef24..2435e9cf 100644 --- a/src/wifisniffer.cpp +++ b/src/wifisniffer.cpp @@ -75,8 +75,7 @@ void wifi_sniffer_packet_handler(void* buff, wifi_promiscuous_pkt_type_t type) { if ( std::find(vendors.begin(), vendors.end(), vendor2int) != vendors.end() ) { #endif // salt and hash MAC, and if new unique one, store hash in container and increment counter on display - addr2int <<= 16; // left shift out 2 bytes of vendor oui to give space for salt - addr2int |= salt; // append salt value to MAC before hashing it + addr2int |= salt << 12; // prepend salt value to MAC before hashing it itoa(addr2int, macbuf, 10); // convert 64 bit MAC to base 10 decimal string hashedmac = rokkit(macbuf, 5); // hash MAC for privacy, use 5 chars to fit in uint16_t container newmac = macs.insert(hashedmac); // store hashed MAC if new unique