salt bugfix
This commit is contained in:
parent
17f550984f
commit
6220a44e7e
@ -42,7 +42,7 @@ configData_t cfg; // struct holds current device configuration
|
|||||||
osjob_t sendjob, initjob; // LMIC
|
osjob_t sendjob, initjob; // LMIC
|
||||||
|
|
||||||
// Initialize global variables
|
// Initialize global variables
|
||||||
int macnum = 0, blenum = 0;
|
int macnum = 0, blenum = 0, salt;
|
||||||
uint64_t uptimecounter = 0;
|
uint64_t uptimecounter = 0;
|
||||||
bool joinstate = false;
|
bool joinstate = false;
|
||||||
|
|
||||||
@ -187,7 +187,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, salt = rand() % 256; // random int between 0 and 255 used for salting MAC hashes
|
int nloop=0, lorawait=0, salt=rand() % 256; // random int between 0 and 255 used for salting MAC hashes
|
||||||
ESP_LOGI(TAG, "Scan initialzied, salt value: %i", salt);
|
ESP_LOGI(TAG, "Scan initialzied, salt value: %i", salt);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -218,6 +218,7 @@ void wifi_sniffer_loop(void * pvParameters) {
|
|||||||
// clear counter if not in cumulative counter mode
|
// clear counter if not in cumulative counter mode
|
||||||
if (cfg.countermode != 1) {
|
if (cfg.countermode != 1) {
|
||||||
macs.clear(); // clear macs container
|
macs.clear(); // clear macs container
|
||||||
|
srand(macnum); // use macnum to reinitialize pseudorandom generator
|
||||||
macnum = 0;
|
macnum = 0;
|
||||||
u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter
|
u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter
|
||||||
salt = rand() % 256; // get new random int between 0 and 255 for salting MAC hashes
|
salt = rand() % 256; // get new random int between 0 and 255 for salting MAC hashes
|
||||||
|
@ -69,7 +69,7 @@ void set_reset(int val) {
|
|||||||
ESP_LOGI(TAG, "Remote command: reset MAC counter");
|
ESP_LOGI(TAG, "Remote command: reset MAC counter");
|
||||||
macs.clear(); // clear macs container
|
macs.clear(); // clear macs container
|
||||||
macnum = 0;
|
macnum = 0;
|
||||||
//salt = rand() % 256; // get new random int between 0 and 255 for salting MAC hashes
|
salt = rand() % 256; // get new random int between 0 and 255 for salting MAC hashes
|
||||||
u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter
|
u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter
|
||||||
u8x8.clearLine(5);
|
u8x8.clearLine(5);
|
||||||
u8x8.setCursor(0, 5);
|
u8x8.setCursor(0, 5);
|
||||||
|
@ -77,7 +77,8 @@ void wifi_sniffer_packet_handler(void* buff, wifi_promiscuous_pkt_type_t type) {
|
|||||||
if (!(addr2int & WIFI_MAC_FILTER_MASK)) { // filter local and group MACs
|
if (!(addr2int & WIFI_MAC_FILTER_MASK)) { // filter local and group MACs
|
||||||
|
|
||||||
// alt and hash MAC, and if new unique one, store hash in container and increment counter on display
|
// alt and hash MAC, and if new unique one, store hash in container and increment counter on display
|
||||||
addr2int <<= 8 || salt; // append salt value to MAC before hashing it
|
addr2int <<= 8;
|
||||||
|
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, 10); // hash MAC for privacy, use 10 chars to fit in uint32_t container
|
hashedmac = rokkit(macbuf, 10); // hash MAC for privacy, use 10 chars to fit in uint32_t container
|
||||||
newmac = macs.insert(hashedmac); // store hashed MAC if new unique
|
newmac = macs.insert(hashedmac); // store hashed MAC if new unique
|
||||||
|
Loading…
Reference in New Issue
Block a user