add BLE jammer, move NRF activities into submenu
This commit is contained in:
parent
bf0a032a4e
commit
be5e6e7582
|
|
@ -11,14 +11,16 @@
|
|||
#include "device_check.h"
|
||||
#include "blemouse.h"
|
||||
#include "sysinfo.h"
|
||||
#include "BleMouse.h"
|
||||
|
||||
// ================= MENU DATA =================
|
||||
extern BleMouse bleMouse;
|
||||
|
||||
// Root menu
|
||||
const char *mainMenuItems[] = {
|
||||
"BadUSB",
|
||||
"RF Capture",
|
||||
"NRF Jammer",
|
||||
"NRF Tools",
|
||||
"BLE Scan",
|
||||
"Wifi Scan",
|
||||
"Wifi Analyzer",
|
||||
|
|
@ -30,12 +32,17 @@ const char *mainMenuItems[] = {
|
|||
|
||||
Menu mainMenu = {mainMenuItems, sizeof(mainMenuItems) / sizeof(mainMenuItems[0])};
|
||||
|
||||
// BadUSB submenu
|
||||
//const char *badusbItems[] = {
|
||||
// "Demo",
|
||||
// "Open CMD",
|
||||
// "Rickroll"};
|
||||
|
||||
// NRF Tools menu
|
||||
const char *nrfToolsItems[] = {
|
||||
"BLE Jammer",
|
||||
"Bluetooth Jammer"
|
||||
};
|
||||
|
||||
Menu nrfToolsMenu = {nrfToolsItems, sizeof(nrfToolsItems) / sizeof(nrfToolsItems[0])};
|
||||
|
||||
|
||||
// BadUSB submenu
|
||||
const char *badusbItems[] = {"DEMO",
|
||||
"KEYBOARD",
|
||||
"HID SCRIPT",
|
||||
|
|
@ -157,9 +164,15 @@ void launchFeature()
|
|||
printCapture();
|
||||
break;
|
||||
case 2:
|
||||
startNRFJammer();
|
||||
// startNRFJammer();
|
||||
//startBleJammer();
|
||||
//startBluetoothJammer();
|
||||
currentMenu = &nrfToolsMenu;
|
||||
menuIndex = 0;
|
||||
menuOffset = 0;
|
||||
break;
|
||||
|
||||
break;
|
||||
case 3:
|
||||
ble_scan();
|
||||
ble_drawMenu();
|
||||
|
|
@ -221,6 +234,8 @@ void launchFeature()
|
|||
ESP.restart();
|
||||
break;
|
||||
case 9:
|
||||
// Begin Ble mouse
|
||||
bleMouse.begin();
|
||||
ble_mouse_run();
|
||||
break;
|
||||
}
|
||||
|
|
@ -228,6 +243,8 @@ void launchFeature()
|
|||
else if (currentMenu == &badusbMenu)
|
||||
{
|
||||
badUSBMenu(menuIndex);
|
||||
} else if (currentMenu == &nrfToolsMenu) {
|
||||
NRFToolsMenu(menuIndex);
|
||||
}
|
||||
|
||||
insideFeature = false;
|
||||
|
|
|
|||
|
|
@ -9,91 +9,161 @@ extern SPIClass *RADIO_SPI;
|
|||
extern RF24 radio1;
|
||||
extern RF24 radio2;
|
||||
|
||||
const byte bleChannels[] = {2, 26, 80};
|
||||
|
||||
const byte bluetoothChannels[] = {
|
||||
32, 34, 46, 48, 50, 52,
|
||||
0, 1, 2, 4, 6, 8,
|
||||
22, 24, 26, 28, 30,
|
||||
74, 76, 78, 80
|
||||
};
|
||||
|
||||
void initNRF(RF24 &radio)
|
||||
{
|
||||
radio.begin(RADIO_SPI);
|
||||
if (!radio.begin(RADIO_SPI)) {
|
||||
Serial.println("NRF not found");
|
||||
return;
|
||||
}
|
||||
|
||||
radio.setAutoAck(false);
|
||||
radio.stopListening();
|
||||
|
||||
radio.setRetries(0, 0);
|
||||
radio.setDataRate(RF24_2MBPS);
|
||||
radio.setPALevel(RF24_PA_MAX);
|
||||
|
||||
radio.setDataRate(RF24_2MBPS);
|
||||
radio.openWritingPipe(0xE7E7E7E7E7LL);
|
||||
}
|
||||
|
||||
|
||||
void jamChannels(const char* label, int startCh, int endCh) {
|
||||
byte data1[32], data2[32];
|
||||
for (int i = 0; i < 32; i++) {
|
||||
data1[i] = random(0, 256);
|
||||
data2[i] = random(0, 256);
|
||||
}
|
||||
|
||||
for (int ch = startCh; ch <= endCh; ch++) {
|
||||
// Status screen
|
||||
u8g2.clearBuffer();
|
||||
u8g2.drawStr(0, 10, "Jamming:");
|
||||
u8g2.setCursor(60, 10);
|
||||
u8g2.print(label);
|
||||
u8g2.setCursor(0, 30);
|
||||
u8g2.print("Channel: ");
|
||||
u8g2.print(ch);
|
||||
u8g2.sendBuffer();
|
||||
|
||||
unsigned long startTime = millis();
|
||||
while (millis() - startTime < JAM_DURATION) {
|
||||
radio1.setChannel(ch);
|
||||
radio1.stopListening();
|
||||
radio1.write(data1, sizeof(data1));
|
||||
delayMicroseconds(100);
|
||||
|
||||
radio2.setChannel(ch);
|
||||
radio2.stopListening();
|
||||
radio2.write(data2, sizeof(data2));
|
||||
delayMicroseconds(100);
|
||||
Serial.println("NRF Initialized");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void nrfJammerSweep()
|
||||
{
|
||||
static uint8_t ch1 = 0;
|
||||
static uint8_t ch2 = 124;
|
||||
|
||||
uint8_t payload[32] = {0xFF};
|
||||
//void startBleJammer() {
|
||||
// initNRF(radio1);
|
||||
// initNRF(radio2);
|
||||
//
|
||||
// Serial.println("NRF JAMMER STARTED");
|
||||
//
|
||||
// const char payload[] = "xxxxxxxxxxxxxxxx";
|
||||
//
|
||||
// u8g2.clearBuffer();
|
||||
// u8g2.drawStr(0, 10, "Jamming:");
|
||||
// u8g2.setCursor(60, 10);
|
||||
// u8g2.print("Bluetooth");
|
||||
// u8g2.sendBuffer();
|
||||
//
|
||||
// while(true) {
|
||||
//
|
||||
// // Channels (you can change this set)
|
||||
// const byte channels[] = {2, 26, 80};
|
||||
//
|
||||
//
|
||||
// for (int i = 0; i < sizeof(channels); i++) {
|
||||
// radio1.setChannel(channels[i]);
|
||||
// radio1.write(&payload, sizeof(payload));
|
||||
// //radio2.setChannel(channels[i]);
|
||||
// //radio2.write(&payload, sizeof(payload));
|
||||
// }
|
||||
//
|
||||
// if (btnBack())
|
||||
// {
|
||||
// Serial.println("Jammer stopped");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
//
|
||||
//void startBluetoothJammer()
|
||||
//{
|
||||
// initNRF(radio1);
|
||||
// initNRF(radio2);
|
||||
//
|
||||
// Serial.println("NRF JAMMER STARTED");
|
||||
//
|
||||
// const char payload[] = "xxxxxxxxxxxxxxxx";
|
||||
//
|
||||
// u8g2.clearBuffer();
|
||||
// u8g2.drawStr(0, 10, "Jamming:");
|
||||
// u8g2.setCursor(60, 10);
|
||||
// u8g2.print("Bluetooth");
|
||||
// u8g2.sendBuffer();
|
||||
//
|
||||
// while(true) {
|
||||
//
|
||||
// // Channels (you can change this set)
|
||||
// const byte channels[] = {32, 34, 46, 48, 50, 52, 0, 1, 2, 4, 6, 8, 22, 24, 26, 28, 30, 74, 76, 78, 80};
|
||||
//
|
||||
//
|
||||
// for (int i = 0; i < sizeof(channels); i++) {
|
||||
// radio1.setChannel(channels[i]);
|
||||
// radio1.write(&payload, sizeof(payload));
|
||||
// //radio2.setChannel(channels[i]);
|
||||
// //radio2.write(&payload, sizeof(payload));
|
||||
// }
|
||||
//
|
||||
// if (btnBack())
|
||||
// {
|
||||
// Serial.println("Jammer stopped");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
radio1.setChannel(ch1);
|
||||
radio1.writeFast(payload, sizeof(payload));
|
||||
|
||||
radio2.setChannel(ch2);
|
||||
radio2.writeFast(payload, sizeof(payload));
|
||||
|
||||
ch1++;
|
||||
ch2--;
|
||||
|
||||
if (ch1 > 124) ch1 = 0;
|
||||
if (ch2 > 124) ch2 = 124;
|
||||
}
|
||||
|
||||
void startNRFJammer()
|
||||
void startJammer(const char* name, const byte* channels, size_t channelCount)
|
||||
{
|
||||
initNRF(radio1);
|
||||
initNRF(radio2);
|
||||
|
||||
Serial.println("NRF JAMMER STARTED");
|
||||
// nrfJammerSweep();
|
||||
jamChannels("Bluetooth", 0, 78);
|
||||
|
||||
const char payload[] = "xxxxxxxxxxxxxxxx";
|
||||
|
||||
u8g2.clearBuffer();
|
||||
u8g2.drawStr(0, 10, "Jamming:");
|
||||
u8g2.setCursor(60, 10);
|
||||
u8g2.print(name);
|
||||
u8g2.sendBuffer();
|
||||
|
||||
while (true)
|
||||
{
|
||||
for (size_t i = 0; i < channelCount; i++)
|
||||
{
|
||||
radio1.setChannel(channels[i]);
|
||||
radio1.write(&payload, sizeof(payload));
|
||||
|
||||
// Optional second NRF
|
||||
// radio2.setChannel(channels[i]);
|
||||
// radio2.write(&payload, sizeof(payload));
|
||||
}
|
||||
|
||||
if (btnBack())
|
||||
{
|
||||
Serial.println("Jammer stopped");
|
||||
return;
|
||||
}
|
||||
|
||||
delayMicroseconds(200);
|
||||
}
|
||||
}
|
||||
|
||||
void NRFToolsMenu(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
// startBleJammer();
|
||||
// BLE
|
||||
startJammer(
|
||||
"BLE",
|
||||
bleChannels,
|
||||
sizeof(bleChannels)
|
||||
);
|
||||
|
||||
break;
|
||||
case 1:
|
||||
// startBluetoothJammer();
|
||||
// Bluetooth
|
||||
startJammer(
|
||||
"Bluetooth",
|
||||
bluetoothChannels,
|
||||
sizeof(bluetoothChannels)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,9 @@
|
|||
// Initialization
|
||||
void initNRF(RF24 &radio);
|
||||
|
||||
// Jammer modes
|
||||
void startNRFJammer(); // dual-radio sweep jammer
|
||||
void stopNRFJammer(); // (optional, for future)
|
||||
void startBluetoothJammer();
|
||||
void startBleJammer();
|
||||
|
||||
// Advanced (later)
|
||||
void nrfJammerSweep(); // internal, but can expose if needed
|
||||
void nrfSetChannel(uint8_t ch);
|
||||
void startJammer(const char* name, const byte* channels, size_t channelCount);
|
||||
|
||||
void NRFToolsMenu(int index);
|
||||
|
|
|
|||
Loading…
Reference in New Issue