beacon monitor mode edits
This commit is contained in:
parent
4070d5231a
commit
9b145a95e4
@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
; ---> SELECT TARGET PLATFORM HERE! <---
|
; ---> SELECT TARGET PLATFORM HERE! <---
|
||||||
[platformio]
|
[platformio]
|
||||||
env_default = generic
|
;env_default = generic
|
||||||
;env_default = heltec
|
;env_default = heltec
|
||||||
;env_default = ttgov1
|
;env_default = ttgov1
|
||||||
;env_default = ttgov2
|
;env_default = ttgov2
|
||||||
;env_default = ttgov21
|
;env_default = ttgov21
|
||||||
;env_default = ttgobeam
|
env_default = ttgobeam
|
||||||
;env_default = lopy
|
;env_default = lopy
|
||||||
;env_default = lopy4
|
;env_default = lopy4
|
||||||
;env_default = fipy
|
;env_default = fipy
|
||||||
@ -28,7 +28,8 @@ description = Paxcounter is a proof-of-concept ESP32 device for metering passeng
|
|||||||
|
|
||||||
[common_env_data]
|
[common_env_data]
|
||||||
;platform_espressif32 = espressif32@1.0.2
|
;platform_espressif32 = espressif32@1.0.2
|
||||||
platform_espressif32 = https://github.com/platformio/platform-espressif32.git#feature/stage
|
platform_espressif32 = espressif32@1.1.2
|
||||||
|
;platform_espressif32 = https://github.com/platformio/platform-espressif32.git#feature/stage
|
||||||
board_build.partitions = no_ota.csv
|
board_build.partitions = no_ota.csv
|
||||||
lib_deps_all =
|
lib_deps_all =
|
||||||
lib_deps_display =
|
lib_deps_display =
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <esp32-hal-log.h>
|
#include <esp32-hal-log.h>
|
||||||
|
|
||||||
// attn: increment version after modifications to configData_t truct!
|
// attn: increment version after modifications to configData_t truct!
|
||||||
#define PROGVERSION "1.3.95" // use max 10 chars here!
|
#define PROGVERSION "1.3.96" // use max 10 chars here!
|
||||||
#define PROGNAME "PAXCNT"
|
#define PROGNAME "PAXCNT"
|
||||||
|
|
||||||
// std::set for unified array functions
|
// std::set for unified array functions
|
||||||
|
@ -12,15 +12,15 @@
|
|||||||
// Local logging tag
|
// Local logging tag
|
||||||
static const char TAG[] = "wifi";
|
static const char TAG[] = "wifi";
|
||||||
|
|
||||||
/* change for future Espressif v1.1.x
|
|
||||||
static wifi_country_t wifi_country = {WIFI_MY_COUNTRY, WIFI_CHANNEL_MIN,
|
static wifi_country_t wifi_country = {WIFI_MY_COUNTRY, WIFI_CHANNEL_MIN,
|
||||||
WIFI_CHANNEL_MAX, 0,
|
WIFI_CHANNEL_MAX, 0,
|
||||||
WIFI_COUNTRY_POLICY_MANUAL};
|
WIFI_COUNTRY_POLICY_MANUAL};
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*
|
||||||
static wifi_country_t wifi_country = {WIFI_MY_COUNTRY, WIFI_CHANNEL_MIN,
|
static wifi_country_t wifi_country = {WIFI_MY_COUNTRY, WIFI_CHANNEL_MIN,
|
||||||
WIFI_CHANNEL_MAX,
|
WIFI_CHANNEL_MAX,
|
||||||
WIFI_COUNTRY_POLICY_MANUAL};
|
WIFI_COUNTRY_POLICY_MANUAL};
|
||||||
|
*/
|
||||||
|
|
||||||
// globals
|
// globals
|
||||||
uint16_t salt;
|
uint16_t salt;
|
||||||
@ -42,18 +42,15 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
|
|||||||
|
|
||||||
char buff[16]; // temporary buffer for printf
|
char buff[16]; // temporary buffer for printf
|
||||||
bool added = false;
|
bool added = false;
|
||||||
uint32_t addr2int, vendor2int,
|
uint8_t beaconID; // beacon number in test monitor mode
|
||||||
tempmac; // temporary buffer for MAC and Vendor OUI
|
uint16_t hashedmac; // temporary buffer for generated hash value
|
||||||
uint16_t hashedmac; // temporary buffer for generated hash value
|
uint32_t addr2int, vendor2int; // temporary buffer for MAC and Vendor OUI
|
||||||
uint8_t beaconID = 0; // beacon number in test monitor mode
|
|
||||||
|
|
||||||
// only last 3 MAC Address bytes are used for MAC address anonymization
|
// only last 3 MAC Address bytes are used for MAC address anonymization
|
||||||
// but since it's uint32 we take 4 bytes to avoid 1st value to be 0
|
// but since it's uint32 we take 4 bytes to avoid 1st value to be 0
|
||||||
addr2int = ((uint32_t)paddr[2]) | ((uint32_t)paddr[3] << 8) |
|
addr2int = ((uint32_t)paddr[2]) | ((uint32_t)paddr[3] << 8) |
|
||||||
((uint32_t)paddr[4] << 16) | ((uint32_t)paddr[5] << 24);
|
((uint32_t)paddr[4] << 16) | ((uint32_t)paddr[5] << 24);
|
||||||
|
|
||||||
tempmac = addr2int; // temporary store mac for beacon check
|
|
||||||
|
|
||||||
#ifdef VENDORFILTER
|
#ifdef VENDORFILTER
|
||||||
vendor2int = ((uint32_t)paddr[2]) | ((uint32_t)paddr[1] << 8) |
|
vendor2int = ((uint32_t)paddr[2]) | ((uint32_t)paddr[1] << 8) |
|
||||||
((uint32_t)paddr[0] << 16);
|
((uint32_t)paddr[0] << 16);
|
||||||
@ -66,10 +63,9 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
|
|||||||
// and increment counter on display
|
// and increment counter on display
|
||||||
// https://en.wikipedia.org/wiki/MAC_Address_Anonymization
|
// https://en.wikipedia.org/wiki/MAC_Address_Anonymization
|
||||||
|
|
||||||
addr2int += (uint32_t)salt; // add 16-bit salt to pseudo MAC
|
snprintf(buff, sizeof(buff), "%08X",
|
||||||
snprintf(
|
addr2int + (uint32_t)salt); // convert usigned 32-bit salted MAC to
|
||||||
buff, sizeof(buff), "%08X",
|
// 8 digit hex string
|
||||||
addr2int); // convert unsigned 32-bit salted MAC to 8 digit hex string
|
|
||||||
hashedmac = rokkit(&buff[3], 5); // hash MAC last string value, use 5 chars
|
hashedmac = rokkit(&buff[3], 5); // hash MAC last string value, use 5 chars
|
||||||
// to fit hash in uint16_t container
|
// to fit hash in uint16_t container
|
||||||
auto newmac = macs.insert(hashedmac); // add hashed MAC, if new unique
|
auto newmac = macs.insert(hashedmac); // add hashed MAC, if new unique
|
||||||
@ -97,7 +93,7 @@ bool mac_add(uint8_t *paddr, int8_t rssi, bool sniff_type) {
|
|||||||
|
|
||||||
// in beacon monitor mode check if seen MAC is a known beacon
|
// in beacon monitor mode check if seen MAC is a known beacon
|
||||||
if (cfg.monitormode) {
|
if (cfg.monitormode) {
|
||||||
beaconID = isBeacon(tempmac);
|
beaconID = isBeacon(addr2int);
|
||||||
if (beaconID) {
|
if (beaconID) {
|
||||||
payload.reset();
|
payload.reset();
|
||||||
payload.addAlarm(rssi, beaconID);
|
payload.addAlarm(rssi, beaconID);
|
||||||
|
Loading…
Reference in New Issue
Block a user