modified salt logic

This commit is contained in:
Klaus K Wilting 2018-04-01 16:52:07 +02:00
parent 4914305ba8
commit 5d6d06005a
2 changed files with 2 additions and 5 deletions

View File

@ -189,8 +189,7 @@ void wifi_sniffer_loop(void * pvParameters) {
configASSERT( ( ( uint32_t ) pvParameters ) == 1 ); // FreeRTOS check configASSERT( ( ( uint32_t ) pvParameters ) == 1 ); // FreeRTOS check
uint8_t channel = 1; uint8_t channel = 1;
int nloop=0, lorawait=0; int nloop=0, lorawait=0;
ESP_LOGI(TAG, "Scan initialized, salt value: %i", salt);
while (true) { while (true) {
nloop++; nloop++;
vTaskDelay(cfg.wifichancycle*10 / portTICK_PERIOD_MS); 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 salt = random(65536); // get new 16bit random for salting hashes
macnum = 0; macnum = 0;
u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter 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 // wait until payload is sent, while wifi scanning and mac counting task continues

View File

@ -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() ) { if ( std::find(vendors.begin(), vendors.end(), vendor2int) != vendors.end() ) {
#endif #endif
// salt and hash MAC, and if new unique one, store hash in container and increment counter on display // 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 << 12; // prepend salt value to MAC before hashing it
addr2int |= salt; // append salt value to MAC before hashing it
itoa(addr2int, macbuf, 10); // convert 64 bit MAC to base 10 decimal string 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 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 newmac = macs.insert(hashedmac); // store hashed MAC if new unique