Skip to content

Commit

Permalink
Merge pull request #214 from bmorcelli/main
Browse files Browse the repository at this point in the history
NRF25 Bluetooth Jammer
  • Loading branch information
pr3y authored Aug 24, 2024
2 parents ce34b39 + b0d69e9 commit a3b89a4
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 0 deletions.
53 changes: 53 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ lib_deps =
Adafruit Si4713 [email protected]
SmartRC-CC1101-Driver-Lib=https://github.com/bmorcelli/SmartRC-CC1101-Driver-Lib/archive/refs/heads/Bruce.zip
h2zero/NimBLE-Arduino@^1.4.0
nrf24/RF24 @ ^1.4.9
;https://github.com/eadmaster/rtl_433_ESP

[env:m5stack-cplus2]
Expand Down Expand Up @@ -126,6 +127,14 @@ build_flags =
-DCC1101_SCK_PIN=0
-DCC1101_MISO_PIN=33
;-DCC1101_GDO2_PIN=-1

; connections are the same as CC1101
-DUSE_NRF24_VIA_SPI
-DNRF24_CE_PIN=25
-DNRF24_SS_PIN=26 ; chip select
-DNRF24_MOSI_PIN=32
-DNRF24_SCK_PIN=0
-DNRF24_MISO_PIN=33

;Battery ADC read pin
-DBAT_PIN=38
Expand Down Expand Up @@ -231,6 +240,14 @@ build_flags =
-DCC1101_MISO_PIN=33
;-DCC1101_GDO2_PIN=-1

; connections are the same as CC1101
-DUSE_NRF24_VIA_SPI
-DNRF24_CE_PIN=25
-DNRF24_SS_PIN=26 ; chip select
-DNRF24_MOSI_PIN=32
-DNRF24_SCK_PIN=0
-DNRF24_MISO_PIN=33

;Battery ADC read pin
-DBAT_PIN=10

Expand Down Expand Up @@ -345,6 +362,14 @@ build_flags =
-DCC1101_MISO_PIN=39 ; DAT0 on SDsniffer
;-DCC1101_GDO2_PIN=-1

; connections are the same as CC1101
-DUSE_NRF24_VIA_SPI
-DNRF24_CE_PIN=GROVE_SDA
-DNRF24_SS_PIN=GROVE_SCL ; chip select
-DNRF24_MOSI_PIN=14
-DNRF24_SCK_PIN=40
-DNRF24_MISO_PIN=39

;Screen Setup
-DHAS_SCREEN=1
-DROTATION=1
Expand Down Expand Up @@ -833,6 +858,16 @@ build_flags =
-DCC1101_SCK_PIN=12
-DCC1101_MISO_PIN=13
;-DCC1101_GDO2_PIN=14 ; optional

; connections are the same as CC1101
-DUSE_NRF24_VIA_SPI
-DNRF24_CE_PIN=6
-DNRF24_SS_PIN=7 ; chip select
-DNRF24_MOSI_PIN=11
-DNRF24_SCK_PIN=12
-DNRF24_MISO_PIN=13


lib_deps =
${common.lib_deps}

Expand Down Expand Up @@ -903,6 +938,24 @@ build_flags =
-DRF_TX_PINS='{{"M5 RF433T", GROVE_SDA}, {"Pin 1", 1}, {"Pin 2", 2}}'
-DRF_RX_PINS='{{"M5 FR433R", GROVE_SCL}, {"Pin 1", 1}, {"Pin 2", 2}}'

;CC1101 SPI connection pins
; best connection pins for higher speed https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/spi_master.html#gpio-matrix-and-io-mux
;-DUSE_CC1101_VIA_SPI
-DCC1101_GDO0_PIN=9
-DCC1101_SS_PIN=10
-DCC1101_MOSI_PIN=11
-DCC1101_SCK_PIN=12
-DCC1101_MISO_PIN=13
;-DCC1101_GDO2_PIN=14 ; optional

; connections are the same as CC1101
;-DUSE_NRF24_VIA_SPI
-DNRF24_CE_PIN=6
-DNRF24_SS_PIN=7 ; chip select
-DNRF24_MOSI_PIN=11
-DNRF24_SCK_PIN=12
-DNRF24_MISO_PIN=13

;Font sizes, depending on device
-DFP=1
-DFM=2
Expand Down
6 changes: 6 additions & 0 deletions src/core/main_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "modules/ble/ble_spam.h"
#include "modules/ble/ble_common.h"
#include "modules/ble/ble_jammer.h"
#include "modules/others/openhaystack.h"
#include "modules/others/tururururu.h"
#include "modules/others/webInterface.h"
Expand Down Expand Up @@ -79,6 +80,11 @@ void bleOptions() {
#if !defined(LITE_VERSION)
{"BLE Beacon", [=]() { ble_test(); }},
{"BLE Scan", [=]() { ble_scan(); }},

#if defined(USE_NRF24_VIA_SPI)
{"NRF24 Jammer", [=]() { ble_jammer(); }},
#endif

#endif
{"AppleJuice", [=]() { aj_adv(0); }},
{"SwiftPair", [=]() { aj_adv(1); }},
Expand Down
47 changes: 47 additions & 0 deletions src/modules/ble/ble_jammer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include "ble_jammer.h"
#include "core/globals.h"
#include "core/mykeyboard.h"
#include "core/display.h"


/* **************************************************************************************
** name : ble_jammer
** details : Starts 2.4Gz jammer usinf NRF24
************************************************************************************** */
void ble_jammer() {
#if defined(USE_NRF24_VIA_SPI)
sdcardSPI.begin(NRF24_SCK_PIN,NRF24_MISO_PIN,NRF24_MOSI_PIN,NRF24_SS_PIN);
RF24 radio(NRF24_CE_PIN, NRF24_SS_PIN); ///ce-csn
byte hopping_channel[] = {32,34, 46,48, 50, 52, 0, 1, 2, 4, 6, 8, 22, 24, 26, 28, 30, 74, 76, 78, 80, 82, 84,86 }; // channel to hop
byte ptr_hop = 0; // Pointer to the hopping array
if(radio.begin(&sdcardSPI)) {
Serial.println("NRF24 turned On");

radio.setPALevel(RF24_PA_MAX);
radio.startConstCarrier(RF24_PA_MAX, 45);
radio.setAddressWidth(3);//optional
radio.setPayloadSize(2);//optional
if(!radio.setDataRate(RF24_2MBPS)) Serial.println("Fail setting data Rate");

drawMainBorder();
tft.setCursor(10,28);
tft.setTextSize(FM);
tft.println("BLE Jammer:");
tft.setCursor(10,tft.getCursorY()+8);
tft.println("Select to stop!");
delay(200);

while(!checkSelPress()) {
ptr_hop++; /// perform next channel change
if (ptr_hop >= sizeof(hopping_channel)) ptr_hop = 0; // To avoid array indexing overflow
radio.setChannel(hopping_channel[ptr_hop]); // Change channel
}
radio.powerDown();
} else {
Serial.println("Fail Starting radio");
displayError("NRF24 not found");
delay(500);
while(!checkSelPress()); // wait confirmation
}
#endif
}
23 changes: 23 additions & 0 deletions src/modules/ble/ble_jammer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

#include <RF24.h>

/*
Credits: @smoochiee https://github.com/smoochiee/Ble-jammer
thank you for providing this simplified code for us!
Information:
- This Jammer is supposed to be used for Educational purpouse only.
- The signal is strong enaugh to mess with 2.4Ghz spectrum, so probaby 2.4Gz Wifi networks will be affected causing a DOS attack
- If the target is near the bluetooth source (smartphone right beside the bluetooth speaker), the communication between them will be weakly affected (we don't do magic)
FLAFS:
USE_NRF24_VIA_SPI ;-> Uncomment to allow this ooption for the user
NRF24_CE_PIN=-1 ; Set this pin accordingly
NRF24_SS_PIN=-1 ; Set this pin accordingly
NRF24_MOSI_PIN=-1 ; Set this pin accordingly
NRF24_SCK_PIN=-1 ; Set this pin accordingly
NRF24_MISO_PIN=-1 ; Set this pin accordingly
*/


void ble_jammer();

0 comments on commit a3b89a4

Please sign in to comment.