srand() init with chip temperature
This commit is contained in:
parent
6220a44e7e
commit
d92cd89dae
@ -187,8 +187,9 @@ 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;
|
||||||
|
srand((uint32_t) temperatureRead()); // use chip temperature for pseudorandom generator init
|
||||||
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 initialized, salt value: %i", salt);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
nloop++;
|
nloop++;
|
||||||
@ -218,7 +219,8 @@ 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
|
//srand(macnum); // use macnum to reinitialize pseudorandom generator
|
||||||
|
srand((uint32_t) temperatureRead()); // use chip temperature for pseudorandom generator init
|
||||||
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
|
||||||
|
@ -74,9 +74,9 @@ 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
|
||||||
|
|
||||||
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
|
// salt and hash MAC, and if new unique one, store hash in container and increment counter on display
|
||||||
addr2int <<= 8;
|
addr2int <<= 8;
|
||||||
addr2int += salt; // append 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
|
||||||
@ -91,7 +91,7 @@ void wifi_sniffer_packet_handler(void* buff, wifi_promiscuous_pkt_type_t type) {
|
|||||||
}
|
}
|
||||||
else // already seen MAC
|
else // already seen MAC
|
||||||
ESP_LOGI(TAG, "RSSI %04d -> already seen", ppkt->rx_ctrl.rssi);
|
ESP_LOGI(TAG, "RSSI %04d -> already seen", ppkt->rx_ctrl.rssi);
|
||||||
}
|
//}
|
||||||
|
|
||||||
#ifdef VENDORFILTER
|
#ifdef VENDORFILTER
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user