Skip to content

Commit

Permalink
Add commands for save and load
Browse files Browse the repository at this point in the history
  • Loading branch information
justcallmekoko committed Apr 25, 2024
1 parent b3810ad commit 59c6f55
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 6 deletions.
37 changes: 37 additions & 0 deletions esp32_marauder/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 4 additions & 0 deletions esp32_marauder/CommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 <index (comma separated)>/-f \"equals <String> or contains <String>\"";
const char PROGMEM HELP_SSID_CMD_A[] = "ssid -a [-g <count>/-n <name>]";
const char PROGMEM HELP_SSID_CMD_B[] = "ssid -r <index>";
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";
Expand Down
12 changes: 6 additions & 6 deletions esp32_marauder/MenuFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions esp32_marauder/WiFiScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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());
}
}

Expand Down Expand Up @@ -1096,6 +1100,9 @@ void WiFiScan::RunLoadSSIDList() {
#endif

log_file.close();

Serial.print("Loaded SSIDs: ");
Serial.println((String)ssids->size());
#endif
}

Expand All @@ -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());
}
}

Expand Down

0 comments on commit 59c6f55

Please sign in to comment.