From 59c6f5596f3c9518695f171e89671ec0fae20327 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Thu, 25 Apr 2024 10:04:36 -0400 Subject: [PATCH] Add commands for save and load --- esp32_marauder/CommandLine.cpp | 37 ++++++++++++++++++++++++++++++++++ esp32_marauder/CommandLine.h | 4 ++++ esp32_marauder/MenuFunctions.h | 12 +++++------ esp32_marauder/WiFiScan.cpp | 9 +++++++++ 4 files changed, 56 insertions(+), 6 deletions(-) diff --git a/esp32_marauder/CommandLine.cpp b/esp32_marauder/CommandLine.cpp index d9337d845..74355e5d8 100644 --- a/esp32_marauder/CommandLine.cpp +++ b/esp32_marauder/CommandLine.cpp @@ -245,6 +245,8 @@ void CommandLine::runCommand(String input) { Serial.println(HELP_SEL_CMD_A); Serial.println(HELP_SSID_CMD_A); Serial.println(HELP_SSID_CMD_B); + Serial.println(HELP_SAVE_CMD); + Serial.println(HELP_LOAD_CMD); // Bluetooth sniff/scan #ifdef HAS_BT @@ -1262,6 +1264,41 @@ void CommandLine::runCommand(String input) { return; } } + else if (cmd_args.get(0) == SAVE_CMD) { + int ap_sw = this->argSearch(&cmd_args, "-a"); + int st_sw = this->argSearch(&cmd_args, "-s"); + + if (ap_sw != -1) { + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.saveAPsMenu); + #endif + wifi_scan_obj.RunSaveAPList(true); + } + else if (st_sw != -1) { + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.saveSSIDsMenu); + #endif + wifi_scan_obj.RunSaveSSIDList(true); + } + } + else if (cmd_args.get(0) == LOAD_CMD) { + int ap_sw = this->argSearch(&cmd_args, "-a"); + int st_sw = this->argSearch(&cmd_args, "-s"); + + if (ap_sw != -1) { + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.loadAPsMenu); + #endif + wifi_scan_obj.RunLoadAPList(); + } + else if (st_sw != -1) { + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.loadSSIDsMenu); + #endif + wifi_scan_obj.RunLoadSSIDList(); + } + } + // SSID stuff else if (cmd_args.get(0) == SSID_CMD) { int add_sw = this->argSearch(&cmd_args, "-a"); diff --git a/esp32_marauder/CommandLine.h b/esp32_marauder/CommandLine.h index a17ab8202..c6be7e0fe 100644 --- a/esp32_marauder/CommandLine.h +++ b/esp32_marauder/CommandLine.h @@ -77,6 +77,8 @@ const char PROGMEM ATTACK_TYPE_RR[] = "rickroll"; const char PROGMEM LIST_AP_CMD[] = "list"; const char PROGMEM SEL_CMD[] = "select"; const char PROGMEM SSID_CMD[] = "ssid"; +const char PROGMEM SAVE_CMD[] = "save"; +const char PROGMEM LOAD_CMD[] = "load"; // Bluetooth sniff/scan const char PROGMEM BT_SPAM_CMD[] = "blespam"; @@ -128,6 +130,8 @@ const char PROGMEM HELP_LIST_AP_CMD_C[] = "list -c"; const char PROGMEM HELP_SEL_CMD_A[] = "select -a/-s/-c /-f \"equals or contains \""; const char PROGMEM HELP_SSID_CMD_A[] = "ssid -a [-g /-n ]"; 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"; // Bluetooth sniff/scan const char PROGMEM HELP_BT_SNIFF_CMD[] = "sniffbt"; diff --git a/esp32_marauder/MenuFunctions.h b/esp32_marauder/MenuFunctions.h index 33da7f00a..0f225d929 100644 --- a/esp32_marauder/MenuFunctions.h +++ b/esp32_marauder/MenuFunctions.h @@ -154,12 +154,6 @@ class MenuFunctions Menu miniKbMenu; Menu saveFileMenu; - // Save Files Menu - Menu saveSSIDsMenu; - Menu loadSSIDsMenu; - Menu saveAPsMenu; - Menu loadAPsMenu; - // Bluetooth menu stuff Menu bluetoothSnifferMenu; Menu bluetoothAttackMenu; @@ -194,6 +188,12 @@ class MenuFunctions Menu* current_menu; Menu clearSSIDsMenu; Menu clearAPsMenu; + + // Save Files Menu + Menu saveSSIDsMenu; + Menu loadSSIDsMenu; + Menu saveAPsMenu; + Menu loadAPsMenu; #ifdef HAS_GPS // GPS Menu diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index cf9d9f913..f1d0eb3dc 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -1019,6 +1019,8 @@ void WiFiScan::RunLoadAPList() { display_obj.tft.print("Loaded APs: "); display_obj.tft.println((String)access_points->size()); #endif + Serial.print("Loaded APs:"); + Serial.println((String)access_points->size()); #endif } @@ -1060,6 +1062,8 @@ void WiFiScan::RunSaveAPList(bool save_as) { display_obj.tft.print("Saved APs: "); display_obj.tft.println((String)access_points->size()); #endif + Serial.print("Saved APs:"); + Serial.println((String)access_points->size()); } } @@ -1096,6 +1100,9 @@ void WiFiScan::RunLoadSSIDList() { #endif log_file.close(); + + Serial.print("Loaded SSIDs: "); + Serial.println((String)ssids->size()); #endif } @@ -1122,6 +1129,8 @@ void WiFiScan::RunSaveSSIDList(bool save_as) { display_obj.tft.print("Saved SSIDs: "); display_obj.tft.println((String)ssids->size()); #endif + Serial.print("Saved SSIDs: "); + Serial.println((String)ssids->size()); } }