diff --git a/esp32_marauder/CommandLine.cpp b/esp32_marauder/CommandLine.cpp index 79afd02..23bea87 100644 --- a/esp32_marauder/CommandLine.cpp +++ b/esp32_marauder/CommandLine.cpp @@ -216,6 +216,7 @@ void CommandLine::runCommand(String input) { Serial.println(HELP_LS_CMD); Serial.println(HELP_LED_CMD); Serial.println(HELP_GPS_DATA_CMD); + Serial.println(HELP_GPS_CMD); // WiFi sniff/scan Serial.println(HELP_EVIL_PORTAL_CMD); @@ -284,6 +285,32 @@ void CommandLine::runCommand(String input) { } #endif } + else if (cmd_args.get(0) == GPS_CMD) { + #ifdef HAS_GPS + if (gps_obj.getGpsModuleStatus()) { + int get_arg = this->argSearch(&cmd_args, "-g"); + + if (get_arg != -1) { + String gps_info = cmd_args.get(get_arg + 1); + + if (gps_info == "fix") + Serial.println("Fix: " + gps_obj.getFixStatusAsString()); + else if (gps_info == "sat") + Serial.println("Sats: " + gps_obj.getNumSatsString()); + else if (gps_info == "lat") + Serial.println("Lat: " + gps_obj.getLat()); + else if (gps_info == "lon") + Serial.println("Lon: " + gps_obj.getLon()); + else if (gps_info == "alt") + Serial.println("Alt: " + (String)gps_obj.getAlt()); + else if (gps_info == "date") + Serial.println("Date/Time: " + gps_obj.getDatetime()); + else + Serial.println("You did not provide a valid argument"); + } + } + #endif + } // LED command else if (cmd_args.get(0) == LED_CMD) { int hex_arg = this->argSearch(&cmd_args, "-s"); @@ -418,12 +445,16 @@ void CommandLine::runCommand(String input) { } // Wardrive else if (cmd_args.get(0) == WARDRIVE_CMD) { - Serial.println("Starting Wardrive. Stop with " + (String)STOPSCAN_CMD); - #ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); + #ifdef HAS_GPS + if (gps_obj.getGpsModuleStatus()) { + Serial.println("Starting Wardrive. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(WIFI_SCAN_WAR_DRIVE, TFT_GREEN); + } #endif - wifi_scan_obj.StartScan(WIFI_SCAN_WAR_DRIVE, TFT_GREEN); } // AP Scan else if (cmd_args.get(0) == EVIL_PORTAL_CMD) { diff --git a/esp32_marauder/CommandLine.h b/esp32_marauder/CommandLine.h index c799fa2..720df7b 100644 --- a/esp32_marauder/CommandLine.h +++ b/esp32_marauder/CommandLine.h @@ -46,6 +46,7 @@ const char PROGMEM SETTINGS_CMD[] = "settings"; const char PROGMEM LS_CMD[] = "ls"; const char PROGMEM LED_CMD[] = "led"; const char PROGMEM GPS_DATA_CMD[] = "gpsdata"; +const char PROGMEM GPS_CMD[] = "gps"; // WiFi sniff/scan const char PROGMEM EVIL_PORTAL_CMD[] = "evilportal"; @@ -90,6 +91,7 @@ const char PROGMEM HELP_SETTINGS_CMD[] = "settings [-s enable/disable> const char PROGMEM HELP_LS_CMD[] = "ls "; const char PROGMEM HELP_LED_CMD[] = "led -s /-p "; const char PROGMEM HELP_GPS_DATA_CMD[] = "gpsdata"; +const char PROGMEM HELP_GPS_CMD[] = "gps [-g] "; // WiFi sniff/scan const char PROGMEM HELP_EVIL_PORTAL_CMD[] = "evilportal [-c start]"; diff --git a/esp32_marauder/GpsInterface.cpp b/esp32_marauder/GpsInterface.cpp index 3d55c82..f73135b 100644 --- a/esp32_marauder/GpsInterface.cpp +++ b/esp32_marauder/GpsInterface.cpp @@ -94,6 +94,13 @@ bool GpsInterface::getFixStatus() { return this->good_fix; } +String GpsInterface::getFixStatusAsString() { + if (this->getFixStatus()) + return "Yes"; + else + return "No"; +} + bool GpsInterface::getGpsModuleStatus() { return this->gps_enabled; } diff --git a/esp32_marauder/GpsInterface.h b/esp32_marauder/GpsInterface.h index 662a006..c996c68 100644 --- a/esp32_marauder/GpsInterface.h +++ b/esp32_marauder/GpsInterface.h @@ -12,6 +12,7 @@ class GpsInterface { String getNumSatsString(); bool getFixStatus(); + String getFixStatusAsString(); bool getGpsModuleStatus(); String getLat(); String getLon();