Skip to content
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
1 change: 1 addition & 0 deletions src/core/main_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
MainMenu::MainMenu() {
_menuItems = {
&wifiMenu,
&bw16Menu,
&bleMenu,
#if !defined(LITE_VERSION)
&ethernetMenu,
Expand Down
2 changes: 2 additions & 0 deletions src/core/main_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <MenuItemInterface.h>

#include "menu_items/BleMenu.h"
#include "menu_items/Bw16Menu.h"
#include "menu_items/ClockMenu.h"
#include "menu_items/ConfigMenu.h"
#include "menu_items/ConnectMenu.h"
Expand Down Expand Up @@ -35,6 +36,7 @@ class MainMenu {
RFMenu rfMenu;
ScriptsMenu scriptsMenu;
WifiMenu wifiMenu;
Bw16Menu bw16Menu;
#if !defined(LITE_VERSION)
LoRaMenu loraMenu;
EthernetMenu ethernetMenu;
Expand Down
135 changes: 135 additions & 0 deletions src/core/menu_items/Bw16Menu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#include "Bw16Menu.h"
#include "core/display.h"
#include "core/settings.h"
#include "core/utils.h"

BW16Tool Bw16Menu::tool;

void Bw16Menu::optionsMenu() {
tool.setup();

options = {
{"Bad Ble", [&]() { tool.attckbleMenu(); }},
{"Scan WiFi", [&]() { tool.scanWifi(); } },
{"Select WiFi", [&]() { tool.selectWifi(); } },
{"Attacks", [&]() { attackMenu(); } },
{"Config", [this]() { configMenu(); } }
};

addOptionToMainMenu();
String txt = "BW16 |TX:" + String(bruceConfigPins.gps_bus.tx) +
" |RX:" + String(bruceConfigPins.gps_bus.rx) + " | (" + String(bruceConfigPins.gpsBaudrate) +
" bps)";
loopOptions(options, MENU_TYPE_SUBMENU, txt.c_str());
}

void Bw16Menu::attackMenu() {
options = {
{"Deauth Selected", [&]() { tool.attackSelected(); }},
{"Deauth ALL", [&]() { tool.attackAll(); } },
{"Beacon Spam", [&]() { tool.beaconSpam(); } },
{"Beacon List", [&]() { tool.beaconList(); } },
{"Beacon & Deauth", [&]() { tool.beaconDeauth(); } },
{"Evil Portal", [&]() { tool.evilPortal(); } },
{"Back", [this]() { optionsMenu(); } }
};
loopOptions(options, MENU_TYPE_SUBMENU, "BW16 Attacks");
}

void Bw16Menu::configMenu() {
options = {
{"Baudrate", setGpsBaudrateMenu },
{"UART Pins", [=]() { setUARTPinsMenu(bruceConfigPins.gps_bus); }},
{"Back", [this]() { optionsMenu(); } }
};
loopOptions(options, MENU_TYPE_SUBMENU, "BW16 Config");
}

void Bw16Menu::drawIcon(float scale) {
clearIconArea();
uint16_t color = bruceConfig.priColor;
uint16_t bg = bruceConfig.bgColor;

int minDim = min(tftWidth, tftHeight);

int basePx;
if (minDim <= 135) {
basePx = 4;
} else if (minDim <= 240) {
basePx = 5;
} else if (minDim <= 320) {
basePx = 6;
} else {
basePx = 7;
}

float adjustedScale = scale * (minDim / 240.0f);
adjustedScale = constrain(adjustedScale, 0.8f, 1.2f);

int px = max(2, (int)(basePx * adjustedScale));
int totalW = 24 * px;
int totalH = 20 * px;
int x = iconCenterX - totalW / 2;
int y = iconCenterY - totalH / 2;

tft.fillRect(x + 2 * px, y, totalW - 4 * px, px, color);
tft.fillRect(x + 2 * px, y + totalH - px, totalW - 4 * px, px, color);
tft.fillRect(x, y + 2 * px, px, totalH - 4 * px, color);
tft.fillRect(x + totalW - px, y + 2 * px, px, totalH - 4 * px, color);

tft.fillRect(x + px, y + px, px, px, color);
tft.fillRect(x + totalW - 2 * px, y + px, px, px, color);
tft.fillRect(x + px, y + totalH - 2 * px, px, px, color);
tft.fillRect(x + totalW - 2 * px, y + totalH - 2 * px, px, px, color);

int wy = y + 3 * px;
int wx = x + 2 * px;

tft.fillRect(wx, wy, px, 5 * px, color);
tft.fillRect(wx + 2 * px, wy + 2 * px, px, 3 * px, color);
tft.fillRect(wx + 4 * px, wy + 2 * px, px, 3 * px, color);
tft.fillRect(wx + 6 * px, wy, px, 5 * px, color);
tft.fillRect(wx + 1 * px, wy + 5 * px, px, px, color);
tft.fillRect(wx + 3 * px, wy + 4 * px, px, px, color);
tft.fillRect(wx + 5 * px, wy + 5 * px, px, px, color);

int ix = wx + 8 * px;
tft.fillRect(ix, wy, 3 * px, px, color);
tft.fillRect(ix + px, wy + px, px, 3 * px, color);
tft.fillRect(ix, wy + 4 * px, 3 * px, px, color);

int fx = ix + 4 * px;
tft.fillRect(fx, wy, 4 * px, px, color);
tft.fillRect(fx + px, wy + px, px, 4 * px, color);
tft.fillRect(fx, wy + 4 * px, px, px, color);
tft.fillRect(fx + 2 * px, wy + 2 * px, 2 * px, px, color);
tft.drawPixel(fx + px, wy + 2 * px, bg);

int ix2 = fx + 5 * px;
tft.fillRect(ix2, wy, 3 * px, px, color);
tft.fillRect(ix2 + px, wy + px, px, 3 * px, color);
tft.fillRect(ix2, wy + 4 * px, 3 * px, px, color);

int by = y + 11 * px;
int x5 = x + 5 * px;

tft.fillRect(x5, by, 7 * px, px, color);
tft.fillRect(x5, by + px, 2 * px, 2 * px, color);
tft.fillRect(x5, by + 3 * px, 6 * px, px, color);
tft.fillRect(x5 + 5 * px, by + 4 * px, 2 * px, 2 * px, color);
tft.fillRect(x5 + px, by + 6 * px, 5 * px, px, color);
tft.fillRect(x5, by + 5 * px, px, px, color);
tft.drawPixel(x5 + 6 * px, by + 3 * px, bg);
tft.drawPixel(x5 + 6 * px, by + 6 * px, bg);

int xG = x5 + 8 * px;
tft.fillRect(xG + px, by, 5 * px, px, color);
tft.fillRect(xG, by + px, 2 * px, 5 * px, color);
tft.fillRect(xG + px, by + 6 * px, 5 * px, px, color);
tft.fillRect(xG + 5 * px, by + 3 * px, 2 * px, 3 * px, color);
tft.fillRect(xG + 3 * px, by + 3 * px, 2 * px, px, color);
tft.fillRect(xG + 6 * px, by + px, px, px, color);
tft.drawPixel(xG, by, bg);
tft.drawPixel(xG, by + 6 * px, bg);
tft.drawPixel(xG + 6 * px, by + 6 * px, bg);
}
22 changes: 22 additions & 0 deletions src/core/menu_items/Bw16Menu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef __BW16_MENU_H__
#define __BW16_MENU_H__

#include "MenuItemInterface.h"
#include "modules/bw16/bw16.h"

class Bw16Menu : public MenuItemInterface {
public:
Bw16Menu() : MenuItemInterface("BW16") {}

void optionsMenu(void);
void attackMenu();
void configMenu(void);
void drawIcon(float scale);
bool hasTheme() { return bruceConfig.theme.bw16; }
String themePath() { return bruceConfig.theme.paths.bw16; }

private:
static BW16Tool tool;
};

#endif
16 changes: 10 additions & 6 deletions src/core/menu_items/RFMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "core/utils.h"
#include "modules/rf/record.h"
#include "modules/rf/rf_bruteforce.h"
#include "modules/rf/rf_chat.h" // ← RF Chat
#include "modules/rf/rf_jammer.h"
#include "modules/rf/rf_listen.h"
#include "modules/rf/rf_scan.h"
Expand All @@ -27,6 +28,7 @@ void RFMenu::optionsMenu() {
{"Listen", rf_listen }, // dev_eclipse
#endif
{"Bruteforce", rf_bruteforce }, // dev_eclipse
{"RF Chat", rf_chat }, // CC1101 p2p chat
{"Jammer Itmt", [=]() { RFJammer(false); }},
#endif
{"Jammer Full", [=]() { RFJammer(true); } },
Expand All @@ -36,19 +38,21 @@ void RFMenu::optionsMenu() {

delay(200);
String txt = "Radio Frequency";
if (bruceConfigPins.rfModule == CC1101_SPI_MODULE) txt += " (CC1101)"; // Indicates if CC1101 is connected
if (bruceConfigPins.rfModule == CC1101_SPI_MODULE) txt += " (CC1101)";
else txt += " Tx: " + String(bruceConfigPins.rfTx) + " Rx: " + String(bruceConfigPins.rfRx);

loopOptions(options, MENU_TYPE_SUBMENU, txt.c_str());
}

void RFMenu::configMenu() {
options = {
{"RF TX Pin", lambdaHelper(gsetRfTxPin, true)},
{"RF RX Pin", lambdaHelper(gsetRfRxPin, true)},
{"RF Module", setRFModuleMenu},
{"RF Frequency", setRFFreqMenu},
{"Back", [this]() { optionsMenu(); }},
{"RF TX Pin", lambdaHelper(gsetRfTxPin, true)},
{"RF RX Pin", lambdaHelper(gsetRfRxPin, true)},
{"RF Module", setRFModuleMenu },
{"RF Frequency", setRFFreqMenu },
{"Chat Username", rf_chat_change_username }, // RF Chat nickname
{"Chat Frequency", rf_chat_change_freq }, // RF Chat frequency
Comment on lines +53 to +54
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wont built on LITE_VERSION... these functions must be enclosured in the flag

{"Back", [this]() { optionsMenu(); } },
};

loopOptions(options, MENU_TYPE_SUBMENU, "RF Config");
Expand Down
1 change: 1 addition & 0 deletions src/core/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ bool BruceTheme::openThemeFile(FS *fs, String filepath, bool overwriteConfigSett

ThemeEntry entries[] = {
{"wifi", &theme.wifi, theme.paths.wifi },
{"bw16", &theme.bw16, theme.paths.bw16 },
{"ble", &theme.ble, theme.paths.ble },
{"ethernet", &theme.ethernet, theme.paths.ethernet },
{"rf", &theme.rf, theme.paths.rf },
Expand Down
2 changes: 2 additions & 0 deletions src/core/theme.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

struct themeFiles {
String wifi = "";
String bw16 = "";
String ble = "";
String ethernet = "";
String rf = "";
Expand All @@ -34,6 +35,7 @@ struct themeInfo {
bool border = true;
bool label = true;
bool wifi = false;
bool bw16 = false;
bool ble = false;
bool ethernet = false;
bool rf = false;
Expand Down
63 changes: 63 additions & 0 deletions src/modules/BW16/bw16.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef __BW16_TOOL_H__
#define __BW16_TOOL_H__

#include <Arduino.h>
#include <algorithm>
#include <globals.h>
#include <vector>

struct BW16Network {
int index;
String ssid;
String bssid;
int channel;
int rssi;
};

struct BW16Group {
String ssid;
std::vector<BW16Network> aps;
int maxRssi = -127;
bool has24 = false;
bool has5 = false;
};

class BW16Tool {
public:
BW16Tool();
~BW16Tool();

void setup();
void scanWifi();
void selectWifi();
void attackWifiMenu();

void attackSelected();
void attackAll();
void beaconSpam();
void beaconList();
void beaconDeauth();
void evilPortal();
void attckbleMenu();
void send_at_ble(String type);
String readSerialLine();

private:
bool isBW16Active = false;
bool rxPinReleased = false;
std::vector<BW16Network> all_networks;
std::vector<BW16Group> grouped_networks;
std::vector<String> selected_bssids;

bool begin_bw16();
void end();
void releasePins();
void restorePins();
void display_banner();
void send_attack_command(String type);
void printCustomLog(String msg);
void centerString(String text);
void save_captured_creds(const std::vector<String> &creds);
};

#endif
Loading