mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-12 15:50:36 -08:00
Fix wardrive memory leak
This commit is contained in:
@@ -264,9 +264,12 @@ void EvilPortal::addLog(String log, int len) {
|
||||
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
buffer_obj.addPacket(logBuffer, logLength, true);
|
||||
delete[] logBuffer;
|
||||
#elif defined(HAS_SD)
|
||||
sd_obj.addPacket(logBuffer, logLength, true);
|
||||
delete[] logBuffer;
|
||||
#else
|
||||
delete[] logBuffer;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1296,6 +1296,11 @@ void WiFiScan::executeWarDrive() {
|
||||
bool do_save;
|
||||
String display_string;
|
||||
|
||||
while (WiFi.scanComplete() == WIFI_SCAN_RUNNING) {
|
||||
Serial.println("Scan running...");
|
||||
delay(500);
|
||||
}
|
||||
|
||||
int n = WiFi.scanNetworks(false, true, false, 110, this->set_channel);
|
||||
|
||||
if (n > 0) {
|
||||
@@ -1349,6 +1354,9 @@ void WiFiScan::executeWarDrive() {
|
||||
}
|
||||
}
|
||||
this->channelHop();
|
||||
|
||||
// Free up that memory, you sexy devil
|
||||
WiFi.scanDelete();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1416,13 +1424,17 @@ void WiFiScan::RunBeaconScan(uint8_t scan_mode, uint16_t color)
|
||||
esp_wifi_set_channel(set_channel, WIFI_SECOND_CHAN_NONE);
|
||||
}
|
||||
else {
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect();
|
||||
this->startWardriverWiFi();
|
||||
}
|
||||
this->wifi_initialized = true;
|
||||
initTime = millis();
|
||||
}
|
||||
|
||||
void WiFiScan::startWardriverWiFi() {
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect();
|
||||
}
|
||||
|
||||
void WiFiScan::RunStationScan(uint8_t scan_mode, uint16_t color)
|
||||
{
|
||||
#ifdef WRITE_PACKETS_SERIAL
|
||||
|
||||
@@ -246,6 +246,7 @@ class WiFiScan
|
||||
void save_mac(unsigned char* mac);
|
||||
void clearMacHistory();
|
||||
void executeWarDrive();
|
||||
void startWardriverWiFi();
|
||||
|
||||
void startWiFiAttacks(uint8_t scan_mode, uint16_t color, String title_string);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user