Merge branch 'coco_develop' into develop

This commit is contained in:
wallali
2023-04-21 14:41:54 +01:00
4 changed files with 3979 additions and 3790 deletions
+10
View File
@@ -382,6 +382,7 @@ jobs:
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
if: github.event_name != 'pull_request'
- name: Upload Flipper Asset
id: upload-flipper-release-asset
@@ -393,6 +394,7 @@ jobs:
asset_path: ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.flipper.bin
asset_name: esp32_marauder.flipper.bin
asset_content_type: application/bin
if: github.event_name != 'pull_request'
- name: Upload Flipper SD Serial Asset
id: upload-flipper-sd-serial-release-asset
@@ -404,6 +406,7 @@ jobs:
asset_path: ./esp32_marauder/build/esp32.esp32.esp32s2/esp32_marauder.flipper_sd_serial.bin
asset_name: esp32_marauder.flipper_sd_serial.bin
asset_content_type: application/bin
if: github.event_name != 'pull_request'
- name: Upload MultiboardS3 Asset
id: upload-mutliboardS3-release-asset
@@ -415,6 +418,7 @@ jobs:
asset_path: ./esp32_marauder/build/esp32.esp32.esp32s3/esp32_marauder.multiboardS3.bin
asset_name: esp32_marauder.mutliboardS3.bin
asset_content_type: application/bin
if: github.event_name != 'pull_request'
- name: Upload OG Asset
id: upload-og-release-asset
@@ -426,6 +430,7 @@ jobs:
asset_path: ./esp32_marauder/build/esp32.esp32.d32/esp32_marauder.og.bin
asset_name: esp32_marauder.og.bin
asset_content_type: application/bin
if: github.event_name != 'pull_request'
- name: Upload v6 Asset
id: upload-v6-release-asset
@@ -437,6 +442,7 @@ jobs:
asset_path: ./esp32_marauder/build/esp32.esp32.d32/esp32_marauder.v6.bin
asset_name: esp32_marauder.v6.bin
asset_content_type: application/bin
if: github.event_name != 'pull_request'
- name: Upload Kit Asset
id: upload-kit-release-asset
@@ -448,6 +454,7 @@ jobs:
asset_path: ./esp32_marauder/build/esp32.esp32.d32/esp32_marauder.kit.bin
asset_name: esp32_marauder.kit.bin
asset_content_type: application/bin
if: github.event_name != 'pull_request'
- name: Upload Mini Asset
id: upload-mini-release-asset
@@ -459,6 +466,7 @@ jobs:
asset_path: ./esp32_marauder/build/esp32.esp32.d32/esp32_marauder.mini.bin
asset_name: esp32_marauder.mini.bin
asset_content_type: application/bin
if: github.event_name != 'pull_request'
- name: Upload ESP32 LDDB Asset
id: upload-esp32-lddb-release-asset
@@ -470,6 +478,7 @@ jobs:
asset_path: ./esp32_marauder/build/esp32.esp32.d32/esp32_marauder.esp32_lddb.bin
asset_name: esp32_marauder.esp32_lddb.bin
asset_content_type: application/bin
if: github.event_name != 'pull_request'
- name: Upload Marauder Dev Board Pro Asset
id: upload-marauder-dev-board-pro-release-asset
@@ -481,3 +490,4 @@ jobs:
asset_path: ./esp32_marauder/build/esp32.esp32.d32/esp32_marauder.marauder_dev_board_pro.bin
asset_name: esp32_marauder.marauder_dev_board_pro.bin
asset_content_type: application/bin
if: github.event_name != 'pull_request'
+227 -56
View File
@@ -41,21 +41,38 @@ LinkedList<String> CommandLine::parseCommand(String input, char* delim) {
LinkedList<String> cmd_args;
bool inQuote = false;
bool inApostrophe = false;
String buffer = "";
for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);
// Do not break parameters that are enclosed in quotes
if (c == '"') {
inQuote = !inQuote;
} else if (!inQuote && strchr(delim, c) != NULL) {
// Check if the quote is within an apostrophe
if (inApostrophe) {
buffer += c;
} else {
inQuote = !inQuote;
}
} else if (c == '\'') {
// Check if the apostrophe is within a quote
if (inQuote) {
buffer += c;
} else {
inApostrophe = !inApostrophe;
}
} else if (!inQuote && !inApostrophe && strchr(delim, c) != NULL) {
cmd_args.add(buffer);
buffer = "";
} else {
buffer += c;
}
}
cmd_args.add(buffer);
// Add the last argument
if (!buffer.isEmpty()) {
cmd_args.add(buffer);
}
return cmd_args;
}
@@ -99,6 +116,85 @@ bool CommandLine::hasSSIDs() {
return true;
}
void CommandLine::showCounts(int selected, int unselected) {
Serial.print((String) selected + " selected");
if (unselected != -1)
Serial.print(", " + (String) unselected + " unselected");
Serial.println("");
}
String CommandLine::toLowerCase(String str) {
String result = str;
for (int i = 0; i < str.length(); i++) {
int charValue = str.charAt(i);
if (charValue >= 65 && charValue <= 90) { // ASCII codes for uppercase letters
charValue += 32;
result.setCharAt(i, char(charValue));
}
}
return result;
}
void CommandLine::filterAccessPoints(String filter) {
int count_selected = 0;
int count_unselected = 0;
// Split the filter string into individual filters
LinkedList<String> filters;
int start = 0;
int end = filter.indexOf(" or ");
while (end != -1) {
filters.add(filter.substring(start, end));
start = end + 4;
end = filter.indexOf(" or ", start);
}
filters.add(filter.substring(start));
// Loop over each access point and check if it matches any of the filters
for (int i = 0; i < access_points->size(); i++) {
bool matchesFilter = false;
for (int j = 0; j < filters.size(); j++) {
String f = toLowerCase(filters.get(j));
if (f.substring(0, 7) == "equals ") {
String ssidEquals = f.substring(7);
if ((ssidEquals.charAt(0) == '\"' && ssidEquals.charAt(ssidEquals.length() - 1) == '\"' && ssidEquals.length() > 1) ||
(ssidEquals.charAt(0) == '\'' && ssidEquals.charAt(ssidEquals.length() - 1) == '\'' && ssidEquals.length() > 1)) {
ssidEquals = ssidEquals.substring(1, ssidEquals.length() - 1);
}
if (access_points->get(i).essid.equalsIgnoreCase(ssidEquals)) {
matchesFilter = true;
break;
}
} else if (f.substring(0, 9) == "contains ") {
String ssidContains = f.substring(9);
if ((ssidContains.charAt(0) == '\"' && ssidContains.charAt(ssidContains.length() - 1) == '\"' && ssidContains.length() > 1) ||
(ssidContains.charAt(0) == '\'' && ssidContains.charAt(ssidContains.length() - 1) == '\'' && ssidContains.length() > 1)) {
ssidContains = ssidContains.substring(1, ssidContains.length() - 1);
}
String essid = toLowerCase(access_points->get(i).essid);
if (essid.indexOf(ssidContains) != -1) {
matchesFilter = true;
break;
}
}
}
// Toggles the selected state of the AP
AccessPoint new_ap = access_points->get(i);
new_ap.selected = matchesFilter;
access_points->set(i, new_ap);
if (matchesFilter) {
count_selected++;
} else {
count_unselected++;
}
}
this->showCounts(count_selected, count_unselected);
}
void CommandLine::runCommand(String input) {
if (input != "")
Serial.println("#" + input);
@@ -140,6 +236,7 @@ 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_JOIN_WIFI_CMD);
// Bluetooth sniff/scan
Serial.println(HELP_BT_SNIFF_CMD);
@@ -281,6 +378,9 @@ void CommandLine::runCommand(String input) {
}
// 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();
@@ -353,7 +453,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
@@ -494,12 +594,12 @@ void CommandLine::runCommand(String input) {
// Bluetooth scan
if (cmd_args.get(0) == BT_SNIFF_CMD) {
#ifdef HAS_BT
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);
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
@@ -507,12 +607,12 @@ void CommandLine::runCommand(String input) {
// 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);
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
@@ -549,6 +649,7 @@ void CommandLine::runCommand(String input) {
}
int count_selected = 0;
//// WiFi aux commands
// List access points
if (cmd_args.get(0) == LIST_AP_CMD) {
@@ -559,20 +660,26 @@ void CommandLine::runCommand(String input) {
// List APs
if (ap_sw != -1) {
for (int i = 0; i < access_points->size(); i++) {
if (access_points->get(i).selected)
if (access_points->get(i).selected) {
Serial.println("[" + (String)i + "] " + access_points->get(i).essid + " " + (String)access_points->get(i).rssi + " (selected)");
count_selected += 1;
}
else
Serial.println("[" + (String)i + "] " + access_points->get(i).essid + " " + (String)access_points->get(i).rssi);
}
this->showCounts(count_selected);
}
// List SSIDs
else if (ss_sw != -1) {
for (int i = 0; i < ssids->size(); i++) {
if (ssids->get(i).selected)
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);
}
this->showCounts(count_selected);
}
// List Stations
else if (cl_sw != -1) {
@@ -585,6 +692,7 @@ void CommandLine::runCommand(String input) {
Serial.print(" [" + (String)access_points->get(x).stations->get(i) + "] ");
Serial.print(sta_mac);
Serial.println(" (selected)");
count_selected += 1;
}
else {
Serial.print(" [" + (String)access_points->get(x).stations->get(i) + "] ");
@@ -592,6 +700,7 @@ void CommandLine::runCommand(String input) {
}
}
}
this->showCounts(count_selected);
}
else {
Serial.println("You did not specify which list to show");
@@ -604,50 +713,66 @@ void CommandLine::runCommand(String input) {
int ap_sw = this->argSearch(&cmd_args, "-a");
int ss_sw = this->argSearch(&cmd_args, "-s");
int cl_sw = this->argSearch(&cmd_args, "-c");
int filter_sw = this->argSearch(&cmd_args, "-f");
count_selected = 0;
int count_unselected = 0;
// select Access points
if (ap_sw != -1) {
// Get list of indices
LinkedList<String> ap_index = this->parseCommand(cmd_args.get(ap_sw + 1), ",");
// Select ALL APs
if (cmd_args.get(ap_sw + 1) == "all") {
for (int i = 0; i < access_points->size(); i++) {
if (access_points->get(i).selected) {
// Unselect "selected" ap
AccessPoint new_ap = access_points->get(i);
new_ap.selected = false;
access_points->set(i, new_ap);
}
else {
// Select "unselected" ap
AccessPoint new_ap = access_points->get(i);
new_ap.selected = true;
access_points->set(i, new_ap);
// If the filters parameter was specified
if (filter_sw != -1) {
String filter_ap = cmd_args.get(filter_sw + 1);
this->filterAccessPoints(filter_ap);
} else {
// Get list of indices
LinkedList<String> ap_index = this->parseCommand(cmd_args.get(ap_sw + 1), ",");
// Select ALL APs
if (cmd_args.get(ap_sw + 1) == "all") {
for (int i = 0; i < access_points->size(); i++) {
if (access_points->get(i).selected) {
// Unselect "selected" ap
AccessPoint new_ap = access_points->get(i);
new_ap.selected = false;
access_points->set(i, new_ap);
count_unselected += 1;
}
else {
// Select "unselected" ap
AccessPoint new_ap = access_points->get(i);
new_ap.selected = true;
access_points->set(i, new_ap);
count_selected += 1;
}
}
this->showCounts(count_selected, count_unselected);
}
}
// Select specific APs
else {
// Mark APs as selected
for (int i = 0; i < ap_index.size(); i++) {
int index = ap_index.get(i).toInt();
if (!this->inRange(access_points->size(), index)) {
Serial.println("Index not in range: " + (String)index);
continue;
}
if (access_points->get(index).selected) {
// Unselect "selected" ap
AccessPoint new_ap = access_points->get(index);
new_ap.selected = false;
access_points->set(index, new_ap);
}
else {
// Select "unselected" ap
AccessPoint new_ap = access_points->get(index);
new_ap.selected = true;
access_points->set(index, new_ap);
// Select specific APs
else {
// Mark APs as selected
for (int i = 0; i < ap_index.size(); i++) {
int index = ap_index.get(i).toInt();
if (!this->inRange(access_points->size(), index)) {
Serial.println("Index not in range: " + (String)index);
continue;
}
if (access_points->get(index).selected) {
// Unselect "selected" ap
AccessPoint new_ap = access_points->get(index);
new_ap.selected = false;
access_points->set(index, new_ap);
count_unselected += 1;
}
else {
// Select "unselected" ap
AccessPoint new_ap = access_points->get(index);
new_ap.selected = true;
access_points->set(index, new_ap);
count_selected += 1;
}
}
this->showCounts(count_selected, count_unselected);
}
}
}
@@ -662,14 +787,17 @@ void CommandLine::runCommand(String input) {
Station new_sta = stations->get(i);
new_sta.selected = false;
stations->set(i, new_sta);
count_unselected += 1;
}
else {
// Select "unselected" ap
Station new_sta = stations->get(i);
new_sta.selected = true;
stations->set(i, new_sta);
count_selected += 1;
}
}
this->showCounts(count_selected, count_unselected);
}
// Select specific Stations
else {
@@ -685,14 +813,17 @@ void CommandLine::runCommand(String input) {
Station new_sta = stations->get(index);
new_sta.selected = false;
stations->set(index, new_sta);
count_unselected += 1;
}
else {
// Select "unselected" ap
Station new_sta = stations->get(index);
new_sta.selected = true;
stations->set(index, new_sta);
count_selected += 1;
}
}
this->showCounts(count_selected, count_unselected);
}
}
// select ssids
@@ -712,14 +843,17 @@ void CommandLine::runCommand(String input) {
ssid new_ssid = ssids->get(index);
new_ssid.selected = false;
ssids->set(index, new_ssid);
count_unselected += 1;
}
else {
// Select "unselected" ap
ssid new_ssid = ssids->get(index);
new_ssid.selected = true;
ssids->set(index, new_ssid);
count_selected += 1;
}
}
this->showCounts(count_selected, count_unselected);
}
else {
Serial.println("You did not specify which list to select from");
@@ -763,4 +897,41 @@ void CommandLine::runCommand(String input) {
return;
}
}
// Join WiFi
else if (cmd_args.get(0) == JOINWIFI_CMD) {
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");
String essid = "";
String pwx = "";
if (s_sw != -1) {
int index = cmd_args.get(s_sw + 1).toInt();
if (!this->inRange(ssids->size(), index)) {
Serial.println("Index not in range: " + (String)index);
return;
}
essid = ssids->get(index).essid;
} else if (a_sw != -1) {
int index = cmd_args.get(a_sw + 1).toInt();
if (!this->inRange(access_points->size(), index)) {
Serial.println("Index not in range: " + (String)index);
return;
}
essid = access_points->get(index).essid;
} else if (n_sw != -1) {
essid = cmd_args.get(n_sw + 1);
} else {
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);
}
}
+5
View File
@@ -60,6 +60,7 @@ 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 JOINWIFI_CMD[] = "join";
// Bluetooth sniff/scan
const char PROGMEM BT_SNIFF_CMD[] = "sniffbt";
@@ -86,6 +87,7 @@ const char PROGMEM HELP_SNIFF_ESP_CMD[] = "sniffesp";
const char PROGMEM HELP_SNIFF_DEAUTH_CMD[] = "sniffdeauth";
const char PROGMEM HELP_SNIFF_PMKID_CMD[] = "sniffpmkid [-c <channel>]";
const char PROGMEM HELP_STOPSCAN_CMD[] = "stopscan";
const char PROGMEM HELP_JOIN_WIFI_CMD[] = "join [-n <ssid_name>/-s <ssid_index>/-a <access_point_index>] -p <password>";
// WiFi attack
const char PROGMEM HELP_ATTACK_CMD[] = "attack -t <beacon [-l/-r/-a]/deauth [-c]/[-s <src mac>] [-d <dst mac>]/probe/rickroll>";
@@ -108,11 +110,14 @@ class CommandLine {
private:
String getSerialInput();
LinkedList<String> parseCommand(String input, char* delim);
String toLowerCase(String str);
void filterAccessPoints(String filter);
void runCommand(String input);
bool checkValueExists(LinkedList<String>* cmd_args_list, int index);
bool inRange(int max, int index);
bool apSelected();
bool hasSSIDs();
void showCounts(int selected, int unselected = -1);
int argSearch(LinkedList<String>* cmd_args, String key);
const char* ascii_art =
+3737 -3734
View File
File diff suppressed because it is too large Load Diff