Fix overflow on station sniffing and listing

This commit is contained in:
Just Call Me Koko
2025-03-25 18:43:38 -04:00
parent 43130cbb42
commit 22058ce83c
4 changed files with 23 additions and 15 deletions

View File

@@ -53,7 +53,7 @@ struct AccessPoint {
bool selected; bool selected;
LinkedList<char>* beacon; LinkedList<char>* beacon;
char rssi; char rssi;
LinkedList<uint8_t>* stations; LinkedList<uint16_t>* stations;
}; };
class CaptiveRequestHandler : public AsyncWebHandler { class CaptiveRequestHandler : public AsyncWebHandler {

View File

@@ -656,9 +656,11 @@ void MenuFunctions::main(uint32_t currentTime)
// Do channel analyzer stuff // Do channel analyzer stuff
if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_CHAN_ANALYZER) || if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_CHAN_ANALYZER) ||
(wifi_scan_obj.currentScanMode == BT_SCAN_ANALYZER)){ (wifi_scan_obj.currentScanMode == BT_SCAN_ANALYZER)){
this->setGraphScale(this->graphScaleCheck(wifi_scan_obj._analyzer_values)); #ifdef HAS_SCREEN
this->setGraphScale(this->graphScaleCheck(wifi_scan_obj._analyzer_values));
this->drawGraph(wifi_scan_obj._analyzer_values); this->drawGraph(wifi_scan_obj._analyzer_values);
#endif
} }
} }
} }

View File

@@ -1360,7 +1360,7 @@ void WiFiScan::RunLoadAPList() {
ap.channel = obj["channel"]; ap.channel = obj["channel"];
ap.selected = false; ap.selected = false;
parseBSSID(obj["bssid"], ap.bssid); parseBSSID(obj["bssid"], ap.bssid);
ap.stations = new LinkedList<uint8_t>(); ap.stations = new LinkedList<uint16_t>();
access_points->add(ap); access_points->add(ap);
} }
@@ -3222,7 +3222,7 @@ void WiFiScan::apSnifferCallbackFull(void* buf, wifi_promiscuous_pkt_type_t type
ap.bssid[4] = snifferPacket->payload[14]; ap.bssid[4] = snifferPacket->payload[14];
ap.bssid[5] = snifferPacket->payload[15]; ap.bssid[5] = snifferPacket->payload[15];
ap.selected = false; ap.selected = false;
ap.stations = new LinkedList<uint8_t>(); ap.stations = new LinkedList<uint16_t>();
ap.beacon = new LinkedList<char>(); ap.beacon = new LinkedList<char>();
@@ -3372,7 +3372,7 @@ void WiFiScan::apSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
false, false,
NULL, NULL,
snifferPacket->rx_ctrl.rssi, snifferPacket->rx_ctrl.rssi,
new LinkedList<uint8_t>()}; new LinkedList<uint16_t>()};
access_points->add(ap); access_points->add(ap);
@@ -5310,8 +5310,10 @@ void WiFiScan::changeChannel(int chan) {
this->set_channel = chan; this->set_channel = chan;
esp_wifi_set_channel(this->set_channel, WIFI_SECOND_CHAN_NONE); esp_wifi_set_channel(this->set_channel, WIFI_SECOND_CHAN_NONE);
delay(1); delay(1);
if (this->currentScanMode == WIFI_SCAN_CHAN_ANALYZER) #ifdef HAS_SCREEN
this->addAnalyzerValue(this->set_channel * -1, -72, this->_analyzer_values, TFT_WIDTH); if (this->currentScanMode == WIFI_SCAN_CHAN_ANALYZER)
this->addAnalyzerValue(this->set_channel * -1, -72, this->_analyzer_values, TFT_WIDTH);
#endif
} }
void WiFiScan::changeChannel() void WiFiScan::changeChannel()
@@ -5348,11 +5350,13 @@ void WiFiScan::addAnalyzerValue(int16_t value, int rssi_avg, int16_t target_arra
} }
void WiFiScan::channelAnalyzerLoop(uint32_t tick) { void WiFiScan::channelAnalyzerLoop(uint32_t tick) {
if (tick - this->initTime >= BANNER_TIME) { #ifdef HAS_SCREEN
this->initTime = millis(); if (tick - this->initTime >= BANNER_TIME) {
this->addAnalyzerValue(this->_analyzer_value * BASE_MULTIPLIER, -72, this->_analyzer_values, TFT_WIDTH); this->initTime = millis();
this->_analyzer_value = 0; this->addAnalyzerValue(this->_analyzer_value * BASE_MULTIPLIER, -72, this->_analyzer_values, TFT_WIDTH);
} this->_analyzer_value = 0;
}
#endif
} }

View File

@@ -385,8 +385,10 @@ class WiFiScan
String dst_mac = "ff:ff:ff:ff:ff:ff"; String dst_mac = "ff:ff:ff:ff:ff:ff";
byte src_mac[6] = {}; byte src_mac[6] = {};
int16_t _analyzer_values[TFT_WIDTH]; #ifdef HAS_SCREEN
int16_t _temp_analyzer_values[TFT_WIDTH]; int16_t _analyzer_values[TFT_WIDTH];
int16_t _temp_analyzer_values[TFT_WIDTH];
#endif
String current_mini_kb_ssid = ""; String current_mini_kb_ssid = "";