Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions esp32_marauder/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ void CommandLine::runCommand(String input) {
Serial.println(HELP_STOPSCAN_CMD);
#ifdef HAS_GPS
Serial.println(HELP_WARDRIVE_CMD);
Serial.println(HELP_WARDRIVEPOI_CMD);
#endif
Serial.println(HELP_MAC_TRACK_CMD);

Expand Down Expand Up @@ -1391,6 +1392,26 @@ void CommandLine::runCommand(String input) {
#endif
}

// Wardrive POI command
else if (cmd_args.get(0) == WARDRIVEPOI_CMD) {
if (wifi_scan_obj.currentScanMode == WIFI_SCAN_WAR_DRIVE ||
wifi_scan_obj.currentScanMode == WIFI_SCAN_STATION_WAR_DRIVE) {
if (cmd_args.size() > 1) {
// Join remaining args as label
String label = "";
for (int i = 1; i < cmd_args.size(); i++) {
if (i > 1) label += " ";
label += cmd_args.get(i);
}
wifi_scan_obj.tagPOI(label.c_str());
} else {
wifi_scan_obj.tagPOI(nullptr);
}
} else {
Serial.println(F("No active wardrive. Start wardrive first."));
}
}

// Update command
if (cmd_args.get(0) == UPDATE_CMD) {
//int w_sw = this->argSearch(&cmd_args, "-w"); // Web update
Expand Down
3 changes: 3 additions & 0 deletions esp32_marauder/CommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ const char PROGMEM BT_SPOOFAT_CMD[] = "spoofat";
const char PROGMEM BT_WARDRIVE_CMD[] = "btwardrive";
const char PROGMEM BT_SKIM_CMD[] = "sniffskim";

// POI
const char PROGMEM WARDRIVEPOI_CMD[] = "wardrivepoi";

//// Command help messages
// Admin
Expand Down Expand Up @@ -197,6 +199,7 @@ const char PROGMEM HELP_BT_SKIM_CMD[] = "sniffskim";
const char PROGMEM BRIGHTNESS_CMD[] = "brightness";
const char PROGMEM HELP_BRIGHTNESS_CMD[] = "brightness [-c cycle] [-s <0-9>]";

const char PROGMEM HELP_WARDRIVEPOI_CMD[] = "wardrivepoi [label] - Tag a GPS POI during wardrive";
const char PROGMEM HELP_FOOT[] = "==================================";


Expand Down
23 changes: 23 additions & 0 deletions esp32_marauder/MenuFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,29 @@ void MenuFunctions::main(uint32_t currentTime)
}
#endif

// POI button interception during wardrive — full width bottom bar
#ifdef HAS_ILI9341
if (pressed &&
(wifi_scan_obj.currentScanMode == WIFI_SCAN_WAR_DRIVE ||
wifi_scan_obj.currentScanMode == WIFI_SCAN_STATION_WAR_DRIVE)) {
if (t_y >= 270) {
wifi_scan_obj.tagPOI(nullptr);
// Brief green flash
display_obj.tft.fillRect(0, 270, 240, 50, TFT_GREEN);
display_obj.tft.setTextSize(2);
display_obj.tft.setTextColor(TFT_BLACK, TFT_GREEN);
String poiFlash = "POI (" + String(wifi_scan_obj.poiCount) + ")";
int16_t flashWidth = poiFlash.length() * 12;
display_obj.tft.setCursor((240 - flashWidth) / 2, 287);
display_obj.tft.print(poiFlash);
delay(200);
x = -1;
y = -1;
return;
}
}
#endif

// This is if there are scans/attacks going on
#ifdef HAS_ILI9341
if ((wifi_scan_obj.currentScanMode != WIFI_SCAN_OFF) &&
Expand Down
95 changes: 94 additions & 1 deletion esp32_marauder/WiFiScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2728,7 +2728,13 @@ void WiFiScan::StopScan(uint8_t scan_mode) {
this->writeFooter(currentScanMode == GPS_POI);
}


// Close POI file if wardrive was active
if ((currentScanMode == WIFI_SCAN_WAR_DRIVE) ||
(currentScanMode == WIFI_SCAN_STATION_WAR_DRIVE)) {
this->closePoiFile();
}


if ((currentScanMode == BT_SCAN_ALL) ||
(currentScanMode == BT_SCAN_RAYBAN) ||
(currentScanMode == BT_SCAN_AIRTAG) ||
Expand Down Expand Up @@ -4993,6 +4999,83 @@ void WiFiScan::executeWarDrive() {
#endif
}

void WiFiScan::openPoiFile() {
#if defined(HAS_GPS) && defined(HAS_SD)
int fileIndex = 0;
while (SD.exists("/wardrive_poi_" + String(fileIndex) + ".gpx"))
fileIndex++;
poiFileName = "/wardrive_poi_" + String(fileIndex) + ".gpx";
poiFile = SD.open(poiFileName, FILE_WRITE);
if (poiFile) {
poiFile.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<gpx version=\"1.1\" creator=\"ESP32Marauder\">\n");
poiFile.close();
poiFileOpen = true;
poiCount = 0;
Serial.println("POI file opened: " + poiFileName);
} else {
Serial.println("Failed to open POI file");
}
#endif
}

void WiFiScan::closePoiFile() {
#if defined(HAS_GPS) && defined(HAS_SD)
if (poiFileOpen) {
if (poiCount > 0) {
poiFile = SD.open(poiFileName, FILE_APPEND);
if (poiFile) {
poiFile.print("</gpx>\n");
poiFile.close();
}
Serial.println("POI file closed: " + poiFileName + " (" + String(poiCount) + " points)");
} else {
sd_obj.removeFile(poiFileName);
Serial.println("POI file removed (empty): " + poiFileName);
}
poiFileOpen = false;
poiCount = 0;
}
#endif
}

void WiFiScan::tagPOI(const char* label) {
#if defined(HAS_GPS) && defined(HAS_SD)
if (currentScanMode != WIFI_SCAN_WAR_DRIVE && currentScanMode != WIFI_SCAN_STATION_WAR_DRIVE) {
Serial.println("POI tagging requires active wardrive");
return;
}
if (!gps_obj.getFixStatus()) {
Serial.println("No GPS fix");
return;
}
if (!poiFileOpen) {
Serial.println("POI file not open");
return;
}
poiCount++;
String poiLabel;
if (label == nullptr || strlen(label) == 0)
poiLabel = "POI " + String(poiCount);
else
poiLabel = String(label);

String datetime = gps_obj.getDatetime();
datetime.replace(" ", "T");
datetime += "Z";

poiFile = SD.open(poiFileName, FILE_APPEND);
if (poiFile) {
poiFile.print(" <wpt lat=\"" + gps_obj.getLat() + "\" lon=\"" + gps_obj.getLon() + "\">\n");
poiFile.print(" <ele>" + String(gps_obj.getAlt(), 2) + "</ele>\n");
poiFile.print(" <time>" + datetime + "</time>\n");
poiFile.print(" <name>" + poiLabel + "</name>\n");
poiFile.print(" </wpt>\n");
poiFile.close();
}
Serial.println("POI tagged: " + poiLabel + " (" + gps_obj.getLat() + ", " + gps_obj.getLon() + ")");
#endif
}

void WiFiScan::displayWardriveStats() {
#ifdef HAS_SCREEN
#ifdef HAS_GPS
Expand Down Expand Up @@ -5036,6 +5119,15 @@ void WiFiScan::displayWardriveStats() {
display_obj.tft.println("Size: " + (String)((float)sd_obj.getFile(buffer_obj.getFileName()).size() / 1024) + "KB");
#endif

// POI button — full width bottom bar
display_obj.tft.drawRect(0, 270, 240, 50, TFT_MAGENTA);
display_obj.tft.setTextSize(2);
display_obj.tft.setTextColor(TFT_MAGENTA, TFT_BLACK);
String poiText = "POI (" + String(this->poiCount) + ")";
int16_t poiTextWidth = poiText.length() * 12; // 12px per char at size 2
display_obj.tft.setCursor((240 - poiTextWidth) / 2, 287);
display_obj.tft.print(poiText);

#endif
#endif
}
Expand All @@ -5050,6 +5142,7 @@ void WiFiScan::RunBeaconScan(uint8_t scan_mode, uint16_t color) {
startLog(F("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);
this->openPoiFile();
} else {
return;
}
Expand Down
11 changes: 11 additions & 0 deletions esp32_marauder/WiFiScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,14 @@ class WiFiScan
bool mac_cmp(struct mac_addr addr1, struct mac_addr addr2);
bool mac_cmp(uint8_t addr1[6], uint8_t addr2[6]);
void clearMacHistory();
// POI tagging during wardrive
File poiFile;
bool poiFileOpen = false;
String poiFileName = "";

void openPoiFile();
void closePoiFile();

void executeWarDrive();
void executeSourApple();
void executeSpoofAirtag();
Expand Down Expand Up @@ -867,6 +875,9 @@ class WiFiScan
void setBaseMacAddress(uint8_t macAddr[6]);
//const char* generateRandomName();

uint16_t poiCount = 0;
void tagPOI(const char* label = nullptr);

bool save_serial = false;
void startPcap(String file_name);
void startLog(String file_name);
Expand Down
Loading