From b6d1ce7a37d46e262be203098bf8c30ecb07e198 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Sun, 23 Nov 2025 07:03:34 -0500 Subject: [PATCH 01/10] Compensate for NimBLE memory leak --- esp32_marauder/WiFiScan.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index 1bf93a0..867f067 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -8912,7 +8912,11 @@ void WiFiScan::main(uint32_t currentTime) channelHop(); } } - else if (currentScanMode == BT_SCAN_FLOCK) { + else if ((currentScanMode == BT_SCAN_FLOCK) || + (currentScanMode == BT_SCAN_WAR_DRIVE) || + (currentScanMode == BT_SCAN_WAR_DRIVE_CONT) || + (currentScanMode == BT_SCAN_FLIPPER) || + (currentScanMode == BT_SCAN_AIRTAG)) { if (currentTime - initTime >= 5000) { initTime = millis(); #ifdef HAS_BT @@ -8957,6 +8961,13 @@ void WiFiScan::main(uint32_t currentTime) if (currentTime - initTime >= this->channel_hop_delay * 500) { initTime = millis(); + #ifdef HAS_BT + pBLEScan->stop(); + delay(5); + pBLEScan->clearResults(); + pBLEScan->start(0, scanCompleteCB, false); + #endif + #ifdef HAS_SCREEN display_obj.tft.fillRect(0, (STATUS_BAR_WIDTH * 2) + 1 + EXT_BUTTON_WIDTH, @@ -9004,6 +9015,15 @@ void WiFiScan::main(uint32_t currentTime) else if ((currentScanMode == WIFI_SCAN_CHAN_ANALYZER) || (currentScanMode == BT_SCAN_ANALYZER)) { this->channelAnalyzerLoop(currentTime); + + if (currentScanMode == BT_SCAN_ANALYZER) { + #ifdef HAS_BT + pBLEScan->stop(); + delay(5); + pBLEScan->clearResults(); + pBLEScan->start(0, scanCompleteCB, false); + #endif + } } else if (currentScanMode == WIFI_SCAN_CHAN_ACT) { this->channelActivityLoop(currentTime); From cd3ab5108089638389c062acfed2034bc777bfc3 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Sun, 23 Nov 2025 07:41:31 -0500 Subject: [PATCH 02/10] Add flock command and icon --- esp32_marauder/Assets.h | 6 ++++++ esp32_marauder/CommandLine.cpp | 8 ++++++++ esp32_marauder/CommandLine.h | 2 +- esp32_marauder/MenuFunctions.cpp | 2 +- esp32_marauder/MenuFunctions.h | 1 + pictures/icons/flock_22.bmp | Bin 0 -> 1606 bytes pictures/xbm/flock_22.xbm | 9 +++++++++ 7 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 pictures/icons/flock_22.bmp create mode 100644 pictures/xbm/flock_22.xbm diff --git a/esp32_marauder/Assets.h b/esp32_marauder/Assets.h index 1da29aa..1341949 100644 --- a/esp32_marauder/Assets.h +++ b/esp32_marauder/Assets.h @@ -233,6 +233,12 @@ PROGMEM static const unsigned char menu_icons[][66] = { 0x7B, 0x3E, 0x37, 0x7B, 0xBF, 0x37, 0xFB, 0xF7, 0x37, 0xFB, 0xF7, 0x37, 0xFB, 0xF3, 0x37, 0xBB, 0x7F, 0x37, 0x37, 0x3F, 0x3B, 0x77, 0x80, 0x3B, 0xEF, 0xE1, 0x3D, 0xDF, 0xFF, 0x3E, 0x3F, 0x3F, 0x3F, 0xFF, 0xC0, 0x3F, + 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F}, + {0xFF, 0xFF, 0x3F, 0xFF, 0xE0, 0x3F, 0x3F, 0x9F, 0x3F, 0xBF, 0xBF, 0x3F, // FLOCK: 41 + 0xDF, 0x71, 0x3F, 0xDF, 0x6E, 0x3F, 0xDF, 0x6E, 0x3F, 0xDF, 0x6E, 0x3F, + 0xDF, 0x71, 0x3F, 0xDF, 0x7B, 0x3F, 0xDF, 0x7F, 0x3F, 0xDF, 0x7F, 0x3F, + 0xDF, 0x7F, 0x3F, 0xBF, 0xBF, 0x3F, 0xBF, 0xBB, 0x3F, 0x3F, 0x9B, 0x3F, + 0x7F, 0xDF, 0x3F, 0x7F, 0xDF, 0x3F, 0x7F, 0xDF, 0x3F, 0xFF, 0xE0, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F} }; diff --git a/esp32_marauder/CommandLine.cpp b/esp32_marauder/CommandLine.cpp index 7b21600..683f5b3 100644 --- a/esp32_marauder/CommandLine.cpp +++ b/esp32_marauder/CommandLine.cpp @@ -1022,6 +1022,14 @@ void CommandLine::runCommand(String input) { #endif wifi_scan_obj.StartScan(BT_SCAN_FLIPPER, TFT_ORANGE); } + else if (bt_type == "flock") { + Serial.println("Starting Flock sniff. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_SCAN_FLOCK, TFT_ORANGE); + } } // General bluetooth sniff else { diff --git a/esp32_marauder/CommandLine.h b/esp32_marauder/CommandLine.h index 0fa4838..c0ae872 100644 --- a/esp32_marauder/CommandLine.h +++ b/esp32_marauder/CommandLine.h @@ -168,7 +168,7 @@ const char PROGMEM HELP_LOAD_CMD[] = "load -a/-s"; const char PROGMEM HELP_JOIN_CMD[] = "join -a -p /-s"; // Bluetooth sniff/scan -const char PROGMEM HELP_BT_SNIFF_CMD[] = "sniffbt [-t] "; +const char PROGMEM HELP_BT_SNIFF_CMD[] = "sniffbt [-t] "; const char PROGMEM HELP_BT_SPAM_CMD[] = "blespam -t "; const char PROGMEM HELP_BT_SPOOFAT_CMD[] = "spoofat -t "; //const char PROGMEM HELP_BT_SOUR_APPLE_CMD[] = "sourapple"; diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index bb33ea4..6f1c068 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -3171,7 +3171,7 @@ void MenuFunctions::RunSetup() this->renderGraphUI(BT_SCAN_ANALYZER); wifi_scan_obj.StartScan(BT_SCAN_ANALYZER, TFT_CYAN); }); - this->addNodes(&bluetoothSnifferMenu, "Flock Sniff", TFTORANGE, NULL, BLUETOOTH_SNIFF, [this]() { + this->addNodes(&bluetoothSnifferMenu, "Flock Sniff", TFTORANGE, NULL, FLOCK, [this]() { display_obj.clearScreen(); this->drawStatusBar(); wifi_scan_obj.StartScan(BT_SCAN_FLOCK, TFT_ORANGE); diff --git a/esp32_marauder/MenuFunctions.h b/esp32_marauder/MenuFunctions.h index b44d67d..036355a 100644 --- a/esp32_marauder/MenuFunctions.h +++ b/esp32_marauder/MenuFunctions.h @@ -93,6 +93,7 @@ extern Settings settings_obj; #define JOINED 38 #define FORCE 39 #define FUNNY_BEACON 40 +#define FLOCK 41 PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p); PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data); diff --git a/pictures/icons/flock_22.bmp b/pictures/icons/flock_22.bmp new file mode 100644 index 0000000000000000000000000000000000000000..00515c17eee76c36043e87445155bef51fae4db2 GIT binary patch literal 1606 zcmbu-J&qGW5QgCbtq>s*afO_KxI{q49qK6GQ7S-tj*2-0K^cWyG{GHC~Qiq_rM-`k$PJ(_tS!3!@m z#w-jD3Xu>BjWJ7uBfvung~pu!*U3OaC^W{5qLm|%5DJZ0fF8Au3)#vDr!<76Nq6dGe<{4&QHd19S~#+cmT2qc6;WA?IzlYxX#Xv|*HbTW_- z3XR#z&7VktgivVA-U{VpAR!bQv$sh*8Au3)#vEHn<76Nq6dGgA_}d(Tgiu)L?5*Wa z1`0}@w6dJR)tDFoZghFHXRxT$438B!Kz0KRnKtd>c`f;+a zd?(s7I~|vuPOAjYRkd#ac<|eMzupbrHv5 Date: Sun, 23 Nov 2025 18:55:32 -0600 Subject: [PATCH 03/10] Update CommandLine.h Add MAC cli commands --- esp32_marauder/CommandLine.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/esp32_marauder/CommandLine.h b/esp32_marauder/CommandLine.h index 0fa4838..40af0b4 100644 --- a/esp32_marauder/CommandLine.h +++ b/esp32_marauder/CommandLine.h @@ -97,6 +97,10 @@ const char PROGMEM SSID_CMD[] = "ssid"; const char PROGMEM SAVE_CMD[] = "save"; const char PROGMEM LOAD_CMD[] = "load"; const char PROGMEM JOIN_CMD[] = "join"; +const char PROGMEM MAC_CMD[] = "randapmac"; +const char PROGMEM MAC_CMD[] = "randstamac"; +const char PROGMEM MAC_CMD[] = "setapmac"; +const char PROGMEM MAC_CMD[] = "setstamac"; // Bluetooth sniff/scan const char PROGMEM BT_SPAM_CMD[] = "blespam"; @@ -166,6 +170,10 @@ const char PROGMEM HELP_SSID_CMD_B[] = "ssid -r "; const char PROGMEM HELP_SAVE_CMD[] = "save -a/-s"; const char PROGMEM HELP_LOAD_CMD[] = "load -a/-s"; const char PROGMEM HELP_JOIN_CMD[] = "join -a -p /-s"; +const char PROGMEM HELP_MAC_CMD[] = "randapmac"; +const char PROGMEM HELP_MAC_CMD[] = "randstamac"; +const char PROGMEM HELP_MAC_CMD[] = "setapmac [-a ]"; +const char PROGMEM HELP_MAC_CMD[] = "setstamac [-s ]"; // Bluetooth sniff/scan const char PROGMEM HELP_BT_SNIFF_CMD[] = "sniffbt [-t] "; From aee56f879f02f4a56af1da48ea3a84577a5a7981 Mon Sep 17 00:00:00 2001 From: H4W9 Date: Sun, 23 Nov 2025 19:16:04 -0600 Subject: [PATCH 04/10] Update CommandLine.cpp more --- esp32_marauder/CommandLine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/esp32_marauder/CommandLine.cpp b/esp32_marauder/CommandLine.cpp index 7b21600..bfd2359 100644 --- a/esp32_marauder/CommandLine.cpp +++ b/esp32_marauder/CommandLine.cpp @@ -262,6 +262,10 @@ void CommandLine::runCommand(String input) { Serial.println(HELP_SAVE_CMD); Serial.println(HELP_LOAD_CMD); Serial.println(HELP_JOIN_CMD); + Serial.println(HELP_MAC_CMD_A); + Serial.println(HELP_MAC_CMD_B); + Serial.println(HELP_MAC_CMD_C); + Serial.println(HELP_MAC_CMD_D); // Bluetooth sniff/scan #ifdef HAS_BT From c901ade02c4d1cdd27180d1d1658975b24f62879 Mon Sep 17 00:00:00 2001 From: H4W9 Date: Sun, 23 Nov 2025 19:18:23 -0600 Subject: [PATCH 05/10] Update CommandLine.h Finished what I started... --- esp32_marauder/CommandLine.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/esp32_marauder/CommandLine.h b/esp32_marauder/CommandLine.h index 40af0b4..72cdea6 100644 --- a/esp32_marauder/CommandLine.h +++ b/esp32_marauder/CommandLine.h @@ -97,10 +97,10 @@ const char PROGMEM SSID_CMD[] = "ssid"; const char PROGMEM SAVE_CMD[] = "save"; const char PROGMEM LOAD_CMD[] = "load"; const char PROGMEM JOIN_CMD[] = "join"; -const char PROGMEM MAC_CMD[] = "randapmac"; -const char PROGMEM MAC_CMD[] = "randstamac"; -const char PROGMEM MAC_CMD[] = "setapmac"; -const char PROGMEM MAC_CMD[] = "setstamac"; +const char PROGMEM MAC_CMD_A[] = "randapmac"; +const char PROGMEM MAC_CMD_B[] = "randstamac"; +const char PROGMEM MAC_CMD_C[] = "setapmac"; +const char PROGMEM MAC_CMD_D[] = "setstamac"; // Bluetooth sniff/scan const char PROGMEM BT_SPAM_CMD[] = "blespam"; @@ -170,10 +170,10 @@ const char PROGMEM HELP_SSID_CMD_B[] = "ssid -r "; const char PROGMEM HELP_SAVE_CMD[] = "save -a/-s"; const char PROGMEM HELP_LOAD_CMD[] = "load -a/-s"; const char PROGMEM HELP_JOIN_CMD[] = "join -a -p /-s"; -const char PROGMEM HELP_MAC_CMD[] = "randapmac"; -const char PROGMEM HELP_MAC_CMD[] = "randstamac"; -const char PROGMEM HELP_MAC_CMD[] = "setapmac [-a ]"; -const char PROGMEM HELP_MAC_CMD[] = "setstamac [-s ]"; +const char PROGMEM HELP_MAC_CMD_A[] = "randapmac"; +const char PROGMEM HELP_MAC_CMD_B[] = "randstamac"; +const char PROGMEM HELP_MAC_CMD_C[] = "setapmac [-a ]"; +const char PROGMEM HELP_MAC_CMD_D[] = "setstamac [-s ]"; // Bluetooth sniff/scan const char PROGMEM HELP_BT_SNIFF_CMD[] = "sniffbt [-t] "; From 57f867a8ec2c013d1b1711c99c2e19d41563e9f6 Mon Sep 17 00:00:00 2001 From: H4W9 Date: Sun, 23 Nov 2025 22:56:02 -0600 Subject: [PATCH 06/10] Update CommandLine.h correction --- esp32_marauder/CommandLine.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esp32_marauder/CommandLine.h b/esp32_marauder/CommandLine.h index 72cdea6..6435844 100644 --- a/esp32_marauder/CommandLine.h +++ b/esp32_marauder/CommandLine.h @@ -99,8 +99,8 @@ const char PROGMEM LOAD_CMD[] = "load"; const char PROGMEM JOIN_CMD[] = "join"; const char PROGMEM MAC_CMD_A[] = "randapmac"; const char PROGMEM MAC_CMD_B[] = "randstamac"; -const char PROGMEM MAC_CMD_C[] = "setapmac"; -const char PROGMEM MAC_CMD_D[] = "setstamac"; +const char PROGMEM MAC_CMD_C[] = "cloneapmac"; +const char PROGMEM MAC_CMD_D[] = "clonestamac"; // Bluetooth sniff/scan const char PROGMEM BT_SPAM_CMD[] = "blespam"; @@ -172,8 +172,8 @@ const char PROGMEM HELP_LOAD_CMD[] = "load -a/-s"; const char PROGMEM HELP_JOIN_CMD[] = "join -a -p /-s"; const char PROGMEM HELP_MAC_CMD_A[] = "randapmac"; const char PROGMEM HELP_MAC_CMD_B[] = "randstamac"; -const char PROGMEM HELP_MAC_CMD_C[] = "setapmac [-a ]"; -const char PROGMEM HELP_MAC_CMD_D[] = "setstamac [-s ]"; +const char PROGMEM HELP_MAC_CMD_C[] = "cloneapmac [-a ]"; +const char PROGMEM HELP_MAC_CMD_D[] = "clonestamac [-s ]"; // Bluetooth sniff/scan const char PROGMEM HELP_BT_SNIFF_CMD[] = "sniffbt [-t] "; From a1ff26a9d219bbb4fb3b301cf5cad490a5d82f2c Mon Sep 17 00:00:00 2001 From: H4W9 Date: Mon, 24 Nov 2025 01:44:30 -0600 Subject: [PATCH 07/10] Update CommandLine.cpp Add the command actions --- esp32_marauder/CommandLine.cpp | 77 ++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/esp32_marauder/CommandLine.cpp b/esp32_marauder/CommandLine.cpp index bfd2359..cbec578 100644 --- a/esp32_marauder/CommandLine.cpp +++ b/esp32_marauder/CommandLine.cpp @@ -813,6 +813,83 @@ void CommandLine::runCommand(String input) { } } + + //// MAC Address commands (Added by H4W9_4) + // Generate random MAC for AP + if (cmd_args.get(0) == MAC_CMD_A) { + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.RunGenerateRandomMac(true); + } + + // Generate random MAC for STA + else if (cmd_args.get(0) == MAC_CMD_B) { + //Serial.println("Setting STA MAC: " + macToString(this->sta_mac)); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.RunGenerateRandomMac(false); + } + + // Clone MAC for AP + else if (cmd_args.get(0) == MAC_CMD_C) { + int ap_sw = this->argSearch(&cmd_args, "-a"); // APs + + if (ap_sw == -1) { + Serial.println("You did not provide a target index"); + return; + } + + int ap_index = cmd_args.get(ap_sw + 1).toInt(); + + if ((ap_index < 0) || (ap_index > access_points->size() - 1)) { + Serial.println("The provided index was not in range"); + return; + } + + if (ap_sw != -1) { + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + for (int i = 0; i < access_points->size(); i++) { + wifi_scan_obj.RunSetMac(access_points->get(i).bssid, true); + } + } + } + + // Clone MAC for STA + else if (cmd_args.get(0) == MAC_CMD_D) { + int cl_sw = this->argSearch(&cmd_args, "-s"); // Stations + + if (cl_sw == -1) { + Serial.println("You did not provide a target index"); + return; + } + + int sta_index = cmd_args.get(cl_sw + 1).toInt(); + + if ((sta_index < 0) || (sta_index > stations->size() - 1)) { + Serial.println("The provided index was not in range"); + return; + } + + if (cl_sw != -1) { + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + for (int i = 0; i < stations->size(); i++) { + wifi_scan_obj.RunSetMac(stations->get(i).mac, false); + } + } + } + //// End MAC Address commands (Added by H4W9_4) + + //// WiFi attack commands // attack if (cmd_args.get(0) == ATTACK_CMD) { From ccf7cd149316bb02c00527fe7e3e935bef720cba Mon Sep 17 00:00:00 2001 From: H4W9 Date: Mon, 24 Nov 2025 07:49:14 -0600 Subject: [PATCH 08/10] Update CommandLine.cpp Seriously, gotta filter em... --- esp32_marauder/CommandLine.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/esp32_marauder/CommandLine.cpp b/esp32_marauder/CommandLine.cpp index cbec578..11cc704 100644 --- a/esp32_marauder/CommandLine.cpp +++ b/esp32_marauder/CommandLine.cpp @@ -855,9 +855,8 @@ void CommandLine::runCommand(String input) { display_obj.clearScreen(); menu_function_obj.drawStatusBar(); #endif - for (int i = 0; i < access_points->size(); i++) { - wifi_scan_obj.RunSetMac(access_points->get(i).bssid, true); - } + int filter_ap = cmd_args.get(ap_sw + 1).toInt(); + wifi_scan_obj.RunSetMac(access_points->get(filter_ap).bssid, true); } } @@ -882,9 +881,8 @@ void CommandLine::runCommand(String input) { display_obj.clearScreen(); menu_function_obj.drawStatusBar(); #endif - for (int i = 0; i < stations->size(); i++) { - wifi_scan_obj.RunSetMac(stations->get(i).mac, false); - } + int filter_sta = cmd_args.get(cl_sw + 1).toInt(); + wifi_scan_obj.RunSetMac(stations->get(filter_sta).mac, false); } } //// End MAC Address commands (Added by H4W9_4) From b714f274b54ffd89a7afa13d1c3dc2d6408f1d78 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Mon, 24 Nov 2025 13:07:20 -0500 Subject: [PATCH 09/10] Add Flock wardriving --- esp32_marauder/MenuFunctions.cpp | 7 ++ esp32_marauder/WiFiScan.cpp | 204 ++++++++++++++++++++++++++++++- esp32_marauder/WiFiScan.h | 6 +- 3 files changed, 212 insertions(+), 5 deletions(-) diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index 6f1c068..fc1be9d 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -921,6 +921,7 @@ void MenuFunctions::main(uint32_t currentTime) (wifi_scan_obj.currentScanMode == BT_SCAN_AIRTAG_MON) || (wifi_scan_obj.currentScanMode == BT_SCAN_FLIPPER) || (wifi_scan_obj.currentScanMode == BT_SCAN_FLOCK) || + (wifi_scan_obj.currentScanMode == BT_SCAN_FLOCK_WARDRIVE) || (wifi_scan_obj.currentScanMode == BT_SCAN_SIMPLE) || (wifi_scan_obj.currentScanMode == BT_SCAN_SIMPLE_TWO) || (wifi_scan_obj.currentScanMode == BT_ATTACK_SOUR_APPLE) || @@ -1019,6 +1020,7 @@ void MenuFunctions::main(uint32_t currentTime) (wifi_scan_obj.currentScanMode == BT_SCAN_AIRTAG_MON) || (wifi_scan_obj.currentScanMode == BT_SCAN_FLIPPER) || (wifi_scan_obj.currentScanMode == BT_SCAN_FLOCK) || + (wifi_scan_obj.currentScanMode == BT_SCAN_FLOCK_WARDRIVE) || (wifi_scan_obj.currentScanMode == BT_SCAN_SIMPLE) || (wifi_scan_obj.currentScanMode == BT_SCAN_SIMPLE_TWO) || (wifi_scan_obj.currentScanMode == BT_ATTACK_SOUR_APPLE) || @@ -3176,6 +3178,11 @@ void MenuFunctions::RunSetup() this->drawStatusBar(); wifi_scan_obj.StartScan(BT_SCAN_FLOCK, TFT_ORANGE); }); + this->addNodes(&bluetoothSnifferMenu, "Flock Wardrive", TFTCYAN, NULL, FLOCK, [this]() { + display_obj.clearScreen(); + this->drawStatusBar(); + wifi_scan_obj.StartScan(BT_SCAN_FLOCK_WARDRIVE, TFT_CYAN); + }); /*this->addNodes(&bluetoothSnifferMenu, "Simple Sniff", TFTWHITE, NULL, BLUETOOTH_SNIFF, [this]() { display_obj.clearScreen(); this->drawStatusBar(); diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index 867f067..4b634ef 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -623,6 +623,180 @@ extern "C" { // (struct FlockBattery { String mac; String name; String serial; int rssi; uint32_t last_seen; }; etc.) } } + else if (wifi_scan_obj.currentScanMode == BT_SCAN_FLOCK_WARDRIVE) { + bool do_save = false; + #ifdef HAS_GPS + if (gps_obj.getGpsModuleStatus()) { + + unsigned char mac_char[6]; + wifi_scan_obj.copyNimbleMac(advertisedDevice->getAddress(), mac_char); + + if (wifi_scan_obj.seen_mac(mac_char)) + return; + + uint8_t* payLoad = advertisedDevice->getPayload(); + size_t len = advertisedDevice->getPayloadLength(); + + bool hasXuntongMfg = false; + size_t mfgIndex = 0; // index of 0xFF (AD type) + + // Look for Company ID XUNTONG (0x09C8), + for (size_t i = 1; i + 3 < len; i++) { + if (payLoad[i] == 0xFF && // AD type: Manufacturer Specific + payLoad[i + 1] == 0xC8 && + payLoad[i + 2] == 0x09) { + hasXuntongMfg = true; + mfgIndex = i; + break; + } + } + + String name = advertisedDevice->getName().c_str(); + + // Check for old penguin name + bool penguin = false; + + if (name.length() > 0) { + // Old firmware: "Penguin-XXXXXXXXXX" + if (name.startsWith("Penguin-") && name.length() == 18) { + bool allDigits = true; + for (int i = 8; i < name.length(); i++) { + char c = name.charAt(i); + if (c < '0' || c > '9') { + allDigits = false; + break; + } + } + if (allDigits) { + penguin = true; + } + } + + // Legacy name: "FS Ext Battery" + if (name == "FS Ext Battery") { + penguin = true; + } + + // New firmware: "NNNNNNNNNN" (10 digits) + if (name.length() == 10) { + bool allDigits = true; + for (int i = 0; i < name.length(); i++) { + char c = name.charAt(i); + if (c < '0' || c > '9') { + allDigits = false; + break; + } + } + if (allDigits) { + penguin = true; + } + } + } + + // Try to extract serial number from the XUNTONG manufacturer data + String serial = ""; + + if (hasXuntongMfg && mfgIndex > 0) { + uint8_t adLen = payLoad[mfgIndex - 1]; // length byte for this AD structure + size_t adStart = mfgIndex - 1; + size_t adEnd = adStart + adLen; // exclusive end index + + if (adEnd > len) { + adEnd = len; + } + + size_t vendorStart = mfgIndex + 3; + if (vendorStart < adEnd) { + bool started = false; + + for (size_t k = vendorStart; k < adEnd; k++) { + char c = (char)payLoad[k]; + + if (!started) { + if (c == 'T' && (k + 1) < adEnd && (char)payLoad[k + 1] == 'N') { + started = true; + serial += 'T'; + serial += 'N'; + k++; + } + } else { + // Once started, append digits (skip separators; stop on anything else) + if (c >= '0' && c <= '9') { + serial += c; + } else if (c == ' ' || c == '#' || c == '-') { + continue; + } else { + break; + } + } + } + } + } + + // Final decision on marking as Flock Penguin battery + if (hasXuntongMfg && (penguin || name.length() == 0)) { + String mac = advertisedDevice->getAddress().toString().c_str(); + mac.toUpperCase(); + int rssi = advertisedDevice->getRSSI(); + + // rssi + // mac + // name + // serial + + if (gps_obj.getFixStatus()) + do_save = true; + + #ifdef HAS_SCREEN + String display_string; + if (!do_save) + display_string = RED_KEY; + else + display_string = GREEN_KEY; + + display_string.concat(String(rssi)); + display_string.concat(" "); + if (serial.length()) { + display_string.concat(serial); + display_string.concat(" "); + } + + if (name.length() == 0) { + display_string.concat(" MAC:"); + display_string.concat(mac); + } + else { + display_string.concat(" "); + display_string.concat(name); + } + + uint8_t temp_len = display_string.length(); + for (uint8_t i = 0; i < 40 - temp_len; i++) { + display_string.concat(" "); + } + + if (!display_obj.printing) { + display_obj.loading = true; + display_obj.display_buffer->add(display_string); + display_obj.loading = false; + } + #endif + + String wardrive_line = (String)advertisedDevice->getAddress().toString().c_str() + ",,[BLE]," + gps_obj.getDatetime() + ",0," + (String)advertisedDevice->getRSSI() + "," + gps_obj.getLat() + "," + gps_obj.getLon() + "," + gps_obj.getAlt() + "," + gps_obj.getAccuracy() + ",BLE\n"; + Serial.print(wardrive_line); + + wifi_scan_obj.save_mac(mac_char); + + if (do_save) + buffer_obj.append(wardrive_line); + + // To-do: + // track in a list like AirTag / Flipper, if you want + // (struct FlockBattery { String mac; String name; String serial; int rssi; uint32_t last_seen; }; etc.) + } + } + #endif + } else if (wifi_scan_obj.currentScanMode == BT_SCAN_SIMPLE) { wifi_scan_obj.bt_frames++; } @@ -1229,6 +1403,7 @@ void WiFiScan::StartScan(uint8_t scan_mode, uint16_t color) (scan_mode == BT_SCAN_AIRTAG_MON) || (scan_mode == BT_SCAN_FLIPPER) || (scan_mode == BT_SCAN_FLOCK) || + (scan_mode == BT_SCAN_FLOCK_WARDRIVE) || (scan_mode == BT_SCAN_ANALYZER) || (scan_mode == BT_SCAN_SIMPLE) || (scan_mode == BT_SCAN_SIMPLE_TWO)) { @@ -1552,6 +1727,7 @@ void WiFiScan::StopScan(uint8_t scan_mode) (currentScanMode == BT_SCAN_AIRTAG_MON) || (currentScanMode == BT_SCAN_FLIPPER) || (currentScanMode == BT_SCAN_FLOCK) || + (currentScanMode == BT_SCAN_FLOCK_WARDRIVE) || (currentScanMode == BT_ATTACK_SOUR_APPLE) || (currentScanMode == BT_ATTACK_SWIFTPAIR_SPAM) || (currentScanMode == BT_ATTACK_SPAM_ALL) || @@ -1659,6 +1835,13 @@ bool WiFiScan::mac_cmp(struct mac_addr addr1, struct mac_addr addr2) { return true; } +void WiFiScan::copyNimbleMac(const BLEAddress &addr, unsigned char out[6]) { + const uint8_t* bytes = addr.getNative(); // NimBLE gives MAC as uint8_t[6] + for (int i = 0; i < 6; i++) { + out[i] = bytes[i]; + } +} + bool WiFiScan::seen_mac(unsigned char* mac) { //Return true if this MAC address is in the recently seen array. @@ -4014,7 +4197,7 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color) NimBLEDevice::setScanDuplicateCacheSize(0); } - if (scan_mode == BT_SCAN_FLOCK) + if ((scan_mode == BT_SCAN_FLOCK) || (scan_mode == BT_SCAN_FLOCK_WARDRIVE)) NimBLEDevice::setScanDuplicateCacheSize(0); if ((scan_mode == BT_SCAN_SIMPLE) || (scan_mode == BT_SCAN_SIMPLE_TWO)) @@ -4027,6 +4210,7 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color) (scan_mode == BT_SCAN_AIRTAG_MON) || (scan_mode == BT_SCAN_FLIPPER) || (scan_mode == BT_SCAN_FLOCK) || + (scan_mode == BT_SCAN_FLOCK_WARDRIVE) || (scan_mode == BT_SCAN_SIMPLE) || (scan_mode == BT_SCAN_SIMPLE_TWO)) { @@ -4048,6 +4232,8 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color) display_obj.tft.drawCentreString("Flipper Sniff", TFT_WIDTH / 2, 16, 2); else if (scan_mode == BT_SCAN_FLOCK) display_obj.tft.drawCentreString("Flock Sniff", TFT_WIDTH / 2, 16, 2); + else if (scan_mode == BT_SCAN_FLOCK_WARDRIVE) + display_obj.tft.drawCentreString("Flock Wardrive", TFT_WIDTH / 2, 16, 2); else if (scan_mode == BT_SCAN_SIMPLE) display_obj.tft.drawCentreString("Simple Sniff", TFT_WIDTH / 2, 16, 2); else if (scan_mode == BT_SCAN_SIMPLE_TWO) @@ -4072,6 +4258,9 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color) else if (scan_mode == BT_SCAN_FLOCK) { pBLEScan->setAdvertisedDeviceCallbacks(new bluetoothScanAllCallback(), true); } + else if (scan_mode == BT_SCAN_FLOCK_WARDRIVE) { + pBLEScan->setAdvertisedDeviceCallbacks(new bluetoothScanAllCallback(), true); + } else if (scan_mode == BT_SCAN_SIMPLE) { pBLEScan->setAdvertisedDeviceCallbacks(new bluetoothScanAllCallback(), true); } @@ -4079,7 +4268,7 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color) pBLEScan->setAdvertisedDeviceCallbacks(new bluetoothScanAllCallback(), false); } } - else if ((scan_mode == BT_SCAN_WAR_DRIVE) || (scan_mode == BT_SCAN_WAR_DRIVE_CONT)) { + else if ((scan_mode == BT_SCAN_WAR_DRIVE) || (scan_mode == BT_SCAN_WAR_DRIVE_CONT) || (scan_mode == BT_SCAN_FLOCK_WARDRIVE)) { #ifdef HAS_GPS if (gps_obj.getGpsModuleStatus()) { if (scan_mode == BT_SCAN_WAR_DRIVE) { @@ -4088,6 +4277,9 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color) else if (scan_mode == BT_SCAN_WAR_DRIVE_CONT) { startLog("bt_wardrive_cont"); } + else if (scan_mode == BT_SCAN_FLOCK_WARDRIVE) { + startLog("flock_wardrive"); + } 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 { @@ -4160,7 +4352,12 @@ void WiFiScan::RunBluetoothScan(uint8_t scan_mode, uint16_t color) pBLEScan->setInterval(100); pBLEScan->setWindow(99); // less or equal setInterval value pBLEScan->setMaxResults(0); - if ((scan_mode == BT_SCAN_WAR_DRIVE_CONT) || (scan_mode == BT_SCAN_ANALYZER) || (scan_mode == BT_SCAN_FLOCK) || (scan_mode == BT_SCAN_SIMPLE) || (scan_mode == BT_SCAN_SIMPLE_TWO)) + if ((scan_mode == BT_SCAN_WAR_DRIVE_CONT) || + (scan_mode == BT_SCAN_ANALYZER) || + (scan_mode == BT_SCAN_FLOCK) || + (scan_mode == BT_SCAN_SIMPLE) || + (scan_mode == BT_SCAN_SIMPLE_TWO) || + (scan_mode == BT_SCAN_FLOCK_WARDRIVE)) pBLEScan->setDuplicateFilter(false); pBLEScan->start(0, scanCompleteCB, false); Serial.println("Started BLE Scan"); @@ -8913,6 +9110,7 @@ void WiFiScan::main(uint32_t currentTime) } } else if ((currentScanMode == BT_SCAN_FLOCK) || + (currentScanMode == BT_SCAN_FLOCK_WARDRIVE) || (currentScanMode == BT_SCAN_WAR_DRIVE) || (currentScanMode == BT_SCAN_WAR_DRIVE_CONT) || (currentScanMode == BT_SCAN_FLIPPER) || diff --git a/esp32_marauder/WiFiScan.h b/esp32_marauder/WiFiScan.h index f4b4e02..8c9f46b 100644 --- a/esp32_marauder/WiFiScan.h +++ b/esp32_marauder/WiFiScan.h @@ -141,6 +141,7 @@ #define BT_SCAN_FLOCK 72 #define BT_SCAN_SIMPLE 73 #define BT_SCAN_SIMPLE_TWO 74 +#define BT_SCAN_FLOCK_WARDRIVE 75 #define WIFI_ATTACK_FUNNY_BEACON 99 @@ -534,9 +535,7 @@ class WiFiScan bool beaconHasWPS(const uint8_t* payload, int len); uint8_t getSecurityType(const uint8_t* beacon, uint16_t len); void addAnalyzerValue(int16_t value, int rssi_avg, int16_t target_array[], int array_size); - bool seen_mac(unsigned char* mac); bool mac_cmp(struct mac_addr addr1, struct mac_addr addr2); - void save_mac(unsigned char* mac); void clearMacHistory(); void executeWarDrive(); void executeSourApple(); @@ -720,6 +719,9 @@ class WiFiScan #ifdef HAS_SCREEN int8_t checkAnalyzerButtons(uint32_t currentTime); #endif + bool seen_mac(unsigned char* mac); + void save_mac(unsigned char* mac); + void copyNimbleMac(const BLEAddress &addr, unsigned char out[6]); bool filterActive(); bool RunGPSInfo(bool tracker = false, bool display = true, bool poi = false); void logPoint(String lat, String lon, float alt, String datetime, bool poi = false); From 0fba6966a6c66ffb212ee3c3e1a25dda107adf76 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Mon, 24 Nov 2025 13:20:01 -0500 Subject: [PATCH 10/10] Fix for non bluetooth hardware --- esp32_marauder/WiFiScan.cpp | 14 ++++++++------ esp32_marauder/WiFiScan.h | 4 +++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index 4b634ef..cd1cc42 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -1835,12 +1835,14 @@ bool WiFiScan::mac_cmp(struct mac_addr addr1, struct mac_addr addr2) { return true; } -void WiFiScan::copyNimbleMac(const BLEAddress &addr, unsigned char out[6]) { - const uint8_t* bytes = addr.getNative(); // NimBLE gives MAC as uint8_t[6] - for (int i = 0; i < 6; i++) { - out[i] = bytes[i]; - } -} +#ifdef HAS_BT + void WiFiScan::copyNimbleMac(const BLEAddress &addr, unsigned char out[6]) { + const uint8_t* bytes = addr.getNative(); // NimBLE gives MAC as uint8_t[6] + for (int i = 0; i < 6; i++) { + out[i] = bytes[i]; + } + } +#endif bool WiFiScan::seen_mac(unsigned char* mac) { //Return true if this MAC address is in the recently seen array. diff --git a/esp32_marauder/WiFiScan.h b/esp32_marauder/WiFiScan.h index 8c9f46b..16afa12 100644 --- a/esp32_marauder/WiFiScan.h +++ b/esp32_marauder/WiFiScan.h @@ -721,7 +721,9 @@ class WiFiScan #endif bool seen_mac(unsigned char* mac); void save_mac(unsigned char* mac); - void copyNimbleMac(const BLEAddress &addr, unsigned char out[6]); + #ifdef HAS_BT + void copyNimbleMac(const BLEAddress &addr, unsigned char out[6]); + #endif bool filterActive(); bool RunGPSInfo(bool tracker = false, bool display = true, bool poi = false); void logPoint(String lat, String lon, float alt, String datetime, bool poi = false);