diff --git a/esp32_marauder/CommandLine.cpp b/esp32_marauder/CommandLine.cpp index 74355e5d8..92c354f5d 100644 --- a/esp32_marauder/CommandLine.cpp +++ b/esp32_marauder/CommandLine.cpp @@ -1305,9 +1305,15 @@ void CommandLine::runCommand(String input) { int gen_sw = this->argSearch(&cmd_args, "-g"); int spc_sw = this->argSearch(&cmd_args, "-n"); int rem_sw = this->argSearch(&cmd_args, "-r"); + int bsi_sw = this->argSearch(&cmd_args, "-s"); // Add ssid if (add_sw != -1) { + // Parse bssid (blank will make random) + String bssid = ""; + if (bsi_sw != -1) + bssid = cmd_args.get(bsi_sw + 1); + // Generate random if (gen_sw != -1) { int gen_count = cmd_args.get(gen_sw + 1).toInt(); @@ -1316,7 +1322,7 @@ void CommandLine::runCommand(String input) { // Add specific else if (spc_sw != -1) { String essid = cmd_args.get(spc_sw + 1); - wifi_scan_obj.addSSID(essid); + wifi_scan_obj.addSSID(essid, bssid); } else { Serial.println("You did not specify how to add SSIDs"); diff --git a/esp32_marauder/CommandLine.h b/esp32_marauder/CommandLine.h index c6be7e0fe..d2526e26f 100644 --- a/esp32_marauder/CommandLine.h +++ b/esp32_marauder/CommandLine.h @@ -128,7 +128,7 @@ const char PROGMEM HELP_LIST_AP_CMD_A[] = "list -s"; const char PROGMEM HELP_LIST_AP_CMD_B[] = "list -a"; 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_A[] = "ssid -a [-g /-n /-s ]"; 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"; diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index 148ccf73e..3f386ea24 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -399,8 +399,12 @@ int WiFiScan::clearSSIDs() { return num_cleared; } -bool WiFiScan::addSSID(String essid) { - ssid s = {essid, random(1, 12), {random(256), random(256), random(256), random(256), random(256), random(256)}, false}; +bool WiFiScan::addSSID(String essid, String bssid_str) { + uint8_t bssid[6] = {random(256), random(256), random(256), random(256), random(256), random(256)}; + if(bssid_str.length() > 0) + parseBSSID(bssid_str.c_str(), bssid); + + ssid s = {essid, random(1, 12), {bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]}, false}; ssids->add(s); Serial.println(ssids->get(ssids->size() - 1).essid); diff --git a/esp32_marauder/WiFiScan.h b/esp32_marauder/WiFiScan.h index 5b5ec6074..860dda570 100644 --- a/esp32_marauder/WiFiScan.h +++ b/esp32_marauder/WiFiScan.h @@ -369,7 +369,7 @@ class WiFiScan int clearSSIDs(); int clearAPs(); int clearStations(); - bool addSSID(String essid); + bool addSSID(String essid, String bssid_str = ""); int generateSSIDs(int count = 20); bool shutdownWiFi(); bool shutdownBLE();