Update macsniff.cpp

added: CWA-handling
This commit is contained in:
August Quint 2020-09-01 11:53:49 +02:00 committed by GitHub
parent ad288b7058
commit e9800db481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,9 @@
// Local logging tag // Local logging tag
static const char TAG[] = __FILE__; static const char TAG[] = __FILE__;
uint16_t salt; // used here and in corona.cpp
uint16_t salt = -1;
uint16_t hashedmac = -1; // temporary buffer for generated hash value
uint16_t get_salt(void) { uint16_t get_salt(void) {
salt = (uint16_t)random(65536); // get new 16bit random for salting hashes salt = (uint16_t)random(65536); // get new 16bit random for salting hashes
@ -51,7 +53,6 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
char buff[10]; // temporary buffer for printf char buff[10]; // temporary buffer for printf
bool added = false; bool added = false;
int8_t beaconID; // beacon number in test monitor mode int8_t beaconID; // beacon number in test monitor mode
uint16_t hashedmac; // temporary buffer for generated hash value
uint32_t *mac; // temporary buffer for shortened MAC uint32_t *mac; // temporary buffer for shortened MAC
// only last 3 MAC Address bytes are used for MAC address anonymization // only last 3 MAC Address bytes are used for MAC address anonymization
@ -118,11 +119,18 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
// Log scan result // Log scan result
ESP_LOGV(TAG, ESP_LOGV(TAG,
"%s %s RSSI %ddBi -> salted MAC %s -> Hash %04X -> WiFi:%d " "%s %s RSSI %ddBi -> salted MAC %s -> Hash %04X -> WiFi:%d "
"BLTH:%d -> " "BLTH:%d "
"%d Bytes left", #if (COUNT_CWA)
"(CWA:%d)"
#endif
"-> %d Bytes left",
added ? "new " : "known", added ? "new " : "known",
sniff_type == MAC_SNIFF_WIFI ? "WiFi" : "BLTH", rssi, buff, sniff_type == MAC_SNIFF_WIFI ? "WiFi" : "BLTH", rssi, buff,
hashedmac, macs_wifi, macs_ble, getFreeRAM()); hashedmac, macs_wifi, macs_ble,
#if (COUNT_CWA)
cwa_report(),
#endif
getFreeRAM());
#if (VENDORFILTER) #if (VENDORFILTER)
} else { } else {