Skip to content

Commit

Permalink
v2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cifertech authored Dec 15, 2024
1 parent ccf1119 commit df0384e
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 38 deletions.
8 changes: 5 additions & 3 deletions nRFBox_V2/blejammer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ void IRAM_ATTR handleButtonPress() {

void configureRadio(RF24 &radio, byte channel) {
radio.powerDown();
delay(1000);
delay(500);
radio.powerUp();
radio.setAutoAck(false);
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_HIGH);
radio.setDataRate(RF24_2MBPS);
radio.stopListening();
radio.setChannel(channel);
}
Expand Down Expand Up @@ -165,7 +165,9 @@ void blejammerSetup(){
esp_bt_controller_deinit();
esp_wifi_stop();
esp_wifi_deinit();

u8g2.begin();

pinMode(MODE_BUTTON, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(MODE_BUTTON), handleButtonPress, FALLING);

Expand Down
128 changes: 93 additions & 35 deletions nRFBox_V2/jammer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,50 @@
#define BT3 26 // data rate
#define BT4 25 // PA level

#define CE_PIN 5
#define CSN_PIN 17

#define CE_A 5
#define CSN_A 17

#define CE_B 16
#define CSN_B 4

#define CE_C 15
#define CSN_C 2

RF24 radioA(CE_A, CSN_A);
RF24 radioB(CE_B, CSN_B);
RF24 radioC(CE_C, CSN_C);

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64

RF24 radio(CE_PIN, CSN_PIN);

const int num_channels = 64;
int value[num_channels];
int valuesDisplay[32];
int channels = 1;
const int num_reps = 50;
bool jamming = false;
const byte address[6] = "00001";
const int num_channels = 64;
int value[num_channels];
int valuesDisplay[32];
int channels = 1;
const int num_reps = 50;
bool jamming = false;
const byte address[6] = "00001";

uint8_t dataRateIndex = 0; // Index for cycling through data rates
uint8_t paLevelIndex = 0; // Index for cycling through PA levels

extern U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2;



void setRadioParameters() {
switch (dataRateIndex) {
case 0: radio.setDataRate(RF24_250KBPS); break;
case 1: radio.setDataRate(RF24_1MBPS); break;
case 2: radio.setDataRate(RF24_2MBPS); break;
case 0: radioA.setDataRate(RF24_250KBPS); radioB.setDataRate(RF24_250KBPS); radioC.setDataRate(RF24_250KBPS); break;
case 1: radioA.setDataRate(RF24_1MBPS); radioB.setDataRate(RF24_1MBPS); radioC.setDataRate(RF24_1MBPS); break;
case 2: radioA.setDataRate(RF24_2MBPS); radioB.setDataRate(RF24_2MBPS); radioC.setDataRate(RF24_2MBPS);break;
}

switch (paLevelIndex) {
case 0: radio.setPALevel(RF24_PA_MIN); break;
case 1: radio.setPALevel(RF24_PA_LOW); break;
case 2: radio.setPALevel(RF24_PA_HIGH); break;
case 3: radio.setPALevel(RF24_PA_MAX); break;
case 0: radioA.setPALevel(RF24_PA_MIN); radioB.setPALevel(RF24_PA_MIN); radioC.setPALevel(RF24_PA_MIN); break;
case 1: radioA.setPALevel(RF24_PA_LOW); radioB.setPALevel(RF24_PA_LOW); radioC.setPALevel(RF24_PA_LOW); break;
case 2: radioA.setPALevel(RF24_PA_HIGH); radioB.setPALevel(RF24_PA_HIGH); radioC.setPALevel(RF24_PA_HIGH); break;
case 3: radioA.setPALevel(RF24_PA_MAX); radioB.setPALevel(RF24_PA_MAX); radioC.setPALevel(RF24_PA_MAX); break;
}

Serial.print("Data Rate: ");
Expand All @@ -55,31 +64,57 @@ void setRadioParameters() {
}

void radioSetChannel(int channels) {
radio.setChannel(channels);
radioA.setChannel(channels);
radioB.setChannel(channels);
radioC.setChannel(channels);
}

void jammer() {
const char text[] = "xxxxxxxxxxxxxxxx";
int methode = 1;

const char text[] = { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55,
0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 };

if (methode = 0) {
for (int i = ((channels * 5) + 1); i < ((channels * 5) + 23); i++) {
radioSetChannel(i);
bool result = radio.write(&text, sizeof(text));
if (result) {
Serial.println("Transmission successful");
} else {
Serial.println("Transmission failed");
}
bool resultA = radioA.write(&text, sizeof(text));
bool resultB = radioB.write(&text, sizeof(text));
bool resultC = radioC.write(&text, sizeof(text));

delay(10);
}
}

if (methode = 1) {
for (int i = 0; i < 22; i++) { // Jam across 22 channels
int channelA = ((channels * 5) + 1) + i;
int channelB = ((channels * 5) + 1) + i + 1;
int channelC = ((channels * 5) + 1) + i + 2;

// Set each radio to a different channel
radioA.setChannel(channelA);
radioB.setChannel(channelB);
radioC.setChannel(channelC);

// Transmit payload on all three channels simultaneously
radioA.write(&text, sizeof(text));
radioB.write(&text, sizeof(text));
radioC.write(&text, sizeof(text));

delay(10); // Delay before hopping to the next set of channels
}
}
}

void pressBt01() {
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
if (interrupt_time - last_interrupt_time > 200) {
if (channels < 13) {
if (channels < 14) {
channels++;
} else {
channels = 0;
channels = 1;
}
Serial.print("Channel: ");
Serial.println(channels);
Expand Down Expand Up @@ -119,6 +154,18 @@ void pressBt04() {
last_interrupt_time = interrupt_time;
}

void configure(RF24 &radio) {
radio.begin();
radio.openWritingPipe(0xFFFFFFFFFF);
//radio.setAutoAck(false);
radio.powerDown();
delay(500);
radio.powerUp();
radio.setPALevel(RF24_PA_MIN);
radio.setDataRate(RF24_250KBPS);
radio.stopListening();
}

void jammerSetup(){
Serial.begin(115200);

Expand All @@ -133,17 +180,28 @@ void jammerSetup(){

SPI.begin();

pinMode(CE_PIN, OUTPUT);
pinMode(CSN_PIN, OUTPUT);
pinMode(CE_A, OUTPUT);
pinMode(CSN_A, OUTPUT);

pinMode(CE_B, OUTPUT);
pinMode(CSN_B, OUTPUT);

pinMode(CE_C, OUTPUT);
pinMode(CSN_C, OUTPUT);

u8g2.begin();
u8g2.clearBuffer();
u8g2.sendBuffer();

radio.begin();

configure(radioA);
configure(radioB);
configure(radioC);

//radio.begin();
setRadioParameters();
radio.openWritingPipe(address);
radio.stopListening();
//radio.openWritingPipe(address);
//radio.stopListening();

Serial.println("Radio configured and ready");
}
Expand Down Expand Up @@ -203,9 +261,9 @@ void jammerLoop(){
delay(50);

if (jamming) {
u8g2.setCursor(80, 60);
u8g2.setCursor(80, 60);
u8g2.print("Active ");
Serial.println("Starting jamming on channel " + String(channels + 1));
Serial.println("Starting jamming on channel " + String(channels));
jammer();
}
}
29 changes: 29 additions & 0 deletions nRFBox_V2/nRFBox_V2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@
#include "spoofer.h"
#include "sourapple.h"


#define CE_PIN_A 5
#define CSN_PIN_A 17

#define CE_PIN_B 16
#define CSN_PIN_B 4

#define CE_PIN_C 15
#define CSN_PIN_C 2

RF24 RadioA(CE_PIN_A, CSN_PIN_A);
RF24 RadioB(CE_PIN_B, CSN_PIN_B);
RF24 RadioC(CE_PIN_C, CSN_PIN_C);

//U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0); // [full framebuffer, size = 1024 bytes]
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

Expand Down Expand Up @@ -76,9 +90,24 @@ void about() {
u8g2.sendBuffer();
}

void configureNrf(RF24 &radio) {
radio.begin();
radio.powerDown();
delay(500);
radio.powerUp();
//radio.setAutoAck(false);
//radio.setPALevel(RF24_PA_HIGH);
//radio.setDataRate(RF24_2MBPS);
//radio.stopListening();
}


void setup() {

configureNrf(RadioA);
configureNrf(RadioB);
configureNrf(RadioC);

u8g2.begin();
u8g2.setBitmapMode(1);

Expand Down

0 comments on commit df0384e

Please sign in to comment.