diff --git a/esp32_marauder/CommandLine.cpp b/esp32_marauder/CommandLine.cpp index f63690d74..fdf406a4e 100644 --- a/esp32_marauder/CommandLine.cpp +++ b/esp32_marauder/CommandLine.cpp @@ -15,7 +15,7 @@ void CommandLine::RunSetup() { Serial.println(" " + version_number + "\n"); Serial.println(F(" By: justcallmekoko\n")); Serial.println(F("--------------------------------\n\n")); - + Serial.print("> "); } @@ -29,6 +29,7 @@ String CommandLine::getSerialInput() { if (Serial.available() > 0 && serial_buffer_idx < 255) { bytes_available = Serial.available(); + //Serial.println("Should have bytes available: " + bytes_available); int bytes_to_read = bytes_available < (254 - serial_buffer_idx) ? bytes_available : (254 - serial_buffer_idx); bytes_received = Serial.readBytes(&serial_buffer[serial_buffer_idx], bytes_to_read); @@ -79,6 +80,10 @@ String CommandLine::getSerialInput() { int index_of_newline = -1; for (int i = 0; i < serial_buffer_idx; i++) { +// Serial.println("Checking character at: " + String(i) + " it appears to be: " + String(serial_buffer[i])); +// Serial.print("Hex value of character: "); +// Serial.print(serial_buffer[i], HEX); +// Serial.println(); // This is mind boggling that we sometimes // just get \r and not \n and also not \r\n ... @@ -195,7 +200,7 @@ int CommandLine::argSearch(LinkedList* cmd_args_list, String key) { bool CommandLine::checkValueExists(LinkedList* cmd_args_list, int index) { if (index < cmd_args_list->size() - 1) return true; - + return false; } @@ -224,10 +229,10 @@ bool CommandLine::hasSSIDs() { void CommandLine::showCounts(int selected, int unselected) { Serial.print((String) selected + " selected"); - - if (unselected != -1) + + if (unselected != -1) Serial.print(", " + (String) unselected + " unselected"); - + Serial.println(""); } @@ -304,14 +309,14 @@ void CommandLine::filterAccessPoints(String filter) { void CommandLine::runCommand(String input) { if (input == "") return; - if (wifi_scan_obj.scanning() && wifi_scan_obj.currentScanMode == WIFI_SCAN_GPS_NMEA) { - if (input != STOPSCAN_CMD) return; + if(wifi_scan_obj.scanning() && wifi_scan_obj.currentScanMode == WIFI_SCAN_GPS_NMEA){ + if(input != STOPSCAN_CMD) return; } else - Serial.println("\r# " + input); + Serial.println("# " + input); LinkedList cmd_args = this->parseCommand(input, " "); - + //// Admin commands // Help if (cmd_args.get(0) == HELP_CMD) { @@ -326,7 +331,7 @@ void CommandLine::runCommand(String input) { Serial.println(HELP_GPS_DATA_CMD); Serial.println(HELP_GPS_CMD); Serial.println(HELP_NMEA_CMD); - + // WiFi sniff/scan Serial.println(HELP_EVIL_PORTAL_CMD); Serial.println(HELP_SIGSTREN_CMD); @@ -340,13 +345,13 @@ void CommandLine::runCommand(String input) { Serial.println(HELP_SNIFF_DEAUTH_CMD); Serial.println(HELP_SNIFF_PMKID_CMD); Serial.println(HELP_STOPSCAN_CMD); -#ifdef HAS_GPS - Serial.println(HELP_WARDRIVE_CMD); -#endif - + #ifdef HAS_GPS + Serial.println(HELP_WARDRIVE_CMD); + #endif + // WiFi attack Serial.println(HELP_ATTACK_CMD); - + // WiFi Aux Serial.println(HELP_LIST_AP_CMD_A); Serial.println(HELP_LIST_AP_CMD_B); @@ -357,20 +362,20 @@ void CommandLine::runCommand(String input) { Serial.println(HELP_SSID_CMD_B); Serial.println(HELP_SAVE_CMD); Serial.println(HELP_LOAD_CMD); - + // Bluetooth sniff/scan -#ifdef HAS_BT - Serial.println(HELP_BT_SNIFF_CMD); - Serial.println(HELP_BT_SPAM_CMD); - Serial.println(HELP_BT_SPOOFAT_CMD); - //Serial.println(HELP_BT_SWIFTPAIR_SPAM_CMD); - //Serial.println(HELP_BT_SAMSUNG_SPAM_CMD); - //Serial.println(HELP_BT_SPAM_ALL_CMD); -#ifdef HAS_GPS - Serial.println(HELP_BT_WARDRIVE_CMD); -#endif - Serial.println(HELP_BT_SKIM_CMD); -#endif + #ifdef HAS_BT + Serial.println(HELP_BT_SNIFF_CMD); + Serial.println(HELP_BT_SPAM_CMD); + Serial.println(HELP_BT_SPOOFAT_CMD); + //Serial.println(HELP_BT_SWIFTPAIR_SPAM_CMD); + //Serial.println(HELP_BT_SAMSUNG_SPAM_CMD); + //Serial.println(HELP_BT_SPAM_ALL_CMD); + #ifdef HAS_GPS + Serial.println(HELP_BT_WARDRIVE_CMD); + #endif + Serial.println(HELP_BT_SKIM_CMD); + #endif Serial.println(HELP_FOOT); return; } @@ -379,168 +384,168 @@ void CommandLine::runCommand(String input) { if (cmd_args.get(0) == STOPSCAN_CMD) { //if (wifi_scan_obj.currentScanMode == OTA_UPDATE) { // wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF; - //#ifdef HAS_SCREEN - // menu_function_obj.changeMenu(menu_function_obj.updateMenu.parentMenu); - //#endif + //#ifdef HAS_SCREEN + // menu_function_obj.changeMenu(menu_function_obj.updateMenu.parentMenu); + //#endif // WiFi.softAPdisconnect(true); // web_obj.shutdownServer(); // return; //} - - uint8_t old_scan_mode = wifi_scan_obj.currentScanMode; + + uint8_t old_scan_mode=wifi_scan_obj.currentScanMode; wifi_scan_obj.StartScan(WIFI_SCAN_OFF); - if (old_scan_mode == WIFI_SCAN_GPS_NMEA) + if(old_scan_mode == WIFI_SCAN_GPS_NMEA) Serial.println("END OF NMEA STREAM"); - else if (old_scan_mode == WIFI_SCAN_GPS_DATA) + else if(old_scan_mode == WIFI_SCAN_GPS_DATA) Serial.println("Stopping GPS data updates"); else Serial.println("Stopping WiFi tran/recv"); // If we don't do this, the text and button coordinates will be off -#ifdef HAS_SCREEN - display_obj.tft.init(); - menu_function_obj.changeMenu(menu_function_obj.current_menu); -#endif + #ifdef HAS_SCREEN + display_obj.tft.init(); + menu_function_obj.changeMenu(menu_function_obj.current_menu); + #endif } else if (cmd_args.get(0) == GPS_DATA_CMD) { -#ifdef HAS_GPS - if (gps_obj.getGpsModuleStatus()) { - Serial.println("Getting GPS Data. Stop with " + (String)STOPSCAN_CMD); - wifi_scan_obj.currentScanMode = WIFI_SCAN_GPS_DATA; -#ifdef HAS_SCREEN - menu_function_obj.changeMenu(&menu_function_obj.gpsInfoMenu); -#endif - wifi_scan_obj.StartScan(WIFI_SCAN_GPS_DATA, TFT_CYAN); - } -#endif + #ifdef HAS_GPS + if (gps_obj.getGpsModuleStatus()) { + Serial.println("Getting GPS Data. Stop with " + (String)STOPSCAN_CMD); + wifi_scan_obj.currentScanMode = WIFI_SCAN_GPS_DATA; + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.gpsInfoMenu); + #endif + wifi_scan_obj.StartScan(WIFI_SCAN_GPS_DATA, TFT_CYAN); + } + #endif } else if (cmd_args.get(0) == GPS_CMD) { -#ifdef HAS_GPS - if (gps_obj.getGpsModuleStatus()) { - int get_arg = this->argSearch(&cmd_args, "-g"); - int nmea_arg = this->argSearch(&cmd_args, "-n"); - - 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 == "accuracy") - Serial.println("Accuracy: " + (String)gps_obj.getAccuracy()); - else if (gps_info == "date") - Serial.println("Date/Time: " + gps_obj.getDatetime()); - else if (gps_info == "text") { - Serial.println(gps_obj.getText()); - } - else if (gps_info == "nmea") { - int notparsed_arg = this->argSearch(&cmd_args, "-p"); - int notimp_arg = this->argSearch(&cmd_args, "-i"); - int recd_arg = this->argSearch(&cmd_args, "-r"); - if (notparsed_arg == -1 && notimp_arg == -1 && recd_arg == -1) { - gps_obj.sendSentence(Serial, gps_obj.generateGXgga().c_str()); - gps_obj.sendSentence(Serial, gps_obj.generateGXrmc().c_str()); + #ifdef HAS_GPS + if (gps_obj.getGpsModuleStatus()) { + int get_arg = this->argSearch(&cmd_args, "-g"); + int nmea_arg = this->argSearch(&cmd_args, "-n"); + + 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 == "accuracy") + Serial.println("Accuracy: " + (String)gps_obj.getAccuracy()); + else if (gps_info == "date") + Serial.println("Date/Time: " + gps_obj.getDatetime()); + else if (gps_info == "text"){ + Serial.println(gps_obj.getText()); + } + else if (gps_info == "nmea"){ + int notparsed_arg = this->argSearch(&cmd_args, "-p"); + int notimp_arg = this->argSearch(&cmd_args, "-i"); + int recd_arg = this->argSearch(&cmd_args, "-r"); + if(notparsed_arg == -1 && notimp_arg == -1 && recd_arg == -1){ + gps_obj.sendSentence(Serial, gps_obj.generateGXgga().c_str()); + gps_obj.sendSentence(Serial, gps_obj.generateGXrmc().c_str()); + } + else if(notparsed_arg == -1 && notimp_arg == -1) + Serial.println(gps_obj.getNmea()); + else if(notparsed_arg == -1) + Serial.println(gps_obj.getNmeaNotimp()); + else + Serial.println(gps_obj.getNmeaNotparsed()); } - else if (notparsed_arg == -1 && notimp_arg == -1) - Serial.println(gps_obj.getNmea()); - else if (notparsed_arg == -1) - Serial.println(gps_obj.getNmeaNotimp()); else - Serial.println(gps_obj.getNmeaNotparsed()); + Serial.println("You did not provide a valid argument"); } - else - Serial.println("You did not provide a valid argument"); - } - else if (nmea_arg != -1) { - String nmea_type = cmd_args.get(nmea_arg + 1); - - if (nmea_type == "native" || nmea_type == "all" || nmea_type == "gps" || nmea_type == "glonass" - || nmea_type == "galileo" || nmea_type == "navic" || nmea_type == "qzss" || nmea_type == "beidou") { - if (nmea_type == "beidou") { - int beidou_bd_arg = this->argSearch(&cmd_args, "-b"); - if (beidou_bd_arg != -1) - nmea_type = "beidou_bd"; + else if(nmea_arg != -1){ + String nmea_type = cmd_args.get(nmea_arg + 1); + + if (nmea_type == "native" || nmea_type == "all" || nmea_type == "gps" || nmea_type == "glonass" + || nmea_type == "galileo" || nmea_type == "navic" || nmea_type == "qzss" || nmea_type == "beidou"){ + if(nmea_type == "beidou"){ + int beidou_bd_arg = this->argSearch(&cmd_args, "-b"); + if(beidou_bd_arg != -1) + nmea_type="beidou_bd"; + } + gps_obj.setType(nmea_type); + Serial.println("GPS Output Type Set To: " + nmea_type); } - gps_obj.setType(nmea_type); - Serial.println("GPS Output Type Set To: " + nmea_type); + else + Serial.println("You did not provide a valid argument"); } + else if(cmd_args.size()>1) + Serial.println("You did not provide a valid flag"); else - Serial.println("You did not provide a valid argument"); + Serial.println("You did not provide an argument"); } - else if (cmd_args.size() > 1) - Serial.println("You did not provide a valid flag"); - else - Serial.println("You did not provide an argument"); - } -#endif + #endif } else if (cmd_args.get(0) == NMEA_CMD) { -#ifdef HAS_GPS - if (gps_obj.getGpsModuleStatus()) { -#ifdef HAS_SCREEN - menu_function_obj.changeMenu(&menu_function_obj.gpsInfoMenu); -#endif - Serial.println("NMEA STREAM FOLLOWS"); - wifi_scan_obj.currentScanMode = WIFI_SCAN_GPS_NMEA; - wifi_scan_obj.StartScan(WIFI_SCAN_GPS_NMEA, TFT_CYAN); - } -#endif + #ifdef HAS_GPS + if (gps_obj.getGpsModuleStatus()) { + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.gpsInfoMenu); + #endif + Serial.println("NMEA STREAM FOLLOWS"); + wifi_scan_obj.currentScanMode = WIFI_SCAN_GPS_NMEA; + wifi_scan_obj.StartScan(WIFI_SCAN_GPS_NMEA, TFT_CYAN); + } + #endif } // LED command else if (cmd_args.get(0) == LED_CMD) { int hex_arg = this->argSearch(&cmd_args, "-s"); int pat_arg = this->argSearch(&cmd_args, "-p"); -#ifdef PIN - if (hex_arg != -1) { - String hexstring = cmd_args.get(hex_arg + 1); - int number = (int)strtol(&hexstring[1], NULL, 16); - int r = number >> 16; - int g = number >> 8 & 0xFF; - int b = number & 0xFF; - //Serial.println(r); - //Serial.println(g); - //Serial.println(b); - led_obj.setColor(r, g, b); - led_obj.setMode(MODE_CUSTOM); - } - else if (pat_arg != -1) { - String pat_name = cmd_args.get(pat_arg + 1); - pat_name.toLowerCase(); - if (pat_name == "rainbow") { - led_obj.setMode(MODE_RAINBOW); + #ifdef PIN + if (hex_arg != -1) { + String hexstring = cmd_args.get(hex_arg + 1); + int number = (int)strtol(&hexstring[1], NULL, 16); + int r = number >> 16; + int g = number >> 8 & 0xFF; + int b = number & 0xFF; + //Serial.println(r); + //Serial.println(g); + //Serial.println(b); + led_obj.setColor(r, g, b); + led_obj.setMode(MODE_CUSTOM); } - } -#else - Serial.println("This hardware does not support neopixel"); -#endif + else if (pat_arg != -1) { + String pat_name = cmd_args.get(pat_arg + 1); + pat_name.toLowerCase(); + if (pat_name == "rainbow") { + led_obj.setMode(MODE_RAINBOW); + } + } + #else + Serial.println("This hardware does not support neopixel"); + #endif } // ls command else if (cmd_args.get(0) == LS_CMD) { -#ifdef HAS_SD - if (cmd_args.size() > 1) - sd_obj.listDir(cmd_args.get(1)); - else - Serial.println("You did not provide a dir to list"); -#else - Serial.println("SD support disabled, cannot use command"); - return; -#endif + #ifdef HAS_SD + if (cmd_args.size() > 1) + sd_obj.listDir(cmd_args.get(1)); + else + Serial.println("You did not provide a dir to list"); + #else + Serial.println("SD support disabled, cannot use command"); + return; + #endif } // Channel command else if (cmd_args.get(0) == CH_CMD) { // Search for channel set arg int ch_set = this->argSearch(&cmd_args, "-s"); - + if (cmd_args.size() == 1) { Serial.println("Current channel: " + (String)wifi_scan_obj.set_channel); } @@ -557,23 +562,23 @@ void CommandLine::runCommand(String input) { int cl_sw = this->argSearch(&cmd_args, "-c"); // Stations if (ap_sw != -1) { -#ifdef HAS_SCREEN - menu_function_obj.changeMenu(&menu_function_obj.clearAPsMenu); -#endif + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.clearAPsMenu); + #endif wifi_scan_obj.RunClearAPs(); } if (ss_sw != -1) { -#ifdef HAS_SCREEN - menu_function_obj.changeMenu(&menu_function_obj.clearSSIDsMenu); -#endif + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.clearSSIDsMenu); + #endif wifi_scan_obj.RunClearSSIDs(); } if (cl_sw != -1) { -#ifdef HAS_SCREEN - menu_function_obj.changeMenu(&menu_function_obj.clearAPsMenu); -#endif + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.clearAPsMenu); + #endif wifi_scan_obj.RunClearStations(); } } @@ -624,40 +629,39 @@ void CommandLine::runCommand(String input) { // Signal strength scan if (cmd_args.get(0) == SIGSTREN_CMD) { Serial.println("Starting Signal Strength Scan. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_SCAN_SIG_STREN, TFT_MAGENTA); } // Wardrive else if (cmd_args.get(0) == WARDRIVE_CMD) { -#ifdef HAS_GPS - if (gps_obj.getGpsModuleStatus()) { - int sta_sw = this->argSearch(&cmd_args, "-s"); - - if (sta_sw == -1) { - 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); - } - else { - Serial.println("Starting Station Wardrive. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(WIFI_SCAN_STATION_WAR_DRIVE, TFT_GREEN); + #ifdef HAS_GPS + if (gps_obj.getGpsModuleStatus()) { + int sta_sw = this->argSearch(&cmd_args, "-s"); + + if (sta_sw == -1) { + 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); + } + else {Serial.println("Starting Station Wardrive. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(WIFI_SCAN_STATION_WAR_DRIVE, TFT_GREEN); + } } - } - else - Serial.println("GPS Module not detected"); -#else - Serial.println("GPS not supported"); -#endif + else + Serial.println("GPS Module not detected"); + #else + Serial.println("GPS not supported"); + #endif } // AP Scan else if (cmd_args.get(0) == EVIL_PORTAL_CMD) { @@ -668,10 +672,10 @@ void CommandLine::runCommand(String input) { String et_command = cmd_args.get(cmd_sw + 1); if (et_command == "start") { Serial.println("Starting Evil Portal. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif if (html_sw != -1) { String target_html_name = cmd_args.get(html_sw + 1); evil_portal_obj.target_html_name = target_html_name; @@ -684,10 +688,10 @@ void CommandLine::runCommand(String input) { wifi_scan_obj.StartScan(WIFI_SCAN_EVIL_PORTAL, TFT_MAGENTA); } else if (et_command == "reset") { - + } else if (et_command == "ack") { - + } else if (et_command == "sethtml") { String target_html_name = cmd_args.get(cmd_sw + 2); @@ -705,10 +709,10 @@ void CommandLine::runCommand(String input) { } else if (cmd_args.get(0) == SCANAP_CMD) { int full_sw = -1; -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif if (full_sw == -1) { Serial.println("Starting AP scan. Stop with " + (String)STOPSCAN_CMD); @@ -722,67 +726,67 @@ void CommandLine::runCommand(String input) { // Raw sniff else if (cmd_args.get(0) == SNIFF_RAW_CMD) { Serial.println("Starting Raw sniff. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_SCAN_RAW_CAPTURE, TFT_WHITE); } // Scan stations - else if (cmd_args.get(0) == SCANSTA_CMD) { - if (access_points->size() < 1) - Serial.println("The AP list is empty. Scan APs first with " + (String)SCANAP_CMD); - - Serial.println("Starting Station scan. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + else if (cmd_args.get(0) == SCANSTA_CMD) { + if(access_points->size() < 1) + Serial.println("The AP list is empty. Scan APs first with " + (String)SCANAP_CMD); + + Serial.println("Starting Station scan. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_SCAN_STATION, TFT_ORANGE); } // Beacon sniff else if (cmd_args.get(0) == SNIFF_BEACON_CMD) { Serial.println("Starting Beacon sniff. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA); } // Probe sniff else if (cmd_args.get(0) == SNIFF_PROBE_CMD) { Serial.println("Starting Probe sniff. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_SCAN_PROBE, TFT_MAGENTA); } // Deauth sniff else if (cmd_args.get(0) == SNIFF_DEAUTH_CMD) { Serial.println("Starting Deauth sniff. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_SCAN_DEAUTH, TFT_RED); } // Pwn sniff else if (cmd_args.get(0) == SNIFF_PWN_CMD) { Serial.println("Starting Pwnagotchi sniff. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_SCAN_PWN, TFT_MAGENTA); } // Espressif sniff else if (cmd_args.get(0) == SNIFF_ESP_CMD) { Serial.println("Starting Espressif device sniff. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_SCAN_ESPRESSIF, TFT_MAGENTA); } // PMKID sniff @@ -797,12 +801,12 @@ void CommandLine::runCommand(String input) { return; } } - + if (ch_sw != -1) { wifi_scan_obj.set_channel = cmd_args.get(ch_sw + 1).toInt(); wifi_scan_obj.changeChannel(); Serial.println("Set channel: " + (String)wifi_scan_obj.set_channel); - + } if (d_sw == -1) { @@ -817,7 +821,7 @@ void CommandLine::runCommand(String input) { Serial.println("Starting PMKID sniff with deauthentication on channel " + (String)wifi_scan_obj.set_channel + ". Stop with " + (String)STOPSCAN_CMD); wifi_scan_obj.StartScan(WIFI_SCAN_ACTIVE_EAPOL, TFT_VIOLET); } - } + } //// WiFi attack commands // attack @@ -829,14 +833,14 @@ void CommandLine::runCommand(String input) { int src_addr_sw = this->argSearch(&cmd_args, "-s"); int dst_addr_sw = this->argSearch(&cmd_args, "-d"); int targ_sw = this->argSearch(&cmd_args, "-c"); - + if (attack_type_switch == -1) { Serial.println("You must specify an attack type"); return; } else { String attack_type = cmd_args.get(attack_type_switch + 1); - + // Branch on attack type // Deauth if (attack_type == ATTACK_TYPE_DEAUTH) { @@ -860,10 +864,10 @@ void CommandLine::runCommand(String input) { Serial.println("You don't have any targets selected. Use " + (String)SEL_CMD); return; } -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif Serial.println("Starting Deauthentication attack. Stop with " + (String)STOPSCAN_CMD); // Station list not specified if (targ_sw == -1) @@ -875,15 +879,15 @@ void CommandLine::runCommand(String input) { // Source addr specified else { String src_mac_str = cmd_args.get(src_addr_sw + 1); - sscanf(src_mac_str.c_str(), "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", - &wifi_scan_obj.src_mac[0], &wifi_scan_obj.src_mac[1], &wifi_scan_obj.src_mac[2], &wifi_scan_obj.src_mac[3], &wifi_scan_obj.src_mac[4], &wifi_scan_obj.src_mac[5]); + sscanf(src_mac_str.c_str(), "%2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", + &wifi_scan_obj.src_mac[0], &wifi_scan_obj.src_mac[1], &wifi_scan_obj.src_mac[2], &wifi_scan_obj.src_mac[3], &wifi_scan_obj.src_mac[4], &wifi_scan_obj.src_mac[5]); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif Serial.println("Starting Manual Deauthentication attack. Stop with " + (String)STOPSCAN_CMD); - wifi_scan_obj.StartScan(WIFI_ATTACK_DEAUTH_MANUAL, TFT_RED); + wifi_scan_obj.StartScan(WIFI_ATTACK_DEAUTH_MANUAL, TFT_RED); } } // Beacon @@ -894,19 +898,19 @@ void CommandLine::runCommand(String input) { Serial.println("You don't have any SSIDs in your list. Use " + (String)SSID_CMD); return; } -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif Serial.println("Starting Beacon list spam. Stop with " + (String)STOPSCAN_CMD); wifi_scan_obj.StartScan(WIFI_ATTACK_BEACON_LIST, TFT_RED); } // spam with random else if (rand_beacon_sw != -1) { -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif Serial.println("Starting random Beacon spam. Stop with " + (String)STOPSCAN_CMD); wifi_scan_obj.StartScan(WIFI_ATTACK_BEACON_SPAM, TFT_ORANGE); } @@ -916,10 +920,10 @@ void CommandLine::runCommand(String input) { Serial.println("You don't have any targets selected. Use " + (String)SEL_CMD); return; } -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif Serial.println("Starting Targeted AP Beacon spam. Stop with " + (String)STOPSCAN_CMD); wifi_scan_obj.StartScan(WIFI_ATTACK_AP_SPAM, TFT_MAGENTA); } @@ -933,18 +937,18 @@ void CommandLine::runCommand(String input) { return; } Serial.println("Starting Probe spam. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_ATTACK_AUTH, TFT_RED); } else if (attack_type == ATTACK_TYPE_RR) { Serial.println("Starting Rick Roll Beacon spam. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif wifi_scan_obj.StartScan(WIFI_ATTACK_RICK_ROLL, TFT_YELLOW); } else { @@ -957,72 +961,72 @@ void CommandLine::runCommand(String input) { //// Bluetooth scan/attack commands // Bluetooth scan if (cmd_args.get(0) == BT_SNIFF_CMD) { -#ifdef HAS_BT - int bt_type_sw = this->argSearch(&cmd_args, "-t"); - - // Specifying type of bluetooth sniff - if (bt_type_sw != -1) { - String bt_type = cmd_args.get(bt_type_sw + 1); - - bt_type.toLowerCase(); - - // Airtag sniff - if (bt_type == "airtag") { - Serial.println("Starting Airtag sniff. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_SCAN_AIRTAG, TFT_WHITE); + #ifdef HAS_BT + int bt_type_sw = this->argSearch(&cmd_args, "-t"); + + // Specifying type of bluetooth sniff + if (bt_type_sw != -1) { + String bt_type = cmd_args.get(bt_type_sw + 1); + + bt_type.toLowerCase(); + + // Airtag sniff + if (bt_type == "airtag") { + Serial.println("Starting Airtag sniff. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_SCAN_AIRTAG, TFT_WHITE); + } + else if (bt_type == "flipper") { + Serial.println("Starting Flipper sniff. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_SCAN_FLIPPER, TFT_ORANGE); + } } - else if (bt_type == "flipper") { - Serial.println("Starting Flipper sniff. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_SCAN_FLIPPER, TFT_ORANGE); + // General bluetooth sniff + else { + Serial.println("Starting Bluetooth scan. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_SCAN_ALL, TFT_GREEN); } - } - // General bluetooth sniff - else { - Serial.println("Starting Bluetooth scan. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_SCAN_ALL, TFT_GREEN); - } -#else - Serial.println("Bluetooth not supported"); -#endif + #else + Serial.println("Bluetooth not supported"); + #endif } else if (cmd_args.get(0) == BT_SPOOFAT_CMD) { int at_sw = this->argSearch(&cmd_args, "-t"); if (at_sw != -1) { -#ifdef HAS_BT - int target_mac = cmd_args.get(at_sw + 1).toInt(); - if (target_mac < airtags->size()) { - for (int i = 0; i < airtags->size(); i++) { - AirTag at = airtags->get(i); - if (i == target_mac) - at.selected = true; - else - at.selected = false; - airtags->set(i, at); + #ifdef HAS_BT + int target_mac = cmd_args.get(at_sw + 1).toInt(); + if (target_mac < airtags->size()) { + for (int i = 0; i < airtags->size(); i++) { + AirTag at = airtags->get(i); + if (i == target_mac) + at.selected = true; + else + at.selected = false; + airtags->set(i, at); + } + Serial.println("Spoofing Airtag: " + airtags->get(target_mac).mac); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_SPOOF_AIRTAG, TFT_WHITE); } - Serial.println("Spoofing Airtag: " + airtags->get(target_mac).mac); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_SPOOF_AIRTAG, TFT_WHITE); - } - else { - Serial.println("Provided index is out of range: " + (String)target_mac); - return; - } -#endif + else { + Serial.println("Provided index is out of range: " + (String)target_mac); + return; + } + #endif } } else if (cmd_args.get(0) == BT_SPAM_CMD) { @@ -1031,76 +1035,76 @@ void CommandLine::runCommand(String input) { String bt_type = cmd_args.get(bt_type_sw + 1); if (bt_type == "apple") { -#ifdef HAS_BT - Serial.println("Starting Sour Apple attack. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_ATTACK_SOUR_APPLE, TFT_GREEN); -#else - Serial.println("Bluetooth not supported"); -#endif + #ifdef HAS_BT + Serial.println("Starting Sour Apple attack. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_ATTACK_SOUR_APPLE, TFT_GREEN); + #else + Serial.println("Bluetooth not supported"); + #endif } else if (bt_type == "windows") { -#ifdef HAS_BT - Serial.println("Starting Swiftpair Spam attack. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_ATTACK_SWIFTPAIR_SPAM, TFT_CYAN); -#else - Serial.println("Bluetooth not supported"); -#endif + #ifdef HAS_BT + Serial.println("Starting Swiftpair Spam attack. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_ATTACK_SWIFTPAIR_SPAM, TFT_CYAN); + #else + Serial.println("Bluetooth not supported"); + #endif } else if (bt_type == "samsung") { -#ifdef HAS_BT - Serial.println("Starting Samsung Spam attack. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_ATTACK_SAMSUNG_SPAM, TFT_CYAN); -#else - Serial.println("Bluetooth not supported"); -#endif + #ifdef HAS_BT + Serial.println("Starting Samsung Spam attack. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_ATTACK_SAMSUNG_SPAM, TFT_CYAN); + #else + Serial.println("Bluetooth not supported"); + #endif } else if (bt_type == "google") { -#ifdef HAS_BT - Serial.println("Starting Google Spam attack. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_ATTACK_GOOGLE_SPAM, TFT_CYAN); -#else - Serial.println("Bluetooth not supported"); -#endif + #ifdef HAS_BT + Serial.println("Starting Google Spam attack. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_ATTACK_GOOGLE_SPAM, TFT_CYAN); + #else + Serial.println("Bluetooth not supported"); + #endif } else if (bt_type == "flipper") { -#ifdef HAS_BT - Serial.println("Starting Flipper Spam attack. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_ATTACK_FLIPPER_SPAM, TFT_ORANGE); -#else - Serial.println("Bluetooth not supported"); -#endif + #ifdef HAS_BT + Serial.println("Starting Flipper Spam attack. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_ATTACK_FLIPPER_SPAM, TFT_ORANGE); + #else + Serial.println("Bluetooth not supported"); + #endif } else if (bt_type == "all") { -#ifdef HAS_BT - Serial.println("Starting BT Spam All attack. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_ATTACK_SPAM_ALL, TFT_MAGENTA); -#else - Serial.println("Bluetooth not supported"); -#endif + #ifdef HAS_BT + Serial.println("Starting BT Spam All attack. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_ATTACK_SPAM_ALL, TFT_MAGENTA); + #else + Serial.println("Bluetooth not supported"); + #endif } else { Serial.println("You did not specify a correct spam type"); @@ -1118,8 +1122,8 @@ void CommandLine::runCommand(String input) { #else Serial.println("Bluetooth not supported"); #endif - } - else if (cmd_args.get(0) == BT_SWIFTPAIR_SPAM_CMD) { + } + else if (cmd_args.get(0) == BT_SWIFTPAIR_SPAM_CMD) { #ifdef HAS_BT Serial.println("Starting Swiftpair Spam attack. Stop with " + (String)STOPSCAN_CMD); #ifdef HAS_SCREEN @@ -1130,8 +1134,8 @@ void CommandLine::runCommand(String input) { #else Serial.println("Bluetooth not supported"); #endif - } - else if (cmd_args.get(0) == BT_SAMSUNG_SPAM_CMD) { + } + else if (cmd_args.get(0) == BT_SAMSUNG_SPAM_CMD) { #ifdef HAS_BT Serial.println("Starting Samsung Spam attack. Stop with " + (String)STOPSCAN_CMD); #ifdef HAS_SCREEN @@ -1142,8 +1146,8 @@ void CommandLine::runCommand(String input) { #else Serial.println("Bluetooth not supported"); #endif - } - else if (cmd_args.get(0) == BT_SPAM_ALL_CMD) { + } + else if (cmd_args.get(0) == BT_SPAM_ALL_CMD) { #ifdef HAS_BT Serial.println("Starting BT Spam All attack. Stop with " + (String)STOPSCAN_CMD); #ifdef HAS_SCREEN @@ -1154,53 +1158,52 @@ void CommandLine::runCommand(String input) { #else Serial.println("Bluetooth not supported"); #endif - }*/ + }*/ // Wardrive else if (cmd_args.get(0) == BT_WARDRIVE_CMD) { -#ifdef HAS_BT -#ifdef HAS_GPS - if (gps_obj.getGpsModuleStatus()) { - int cont_sw = this->argSearch(&cmd_args, "-c"); - - if (cont_sw == -1) { - Serial.println("Starting BT Wardrive. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_SCAN_WAR_DRIVE, TFT_GREEN); - } - else { - Serial.println("Starting Continuous BT Wardrive. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_SCAN_WAR_DRIVE_CONT, TFT_GREEN); - } - } - else - Serial.println("GPS Module not detected"); -#else - Serial.println("GPS not supported"); -#endif -#else - Serial.println("Bluetooth not supported"); -#endif - + #ifdef HAS_BT + #ifdef HAS_GPS + if (gps_obj.getGpsModuleStatus()) { + int cont_sw = this->argSearch(&cmd_args, "-c"); + + if (cont_sw == -1) { + Serial.println("Starting BT Wardrive. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_SCAN_WAR_DRIVE, TFT_GREEN); + } + else {Serial.println("Starting Continuous BT Wardrive. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_SCAN_WAR_DRIVE_CONT, TFT_GREEN); + } + } + else + Serial.println("GPS Module not detected"); + #else + Serial.println("GPS not supported"); + #endif + #else + Serial.println("Bluetooth not supported"); + #endif + } // Bluetooth CC Skimmer scan else if (cmd_args.get(0) == BT_SKIM_CMD) { -#ifdef HAS_BT - Serial.println("Starting Bluetooth CC Skimmer scan. Stop with " + (String)STOPSCAN_CMD); -#ifdef HAS_SCREEN - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); -#endif - wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA); -#else - Serial.println("Bluetooth not supported"); -#endif + #ifdef HAS_BT + Serial.println("Starting Bluetooth CC Skimmer scan. Stop with " + (String)STOPSCAN_CMD); + #ifdef HAS_SCREEN + display_obj.clearScreen(); + menu_function_obj.drawStatusBar(); + #endif + wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA); + #else + Serial.println("Bluetooth not supported"); + #endif } // Update command @@ -1212,24 +1215,24 @@ void CommandLine::runCommand(String input) { //if (w_sw != -1) { // Serial.println("Starting Marauder OTA Update. Stop with " + (String)STOPSCAN_CMD); // wifi_scan_obj.currentScanMode = OTA_UPDATE; - //#ifdef HAS_SCREEN - // menu_function_obj.changeMenu(menu_function_obj.updateMenu); - //#endif + //#ifdef HAS_SCREEN + // menu_function_obj.changeMenu(menu_function_obj.updateMenu); + //#endif // web_obj.setupOTAupdate(); //} // Update via SD if (sd_sw != -1) { -#ifdef HAS_SD - if (!sd_obj.supported) { - Serial.println("SD card is not connected. Cannot perform SD Update"); + #ifdef HAS_SD + if (!sd_obj.supported) { + Serial.println("SD card is not connected. Cannot perform SD Update"); + return; + } + wifi_scan_obj.currentScanMode = OTA_UPDATE; + sd_obj.runUpdate(); + #else + Serial.println("SD card support disabled. Cannot perform SD Update"); return; - } - wifi_scan_obj.currentScanMode = OTA_UPDATE; - sd_obj.runUpdate(); -#else - Serial.println("SD card support disabled. Cannot perform SD Update"); - return; -#endif + #endif } } } @@ -1250,7 +1253,7 @@ void CommandLine::runCommand(String input) { if (access_points->get(i).selected) { Serial.println("[" + (String)i + "][CH:" + (String)access_points->get(i).channel + "] " + access_points->get(i).essid + " " + (String)access_points->get(i).rssi + " (selected)"); count_selected += 1; - } + } else Serial.println("[" + (String)i + "][CH:" + (String)access_points->get(i).channel + "] " + access_points->get(i).essid + " " + (String)access_points->get(i).rssi); } @@ -1262,7 +1265,7 @@ void CommandLine::runCommand(String input) { if (ssids->get(i).selected) { Serial.println("[" + (String)i + "] " + ssids->get(i).essid + " (selected)"); count_selected += 1; - } + } else Serial.println("[" + (String)i + "] " + ssids->get(i).essid); } @@ -1371,7 +1374,7 @@ void CommandLine::runCommand(String input) { } else if (cl_sw != -1) { LinkedList sta_index = this->parseCommand(cmd_args.get(cl_sw + 1), ","); - + // Select all Stations if (cmd_args.get(cl_sw + 1) == "all") { for (int i = 0; i < stations->size(); i++) { @@ -1458,15 +1461,15 @@ void CommandLine::runCommand(String input) { int st_sw = this->argSearch(&cmd_args, "-s"); if (ap_sw != -1) { -#ifdef HAS_SCREEN - menu_function_obj.changeMenu(&menu_function_obj.saveAPsMenu); -#endif + #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 + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.saveSSIDsMenu); + #endif wifi_scan_obj.RunSaveSSIDList(true); } } @@ -1475,15 +1478,15 @@ void CommandLine::runCommand(String input) { int st_sw = this->argSearch(&cmd_args, "-s"); if (ap_sw != -1) { -#ifdef HAS_SCREEN - menu_function_obj.changeMenu(&menu_function_obj.loadAPsMenu); -#endif + #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 + #ifdef HAS_SCREEN + menu_function_obj.changeMenu(&menu_function_obj.loadSSIDsMenu); + #endif wifi_scan_obj.RunLoadSSIDList(); } } @@ -1530,11 +1533,11 @@ void CommandLine::runCommand(String input) { int n_sw = this->argSearch(&cmd_args, "-n"); // name int a_sw = this->argSearch(&cmd_args, "-a"); // access point int s_sw = this->argSearch(&cmd_args, "-s"); // ssid - int p_sw = this->argSearch(&cmd_args, "-p"); - + int p_sw = this->argSearch(&cmd_args, "-p"); + String essid = ""; String pwx = ""; - + if (s_sw != -1) { int index = cmd_args.get(s_sw + 1).toInt(); if (!this->inRange(ssids->size(), index)) { @@ -1555,11 +1558,12 @@ void CommandLine::runCommand(String input) { Serial.println("You must specify an access point or ssid"); return; } - + if (p_sw != -1) { pwx = cmd_args.get(p_sw + 1); } Serial.println("Attempting to join WiFi with ssid " + (String)essid); wifi_scan_obj.joinWiFi(essid, pwx); - }*/ + }*/ } +