Compare commits

...

10 Commits

Author SHA1 Message Date
Just Call Me Koko
8ef5cf3b92 Merge pull request #1015 from justcallmekoko/develop
Faster display buffer
2025-12-13 14:48:34 -05:00
Just Call Me Koko
b3eade1e06 Faster display buffer 2025-12-13 14:43:08 -05:00
Just Call Me Koko
1dd5502c1d Merge pull request #1012 from justcallmekoko/develop
Fix crash during BT wardrive
2025-12-12 18:11:10 -05:00
Just Call Me Koko
1862a5b812 Fix crash during BT wardrive 2025-12-12 18:06:07 -05:00
Just Call Me Koko
f5375eedaf Merge pull request #1006 from justcallmekoko/develop
Wardriving is asynchronous now
2025-12-08 16:45:31 -05:00
Just Call Me Koko
2910addb8a Ensure async wardrive 2025-12-08 16:32:25 -05:00
Just Call Me Koko
be3971d081 Wardriving is async 2025-12-08 15:40:24 -05:00
Just Call Me Koko
86e2fb206a Merge pull request #1005 from justcallmekoko/develop
Add wifi to flock wardrive
2025-12-08 15:10:53 -05:00
Just Call Me Koko
431fa175a0 Update WiFiScan.cpp 2025-12-08 15:04:09 -05:00
Just Call Me Koko
976687980c Add wifi to flock wardrive 2025-12-08 14:53:55 -05:00
2 changed files with 146 additions and 35 deletions

View File

@@ -475,33 +475,37 @@ void Display::processAndPrintString(TFT_eSPI& tft, const String& originalString)
String new_string = originalString;
// Check for color macros at the start of the string
if (new_string.startsWith(RED_KEY)) {
text_color = TFT_RED;
new_string.remove(0, strlen(RED_KEY)); // Remove the macro
} else if (new_string.startsWith(GREEN_KEY)) {
text_color = TFT_GREEN;
new_string.remove(0, strlen(GREEN_KEY)); // Remove the macro
} else if (new_string.startsWith(CYAN_KEY)) {
text_color = TFT_CYAN;
new_string.remove(0, strlen(CYAN_KEY)); // Remove the macro
} else if (new_string.startsWith(WHITE_KEY)) {
text_color = TFT_WHITE;
new_string.remove(0, strlen(WHITE_KEY)); // Remove the macro
} else if (new_string.startsWith(MAGENTA_KEY)) {
text_color = TFT_MAGENTA;
new_string.remove(0, strlen(MAGENTA_KEY)); // Remove the macro
if (new_string.startsWith(";")) {
if (new_string.startsWith(RED_KEY)) {
text_color = TFT_RED;
new_string.remove(0, strlen(RED_KEY)); // Remove the macro
} else if (new_string.startsWith(GREEN_KEY)) {
text_color = TFT_GREEN;
new_string.remove(0, strlen(GREEN_KEY)); // Remove the macro
} else if (new_string.startsWith(CYAN_KEY)) {
text_color = TFT_CYAN;
new_string.remove(0, strlen(CYAN_KEY)); // Remove the macro
} else if (new_string.startsWith(WHITE_KEY)) {
text_color = TFT_WHITE;
new_string.remove(0, strlen(WHITE_KEY)); // Remove the macro
} else if (new_string.startsWith(MAGENTA_KEY)) {
text_color = TFT_MAGENTA;
new_string.remove(0, strlen(MAGENTA_KEY)); // Remove the macro
}
}
String spaces = String(' ', TFT_WIDTH / CHAR_WIDTH);
// Set text color and print the string
tft.setTextColor(text_color, background_color);
tft.print(new_string);
tft.print(new_string + spaces);
}
void Display::displayBuffer(bool do_clear)
{
if (this->display_buffer->size() > 0)
{
int print_count = 1;
int print_count = 10;
while ((display_buffer->size() > 0) && (print_count > 0))
{
@@ -530,9 +534,9 @@ void Display::displayBuffer(bool do_clear)
screen_buffer->add(display_buffer->shift());
for (int i = 0; i < this->screen_buffer->size(); i++) {
tft.setCursor(xPos, (i * 12) + (SCREEN_HEIGHT / 6));
String spaces = String(' ', TFT_WIDTH / CHAR_WIDTH);
tft.print(spaces);
//tft.setCursor(xPos, (i * 12) + (SCREEN_HEIGHT / 6));
//String spaces = String(' ', TFT_WIDTH / CHAR_WIDTH);
//tft.print(spaces);
tft.setCursor(xPos, (i * 12) + (SCREEN_HEIGHT / 6));
this->processAndPrintString(tft, this->screen_buffer->get(i));

View File

@@ -432,7 +432,16 @@ extern "C" {
if (gps_obj.getGpsModuleStatus()) {
bool do_save = false;
if (buf >= 0)
{
{
unsigned char mac_char[6];
wifi_scan_obj.copyNimbleMac(advertisedDevice->getAddress(), mac_char);
if (wifi_scan_obj.currentScanMode != BT_SCAN_WAR_DRIVE_CONT) {
if (wifi_scan_obj.seen_mac(mac_char))
return;
}
Serial.print(F("Device: "));
if(advertisedDevice->getName().length() != 0)
{
@@ -476,6 +485,10 @@ extern "C" {
if (do_save)
buffer_obj.append(wardrive_line);
if (wifi_scan_obj.currentScanMode != BT_SCAN_WAR_DRIVE_CONT) {
wifi_scan_obj.save_mac(mac_char);
}
}
}
#endif
@@ -1153,6 +1166,14 @@ extern "C" {
bool do_save = false;
if (buf >= 0)
{
unsigned char mac_char[6];
wifi_scan_obj.copyNimbleMac(advertisedDevice->getAddress(), mac_char);
if (wifi_scan_obj.currentScanMode != BT_SCAN_WAR_DRIVE_CONT) {
if (wifi_scan_obj.seen_mac(mac_char))
return;
}
Serial.print(F("Device: "));
if(advertisedDevice->getName().length() != 0)
{
@@ -1196,6 +1217,10 @@ extern "C" {
if (do_save)
buffer_obj.append(wardrive_line);
if (wifi_scan_obj.currentScanMode != BT_SCAN_WAR_DRIVE_CONT) {
wifi_scan_obj.save_mac(mac_char);
}
}
}
#endif
@@ -2499,6 +2524,7 @@ void WiFiScan::StopScan(uint8_t scan_mode)
#endif
this->shutdownBLE();
this->ble_scanning = false;
#endif
}
@@ -4414,19 +4440,37 @@ void WiFiScan::executeWarDrive() {
bool do_save;
String display_string;
while (WiFi.scanComplete() == WIFI_SCAN_RUNNING) {
/*while (WiFi.scanComplete() == WIFI_SCAN_RUNNING) {
Serial.println(F("Scan running..."));
delay(500);
}*/
int scan_status = WiFi.scanComplete();
if (scan_status == WIFI_SCAN_RUNNING) {
delay(1);
return;
}
else if (scan_status == WIFI_SCAN_FAILED) {
Serial.println("WiFi scan failed to start. Restarting...");
this->wifi_initialized = true;
this->shutdownWiFi();
this->startWardriverWiFi();
this->wifi_initialized = true;
delay(100);
}
#ifndef HAS_DUAL_BAND
/*#ifndef HAS_DUAL_BAND
int n = WiFi.scanNetworks(false, true, false, 110, this->set_channel);
#else
int n = WiFi.scanNetworks(false, true, false, 110);
#endif
#endif*/
if (n > 0) {
for (int i = 0; i < n; i++) {
bool do_continue = false;
if (scan_status > 0) {
for (int i = 0; i < scan_status; i++) {
do_continue = true;
display_string = "";
do_save = false;
uint8_t *this_bssid_raw = WiFi.BSSID(i);
@@ -4439,6 +4483,24 @@ void WiFiScan::executeWarDrive() {
this->save_mac(this_bssid_raw);
String ssid = WiFi.SSID(i);
//Serial.println(ssid);
if (this->currentScanMode == BT_SCAN_FLOCK_WARDRIVE) {
for (int x = 0; x < sizeof(flock_ssid)/sizeof(this->flock_ssid[0]); x++) {
//Serial.print("Comparing ");
//Serial.print(ssid);
//Serial.print(" to ");
//Serial.println(this->flock_ssid[x]);
if (strcasestr(ssid.c_str(), this->flock_ssid[x])) {
do_continue = false;
break;
}
}
if (do_continue)
continue;
}
ssid.replace(",","_");
if (ssid != "") {
@@ -4476,11 +4538,17 @@ void WiFiScan::executeWarDrive() {
buffer_obj.append(wardrive_line);
}
}
}
this->channelHop();
// Free up that memory, you sexy devil
WiFi.scanDelete();
// Free up that memory, you sexy devil
WiFi.scanDelete();
}
/*#ifndef HAS_DUAL_BAND
this->channelHop();
#endif*/
if (!this->ble_scanning)
WiFi.scanNetworks(true, true, false, 80);
}
#endif
}
@@ -4941,6 +5009,8 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
NimBLEDevice::init("");
pBLEScan = NimBLEDevice::getScan(); //create new scan
if ((scan_mode == BT_SCAN_ALL) ||
(scan_mode == BT_SCAN_WAR_DRIVE) ||
(scan_mode == BT_SCAN_WAR_DRIVE_CONT) ||
(scan_mode == BT_SCAN_AIRTAG) ||
(scan_mode == BT_SCAN_AIRTAG_MON) ||
(scan_mode == BT_SCAN_FLIPPER) ||
@@ -4949,6 +5019,28 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
(scan_mode == BT_SCAN_SIMPLE) ||
(scan_mode == BT_SCAN_SIMPLE_TWO))
{
#ifdef HAS_GPS
if (gps_obj.getGpsModuleStatus()) {
if (scan_mode == BT_SCAN_WAR_DRIVE) {
startLog("bt_wardrive");
}
else if (scan_mode == BT_SCAN_WAR_DRIVE_CONT) {
startLog("bt_wardrive_cont");
}
else if (scan_mode == BT_SCAN_FLOCK_WARDRIVE) {
startLog("flock_wardrive");
this->startWardriverWiFi();
this->wifi_initialized = true;
}
String header_line = "WigleWifi-1.4,appRelease=" + (String)MARAUDER_VERSION + ",model=ESP32 Marauder,release=" + (String)MARAUDER_VERSION + ",device=ESP32 Marauder,display=SPI TFT,board=ESP32 Marauder,brand=JustCallMeKoko\nMAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type\n";
buffer_obj.append(header_line);
} else {
return;
}
#else
return;
#endif
#ifdef HAS_SCREEN
display_obj.TOP_FIXED_AREA_2 = 48;
display_obj.tteBar = true;
@@ -4973,6 +5065,10 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
display_obj.tft.drawCentreString("Simple Sniff", TFT_WIDTH / 2, 16, 2);
else if (scan_mode == BT_SCAN_SIMPLE_TWO)
display_obj.tft.drawCentreString("Simple Sniff 2", TFT_WIDTH / 2, 16, 2);
if (scan_mode == BT_SCAN_WAR_DRIVE)
display_obj.tft.drawCentreString("BT Wardrive",TFT_WIDTH / 2,16,2);
else if (scan_mode == BT_SCAN_WAR_DRIVE_CONT)
display_obj.tft.drawCentreString("BT Wardrive Continuous",TFT_WIDTH / 2,16,2);
#ifdef HAS_ILI9341
display_obj.touchToExit();
#endif
@@ -4987,6 +5083,8 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
pBLEScan->setScanCallbacks(new bluetoothScanAllCallback(), false);
#endif
else if ((scan_mode == BT_SCAN_FLIPPER) ||
(scan_mode == BT_SCAN_WAR_DRIVE) ||
(scan_mode == BT_SCAN_WAR_DRIVE_CONT) ||
(scan_mode == BT_SCAN_FLOCK) ||
(scan_mode == BT_SCAN_FLOCK_WARDRIVE) ||
(scan_mode == BT_SCAN_SIMPLE) ||
@@ -5016,6 +5114,8 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
}
else if (scan_mode == BT_SCAN_FLOCK_WARDRIVE) {
startLog("flock_wardrive");
this->startWardriverWiFi();
this->wifi_initialized = true;
}
String header_line = "WigleWifi-1.4,appRelease=" + (String)MARAUDER_VERSION + ",model=ESP32 Marauder,release=" + (String)MARAUDER_VERSION + ",device=ESP32 Marauder,display=SPI TFT,board=ESP32 Marauder,brand=JustCallMeKoko\nMAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type\n";
buffer_obj.append(header_line);
@@ -5058,8 +5158,7 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color)
#endif
}
else if (scan_mode == BT_SCAN_SKIMMERS)
{
else if (scan_mode == BT_SCAN_SKIMMERS) {
#ifdef HAS_SCREEN
display_obj.TOP_FIXED_AREA_2 = 160;
display_obj.tteBar = true;
@@ -10105,13 +10204,21 @@ void WiFiScan::main(uint32_t currentTime)
this->ble_scanning = false;
}
else {
pBLEScan->start(0, scanCompleteCB, false);
this->ble_scanning = true;
return;
if (WiFi.scanComplete() != WIFI_SCAN_RUNNING) {
pBLEScan->start(0, scanCompleteCB, false);
this->ble_scanning = true;
return;
}
}
#endif
if (currentScanMode == BT_SCAN_FLOCK)
channelHop();
else if (currentScanMode == BT_SCAN_FLOCK_WARDRIVE) {
#ifdef HAS_GPS
if (gps_obj.getGpsModuleStatus())
this->executeWarDrive();
#endif
}
}
}
else if (currentScanMode == WIFI_PING_SCAN) {