Bring bluetooth to ESP32-C5

This commit is contained in:
Just Call Me Koko
2025-11-25 17:46:14 -05:00
parent 2c0868e893
commit 30893adaa5
7 changed files with 798 additions and 557 deletions

View File

@@ -308,11 +308,11 @@ void CommandLine::runCommand(String input) {
wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
if(old_scan_mode == WIFI_SCAN_GPS_NMEA)
Serial.println("END OF NMEA STREAM");
Serial.println(F("END OF NMEA STREAM"));
else if(old_scan_mode == WIFI_SCAN_GPS_DATA)
Serial.println("Stopping GPS data updates");
Serial.println(F("Stopping GPS data updates"));
else
Serial.println("Stopping WiFi tran/recv");
Serial.println(F("Stopping WiFi tran/recv"));
// If we don't do this, the text and button coordinates will be off
#ifdef HAS_SCREEN
@@ -375,7 +375,7 @@ void CommandLine::runCommand(String input) {
Serial.println(gps_obj.getNmeaNotparsed());
}
else
Serial.println("You did not provide a valid argument");
Serial.println(F("You did not provide a valid argument"));
}
else if(nmea_arg != -1){
String nmea_type = cmd_args.get(nmea_arg + 1);
@@ -391,7 +391,7 @@ void CommandLine::runCommand(String input) {
Serial.println("GPS Output Type Set To: " + nmea_type);
}
else
Serial.println("You did not provide a valid argument");
Serial.println(F("You did not provide a valid argument"));
}
else if (track_arg != -1) {
wifi_scan_obj.currentScanMode = GPS_TRACKER;
@@ -401,9 +401,9 @@ void CommandLine::runCommand(String input) {
wifi_scan_obj.StartScan(GPS_TRACKER, TFT_CYAN);
}
else if(cmd_args.size()>1)
Serial.println("You did not provide a valid flag");
Serial.println(F("You did not provide a valid flag"));
else
Serial.println("You did not provide an argument");
Serial.println(F("You did not provide an argument"));
}
#endif
}
@@ -413,7 +413,7 @@ void CommandLine::runCommand(String input) {
#ifdef HAS_SCREEN
menu_function_obj.changeMenu(&menu_function_obj.gpsInfoMenu);
#endif
Serial.println("NMEA STREAM FOLLOWS");
Serial.println(F("NMEA STREAM FOLLOWS"));
wifi_scan_obj.currentScanMode = WIFI_SCAN_GPS_NMEA;
wifi_scan_obj.StartScan(WIFI_SCAN_GPS_NMEA, TFT_CYAN);
}
@@ -444,7 +444,7 @@ void CommandLine::runCommand(String input) {
}
}
#else
Serial.println("This hardware does not support neopixel");
Serial.println(F("This hardware does not support neopixel"));
#endif
}
// ls command
@@ -453,9 +453,9 @@ void CommandLine::runCommand(String input) {
if (cmd_args.size() > 1)
sd_obj.listDir(cmd_args.get(1));
else
Serial.println("You did not provide a dir to list");
Serial.println(F("You did not provide a dir to list"));
#else
Serial.println("SD support disabled, cannot use command");
Serial.println(F("SD support disabled, cannot use command"));
return;
#endif
}
@@ -524,7 +524,7 @@ void CommandLine::runCommand(String input) {
else if (da_sw != -1)
result = settings_obj.saveSetting<bool>(setting_name, false);
else {
Serial.println("You did not properly enable/disable this setting.");
Serial.println(F("You did not properly enable/disable this setting."));
return;
}
@@ -536,7 +536,7 @@ void CommandLine::runCommand(String input) {
}
else if (cmd_args.get(0) == REBOOT_CMD) {
Serial.println("Rebooting...");
Serial.println(F("Rebooting..."));
ESP.restart();
}
@@ -587,9 +587,9 @@ void CommandLine::runCommand(String input) {
}
}
else
Serial.println("GPS Module not detected");
Serial.println(F("GPS Module not detected"));
#else
Serial.println("GPS not supported");
Serial.println(F("GPS not supported"));
#endif
}
// Karma
@@ -597,14 +597,14 @@ void CommandLine::runCommand(String input) {
int pr_sw = this->argSearch(&cmd_args, "-p");
if (pr_sw == -1) {
Serial.println("You did not provide a target index");
Serial.println(F("You did not provide a target index"));
return;
}
int pr_index = cmd_args.get(pr_sw + 1).toInt();
if ((pr_index < 0) || (pr_index > probe_req_ssids->size() - 1)) {
Serial.println("The provided index was not in range");
Serial.println(F("The provided index was not in range"));
return;
}
@@ -618,7 +618,7 @@ void CommandLine::runCommand(String input) {
wifi_scan_obj.setMac();
}
else {
Serial.println("Unable to set AP ESSID");
Serial.println(F("Unable to set AP ESSID"));
return;
}
@@ -839,14 +839,14 @@ void CommandLine::runCommand(String input) {
int ap_sw = this->argSearch(&cmd_args, "-a"); // APs
if (ap_sw == -1) {
Serial.println("You did not provide a target index");
Serial.println(F("You did not provide a target index"));
return;
}
int ap_index = cmd_args.get(ap_sw + 1).toInt();
if ((ap_index < 0) || (ap_index > access_points->size() - 1)) {
Serial.println("The provided index was not in range");
Serial.println(F("The provided index was not in range"));
return;
}
@@ -865,14 +865,14 @@ void CommandLine::runCommand(String input) {
int cl_sw = this->argSearch(&cmd_args, "-s"); // Stations
if (cl_sw == -1) {
Serial.println("You did not provide a target index");
Serial.println(F("You did not provide a target index"));
return;
}
int sta_index = cmd_args.get(cl_sw + 1).toInt();
if ((sta_index < 0) || (sta_index > stations->size() - 1)) {
Serial.println("The provided index was not in range");
Serial.println(F("The provided index was not in range"));
return;
}
@@ -900,7 +900,7 @@ void CommandLine::runCommand(String input) {
int targ_sw = this->argSearch(&cmd_args, "-c");
if (attack_type_switch == -1) {
Serial.println("You must specify an attack type");
Serial.println(F("You must specify an attack type"));
return;
}
else {
@@ -911,7 +911,7 @@ void CommandLine::runCommand(String input) {
if (attack_type == ATTACK_TYPE_DEAUTH) {
// Default to broadcast
if ((dst_addr_sw == -1) && (targ_sw == -1)) {
Serial.println("Sending to broadcast...");
Serial.println(F("Sending to broadcast..."));
wifi_scan_obj.dst_mac = "ff:ff:ff:ff:ff:ff";
}
// Dest addr specified
@@ -921,7 +921,7 @@ void CommandLine::runCommand(String input) {
}
// Station list specified
else if (targ_sw != -1)
Serial.println("Sending to Station list");
Serial.println(F("Sending to Station list"));
// Source addr not specified
if (src_addr_sw == -1) {
@@ -1066,7 +1066,7 @@ void CommandLine::runCommand(String input) {
wifi_scan_obj.StartScan(WIFI_ATTACK_FUNNY_BEACON, TFT_CYAN);
}
else {
Serial.println("Attack type not properly defined");
Serial.println(F("Attack type not properly defined"));
return;
}
}
@@ -1120,7 +1120,7 @@ void CommandLine::runCommand(String input) {
wifi_scan_obj.StartScan(BT_SCAN_ALL, TFT_GREEN);
}
#else
Serial.println("Bluetooth not supported");
Serial.println(F("Bluetooth not supported"));
#endif
}
else if (cmd_args.get(0) == BT_SPOOFAT_CMD) {
@@ -1165,7 +1165,7 @@ void CommandLine::runCommand(String input) {
#endif
wifi_scan_obj.StartScan(BT_ATTACK_SOUR_APPLE, TFT_GREEN);
#else
Serial.println("Bluetooth not supported");
Serial.println(F("Bluetooth not supported"));
#endif
}
else if (bt_type == "windows") {
@@ -1177,7 +1177,7 @@ void CommandLine::runCommand(String input) {
#endif
wifi_scan_obj.StartScan(BT_ATTACK_SWIFTPAIR_SPAM, TFT_CYAN);
#else
Serial.println("Bluetooth not supported");
Serial.println(F("Bluetooth not supported"));
#endif
}
else if (bt_type == "samsung") {
@@ -1189,7 +1189,7 @@ void CommandLine::runCommand(String input) {
#endif
wifi_scan_obj.StartScan(BT_ATTACK_SAMSUNG_SPAM, TFT_CYAN);
#else
Serial.println("Bluetooth not supported");
Serial.println(F("Bluetooth not supported"));
#endif
}
else if (bt_type == "google") {
@@ -1201,7 +1201,7 @@ void CommandLine::runCommand(String input) {
#endif
wifi_scan_obj.StartScan(BT_ATTACK_GOOGLE_SPAM, TFT_CYAN);
#else
Serial.println("Bluetooth not supported");
Serial.println(F("Bluetooth not supported"));
#endif
}
else if (bt_type == "flipper") {
@@ -1213,7 +1213,7 @@ void CommandLine::runCommand(String input) {
#endif
wifi_scan_obj.StartScan(BT_ATTACK_FLIPPER_SPAM, TFT_ORANGE);
#else
Serial.println("Bluetooth not supported");
Serial.println(F("Bluetooth not supported"));
#endif
}
else if (bt_type == "all") {
@@ -1225,11 +1225,11 @@ void CommandLine::runCommand(String input) {
#endif
wifi_scan_obj.StartScan(BT_ATTACK_SPAM_ALL, TFT_MAGENTA);
#else
Serial.println("Bluetooth not supported");
Serial.println(F("Bluetooth not supported"));
#endif
}
else {
Serial.println("You did not specify a correct spam type");
Serial.println(F("You did not specify a correct spam type"));
}
}
}
@@ -1257,12 +1257,12 @@ void CommandLine::runCommand(String input) {
}
}
else
Serial.println("GPS Module not detected");
Serial.println(F("GPS Module not detected"));
#else
Serial.println("GPS not supported");
Serial.println(F("GPS not supported"));
#endif
#else
Serial.println("Bluetooth not supported");
Serial.println(F("Bluetooth not supported"));
#endif
}
@@ -1276,7 +1276,7 @@ void CommandLine::runCommand(String input) {
#endif
wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);
#else
Serial.println("Bluetooth not supported");
Serial.println(F("Bluetooth not supported"));
#endif
}
@@ -1298,13 +1298,13 @@ void CommandLine::runCommand(String input) {
if (sd_sw != -1) {
#ifdef HAS_SD
if (!sd_obj.supported) {
Serial.println("SD card is not connected. Cannot perform SD Update");
Serial.println(F("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");
Serial.println(F("SD card support disabled. Cannot perform SD Update"));
return;
#endif
}
@@ -1376,7 +1376,7 @@ void CommandLine::runCommand(String input) {
#endif
}
#else
Serial.println("Your hardware doesn't have GPS, silly");
Serial.println(F("Your hardware doesn't have GPS, silly"));
return;
#endif
}
@@ -1406,7 +1406,7 @@ void CommandLine::runCommand(String input) {
}
}
else {
Serial.println("The IP index specified is out of range");
Serial.println(F("The IP index specified is out of range"));
return;
}
}
@@ -1438,12 +1438,12 @@ void CommandLine::runCommand(String input) {
wifi_scan_obj.StartScan(target_mode, TFT_CYAN);
}
else {
Serial.println("You did not specify a supported service");
Serial.println(F("You did not specify a supported service"));
return;
}
}
else {
Serial.println("You did not specify an IP index");
Serial.println(F("You did not specify an IP index"));
return;
}
}
@@ -1525,7 +1525,7 @@ void CommandLine::runCommand(String input) {
}
}
else {
Serial.println("You did not specify which list to show");
Serial.println(F("You did not specify which list to show"));
return;
}
}
@@ -1573,11 +1573,11 @@ void CommandLine::runCommand(String input) {
#endif
}
else {
Serial.println("There are no saved WiFi credentials");
Serial.println(F("There are no saved WiFi credentials"));
}
}
else {
Serial.println("You did not provide the proper args");
Serial.println(F("You did not provide the proper args"));
return;
}
}
@@ -1747,7 +1747,7 @@ void CommandLine::runCommand(String input) {
this->showCounts(count_selected, count_unselected);
}
else {
Serial.println("You did not specify which list to select from");
Serial.println(F("You did not specify which list to select from"));
return;
}
}
@@ -1806,7 +1806,7 @@ void CommandLine::runCommand(String input) {
wifi_scan_obj.addSSID(essid);
}
else {
Serial.println("You did not specify how to add SSIDs");
Serial.println(F("You did not specify how to add SSIDs"));
}
}
// Remove SSID
@@ -1819,7 +1819,7 @@ void CommandLine::runCommand(String input) {
ssids->remove(index);
}
else {
Serial.println("You did not specify whether to add or remove SSIDs");
Serial.println(F("You did not specify whether to add or remove SSIDs"));
return;
}
}

View File

@@ -61,9 +61,9 @@ void EvilPortal::setupServer() {
#ifndef HAS_PSRAM
server.on("/", HTTP_GET, [this](AsyncWebServerRequest *request) {
request->send_P(200, "text/html", index_html);
Serial.println("client connected");
Serial.println(F("client connected"));
#ifdef HAS_SCREEN
this->sendToDisplay("Client connected to server");
this->sendToDisplay(F("Client connected to server"));
#endif
});
#else
@@ -71,7 +71,7 @@ void EvilPortal::setupServer() {
request->send(200, "text/html", index_html);
Serial.println("client connected");
#ifdef HAS_SCREEN
this->sendToDisplay("Client connected to server");
this->sendToDisplay(F("Client connected to server"));
#endif
});
#endif
@@ -144,10 +144,10 @@ void EvilPortal::setHtmlFromSerial() {
bool EvilPortal::setHtml() {
if (this->using_serial_html) {
Serial.println("html previously set");
Serial.println(F("html previously set"));
return true;
}
Serial.println("Setting HTML...");
Serial.println(F("Setting HTML..."));
#ifdef HAS_SD
File html_file = sd_obj.getFile("/" + this->target_html_name);
#else
@@ -156,7 +156,7 @@ bool EvilPortal::setHtml() {
if (!html_file) {
#ifdef HAS_SCREEN
this->sendToDisplay("Could not find /" + this->target_html_name);
this->sendToDisplay("Touch to exit...");
this->sendToDisplay(F("Touch to exit..."));
#endif
Serial.println("Could not find /" + this->target_html_name + ". Use stopscan...");
return false;
@@ -164,9 +164,9 @@ bool EvilPortal::setHtml() {
else {
if (html_file.size() > MAX_HTML_SIZE) {
#ifdef HAS_SCREEN
this->sendToDisplay("The given HTML is too large.");
this->sendToDisplay(F("The given HTML is too large."));
this->sendToDisplay("The Byte limit is " + (String)MAX_HTML_SIZE);
this->sendToDisplay("Touch to exit...");
this->sendToDisplay(F("Touch to exit..."));
#endif
Serial.println("The provided HTML is too large. Byte limit is " + (String)MAX_HTML_SIZE + "\nUse stopscan...");
return false;
@@ -316,14 +316,14 @@ bool EvilPortal::setAP(String essid) {
strncpy(apName, essid.c_str(), MAX_AP_NAME_SIZE);
this->has_ap = true;
Serial.println("ap config set");
Serial.println(F("ap config set"));
return true;
}
void EvilPortal::startAP() {
const IPAddress AP_IP(172, 0, 0, 1);
Serial.print("starting ap ");
Serial.print(F("starting ap "));
Serial.println(apName);
WiFi.mode(WIFI_AP);
@@ -334,19 +334,19 @@ void EvilPortal::startAP() {
this->sendToDisplay("AP started");
#endif
Serial.print("ap ip address: ");
Serial.print(F("ap ip address: "));
Serial.println(WiFi.softAPIP());
this->setupServer();
Serial.println("Server endpoints configured");
Serial.println(F("Server endpoints configured"));
this->dnsServer.start(53, "*", WiFi.softAPIP());
Serial.println("DNS Server started");
Serial.println(F("DNS Server started"));
server.addHandler(new CaptiveRequestHandler()).setFilter(ON_AP_FILTER);
Serial.println("Captive Portal handler started");
Serial.println(F("Captive Portal handler started"));
server.begin();
Serial.println("Server started");
Serial.println(F("Server started"));
#ifdef HAS_SCREEN
this->sendToDisplay("Evil Portal READY");
#endif
@@ -375,20 +375,29 @@ void EvilPortal::sendToDisplay(String msg) {
}
void EvilPortal::main(uint8_t scan_mode) {
if ((scan_mode == WIFI_SCAN_EVIL_PORTAL) && (this->has_ap) && (this->has_html)){
this->dnsServer.processNextRequest();
if (this->name_received && this->password_received) {
this->name_received = false;
this->password_received = false;
String logValue1 =
"u: " + this->user_name;
String logValue2 = "p: " + this->password;
String full_string = logValue1 + " " + logValue2 + "\n";
Serial.print(full_string);
buffer_obj.append(full_string);
#ifdef HAS_SCREEN
this->sendToDisplay(full_string);
#endif
}
if (scan_mode != WIFI_SCAN_EVIL_PORTAL || !this->has_ap || !this->has_html) {
return;
}
this->dnsServer.processNextRequest();
if (this->name_received && this->password_received) {
this->name_received = false;
this->password_received = false;
// Adjust size depending on your max username/password length
char line[96];
// If user_name / password are still Arduino String:
snprintf(line, sizeof(line),
"u: %s p: %s\n",
this->user_name.c_str(),
this->password.c_str());
Serial.print(line);
buffer_obj.append(line);
#ifdef HAS_SCREEN
this->sendToDisplay(line);
#endif
}
}

View File

@@ -58,7 +58,7 @@ MenuFunctions::MenuFunctions()
if(touchX>WIDTH_1 || touchY > HEIGHT_1)
{
Serial.println("Y or y outside of expected parameters..");
Serial.println(F("Y or y outside of expected parameters.."));
Serial.print("y:");
Serial.print(touchX);
Serial.print(" x:");
@@ -170,13 +170,13 @@ MenuFunctions::MenuFunctions()
if (btn_text != text09) {
}
else {
Serial.println("Exiting...");
Serial.println(F("Exiting..."));
lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn)));
for (int i = 0; i < stations->size(); i++) {
if (stations->get(i).selected) {
wifi_scan_obj.getMAC(addr, stations->get(i).mac, 0);
Serial.print("Selected: ");
Serial.print(F("Selected: "));
Serial.println(addr);
}
}
@@ -193,7 +193,7 @@ MenuFunctions::MenuFunctions()
for (int i = 0; i < stations->size(); i++) {
wifi_scan_obj.getMAC(addr, stations->get(i).mac, 0);
if (strcmp(addr, btn_text.c_str()) == 0) {
Serial.print("Adding Station: ");
Serial.print(F("Adding Station: "));
Serial.println(addr);
Station sta = stations->get(i);
sta.selected = true;
@@ -205,7 +205,7 @@ MenuFunctions::MenuFunctions()
for (int i = 0; i < stations->size(); i++) {
wifi_scan_obj.getMAC(addr, stations->get(i).mac, 0);
if (strcmp(addr, btn_text.c_str()) == 0) {
Serial.print("Removing Station: ");
Serial.print(F("Removing Station: "));
Serial.println(addr);
Station sta = stations->get(i);
sta.selected = false;
@@ -256,7 +256,7 @@ MenuFunctions::MenuFunctions()
if (btn_text != text09) {
}
else {
Serial.println("Exiting...");
Serial.println(F("Exiting..."));
lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn)));
for (int i = 1; i < evil_portal_obj.html_files->size(); i++) {
@@ -360,7 +360,7 @@ MenuFunctions::MenuFunctions()
}
// It's the back button
else {
Serial.println("Exiting...");
Serial.println(F("Exiting..."));
lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn)));
for (int i = 0; i < airtags->size(); i++) {
@@ -430,7 +430,7 @@ MenuFunctions::MenuFunctions()
if (btn_text != text09) {
}
else {
Serial.println("Exiting...");
Serial.println(F("Exiting..."));
lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn)));
for (int i = 0; i < access_points->size(); i++) {
@@ -496,7 +496,7 @@ MenuFunctions::MenuFunctions()
}
}
else {
Serial.println("Exiting...");
Serial.println(F("Exiting..."));
lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn)));
printf("LV_EVENT_CANCEL\n");
@@ -4051,7 +4051,7 @@ void MenuFunctions::showMenuList(Menu * menu, int layer)
// Depending on layer, indent
for (uint8_t x = 0; x < layer * 4; x++)
Serial.print(" ");
Serial.print("Node: ");
Serial.print(F("Node: "));
Serial.println(menu->list->get(i).name);
}
Serial.println();

View File

@@ -82,10 +82,10 @@ bool SDInterface::initSD() {
}
if (!SD.exists("/SCRIPTS")) {
Serial.println("/SCRIPTS does not exist. Creating...");
Serial.println(F("/SCRIPTS does not exist. Creating..."));
SD.mkdir("/SCRIPTS");
Serial.println("/SCRIPTS created");
Serial.println(F("/SCRIPTS created"));
}
this->sd_files = new LinkedList<String>();
@@ -96,7 +96,7 @@ bool SDInterface::initSD() {
}
#else
Serial.println("SD support disabled, skipping init");
Serial.println(F("SD support disabled, skipping init"));
return false;
#endif
}
@@ -280,7 +280,7 @@ void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
display_obj.tft.setTextColor(TFT_RED);
display_obj.tft.println(text_table2[12]);
#endif
Serial.println("Update not finished? Something went wrong!");
Serial.println(F("Update not finished? Something went wrong!"));
#ifdef HAS_SCREEN
display_obj.tft.setTextColor(TFT_WHITE);
#endif
@@ -299,7 +299,7 @@ void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
#ifdef HAS_SCREEN
display_obj.tft.println(text_table2[14]);
#endif
Serial.println("Not enough space to begin OTA");
Serial.println(F("Not enough space to begin OTA"));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -792,7 +792,7 @@ class WiFiScan
static void apSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void apSnifferCallbackFull(void* buf, wifi_promiscuous_pkt_type_t type);
static void deauthSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void probeSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
//static void probeSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void beaconListSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void eapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);

View File

@@ -32,7 +32,7 @@
//#define MARAUDER_V8
//// END BOARD TARGETS
#define MARAUDER_VERSION "v1.8.11"
#define MARAUDER_VERSION "v1.9.0"
#define GRAPH_REFRESH 100
@@ -2283,7 +2283,7 @@
//// EVIL PORTAL STUFF
#ifdef HAS_PSRAM
#define MAX_HTML_SIZE 30000
#define MAX_HTML_SIZE 20000
#else
#define MAX_HTML_SIZE 11400
#endif
@@ -2293,7 +2293,7 @@
//// GPS STUFF
#ifdef HAS_GPS
#ifdef HAS_PSRAM
#define mac_history_len 500
#define mac_history_len 100
#else
#define mac_history_len 100
#endif