Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying an bssid for the ssid list. #560

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion esp32_marauder/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion esp32_marauder/CommandLine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <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_A[] = "ssid -a [-g <count>/-n <name>/-s <bssid>]";
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";
Expand Down
8 changes: 6 additions & 2 deletions esp32_marauder/WiFiScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion esp32_marauder/WiFiScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading