From 78213a7f92956b3e4ccaa1b0c5fd43435814cb7d Mon Sep 17 00:00:00 2001 From: pr3y Date: Sun, 29 Dec 2024 06:39:20 -0300 Subject: [PATCH] added tcp listener and fixed md --- .github/FUNDING.yml | 4 +- pcbs/M5Stick_Intermidiate_kr4k3n/README.md | 3 +- .../README.md | 5 +- src/core/menu_items/WifiMenu.cpp | 2 + src/modules/wifi/listenTCP.cpp | 65 +++++++++++++++++++ src/modules/wifi/listenTCP.h | 3 + 6 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 src/modules/wifi/listenTCP.cpp create mode 100644 src/modules/wifi/listenTCP.h diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index a299a6546..ce047918f 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,8 +1,8 @@ # These are supported funding model platforms github: bmorcelli -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username +patreon: BruceFirmware +open_collective: brucefirmware ko_fi: brucefw tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry diff --git a/pcbs/M5Stick_Intermidiate_kr4k3n/README.md b/pcbs/M5Stick_Intermidiate_kr4k3n/README.md index b1ba7a074..38f9e10b5 100644 --- a/pcbs/M5Stick_Intermidiate_kr4k3n/README.md +++ b/pcbs/M5Stick_Intermidiate_kr4k3n/README.md @@ -1,4 +1,5 @@ -# Bruce PCB +# Bruce M5stick extender v0.1 This PCB was designed by TH3_KR4K3N +![KR4K3N Bruce PCB front](https://raw.githubusercontent.com/pr3y/Bruce/refs/heads/main/media/pcbs/TH3_KR4K3N/pcb_back.jpg) diff --git a/pcbs/M5Stick_Intermidiate_ultramarines/README.md b/pcbs/M5Stick_Intermidiate_ultramarines/README.md index 26b45e841..6c9f1ec2d 100644 --- a/pcbs/M5Stick_Intermidiate_ultramarines/README.md +++ b/pcbs/M5Stick_Intermidiate_ultramarines/README.md @@ -1,4 +1,7 @@ -# Bruce PCB +# Bruce M5 Stick Extender This PCB was designed by ultramarines +![ultramarines Bruce PCB side](https://raw.githubusercontent.com/pr3y/Bruce/refs/heads/main/media/pcbs/ultramarines/ultramarines_full_side.jpg) +![ultramarines Bruce PCB front](https://raw.githubusercontent.com/pr3y/Bruce/refs/heads/main/media/pcbs/ultramarines/ultramarines_pcb_front.png) +![ultramarines Bruce PCB back](https://raw.githubusercontent.com/pr3y/Bruce/refs/heads/main/media/pcbs/ultramarines/ultramarines_pcb_back.jpg) diff --git a/src/core/menu_items/WifiMenu.cpp b/src/core/menu_items/WifiMenu.cpp index 81ee5078f..5dee878e4 100644 --- a/src/core/menu_items/WifiMenu.cpp +++ b/src/core/menu_items/WifiMenu.cpp @@ -25,6 +25,7 @@ // 32bit: https://github.com/9dl/Bruce-C2/releases/download/v1.0/BruceC2_windows_386.exe // 64bit: https://github.com/9dl/Bruce-C2/releases/download/v1.0/BruceC2_windows_amd64.exe +#include "modules/wifi/listenTCP.h" void WifiMenu::optionsMenu() { if(!wifiConnected) { @@ -39,6 +40,7 @@ void WifiMenu::optionsMenu() { options.push_back({"Wifi Atks", [=]() { wifi_atk_menu(); }}); options.push_back({"Evil Portal", [=]() { EvilPortal(); }}); options.push_back({"ReverseShell", [=]() { ReverseShell(); }}); + options.push_back({"Listen TCP", [=]() { listenTcpPort(); }}); #ifndef LITE_VERSION options.push_back({"TelNET", [=]() { telnet_setup(); }}); options.push_back({"SSH", [=]() { ssh_setup(); }}); diff --git a/src/modules/wifi/listenTCP.cpp b/src/modules/wifi/listenTCP.cpp new file mode 100644 index 000000000..8b9ae4577 --- /dev/null +++ b/src/modules/wifi/listenTCP.cpp @@ -0,0 +1,65 @@ +#include "modules/wifi/listenTCP.h" +#include "core/wifi_common.h" + +void listenTcpPort() { + if (!wifiConnected) wifiConnectMenu(); + + WiFiClient tcpClient; + tft.fillScreen(TFT_BLACK); + tft.setTextSize(1); + tft.setTextColor(TFT_WHITE, TFT_BLACK); + + String portNumber = keyboard("", 5, "TCP port to listen"); + int portNumberInt = atoi(portNumber.c_str()); + + WiFiServer tcpServer(portNumberInt); + tcpServer.begin(); + + tft.println("Listening..."); + tft.print(WiFi.localIP().toString().c_str()); + tft.println(":" + portNumber); + + bool inputMode; + + for (;;) { + WiFiClient client = tcpServer.available(); // Wait for a client to connect + + if (client) { + Serial.println("Client connected"); + tft.println("Client connected"); + + while (client.connected()) { + if (inputMode) { + String keyString = keyboard("", 16, "send input data"); + delay(300); + inputMode = false; + tft.fillScreen(TFT_BLACK); + tft.setCursor(0,0); + if (keyString.length() > 0) { + client.print(keyString); // Send the entire string to the client + Serial.print(keyString); + } + } else { + if (client.available()) { + char incomingChar = client.read(); // Read one byte at time from the client + tft.print(incomingChar); + Serial.print(incomingChar); + } + if (checkSelPress()) { + delay(300); + inputMode = true; + } + } + } + client.stop(); + Serial.println("Client disconnected"); + displayError("Client disconnected"); + + } + if (checkEscPress()) { + displayError("Exiting Listener"); + tcpServer.stop(); + break; + } + } +} diff --git a/src/modules/wifi/listenTCP.h b/src/modules/wifi/listenTCP.h new file mode 100644 index 000000000..f696000d8 --- /dev/null +++ b/src/modules/wifi/listenTCP.h @@ -0,0 +1,3 @@ +#include "core/mykeyboard.h" + +void listenTcpPort();