Add BadUSB

This commit is contained in:
Just Call Me Koko
2021-04-08 21:02:31 -04:00
parent a18b8b3004
commit fe33f1fab3
14 changed files with 588 additions and 59 deletions

View File

@@ -1,36 +1,459 @@
void setup() {
Serial.begin(115200);
#include <hidboot.h>
#include <usbhub.h>
#include "Keyboard.h"
delay(100);
Serial1.begin(115200);
#define Serial Serial1
delay(100);
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
// Satisfy the IDE, which needs to see the include statment in the ino too.
#ifdef dobogusinclude
#include <spi4teensy3.h>
#include <SPI.h>
#endif
delay(100);
#include <SPI.h>
#include <SD.h>
Serial.println("Waiting for serial data...");
#define CAPS_LOCK 0x39
#define NUM_LOCK 0x53
#define SCROLL_LOCK 0x47
#define PRINT_SCREEN 0x46
#define NUM_1 0x59
#define NUM_2 0x5A
#define NUM_3 0x5B
#define NUM_4 0x5C
#define NUM_5 0x5D
#define NUM_6 0x5E
#define NUM_7 0x5F
#define NUM_8 0x60
#define NUM_9 0x61
#define NUM_0 0x62
#define KEY_CAPS_LOCK 0x01
#define KEY_NUM_LOCK 0x02
#define KEY_SCROLL_LOCK 0x04
#define KEY_PRINT_SCREEN 0x05
#define KEY_NUM_1 0x31
#define KEY_NUM_2 0x32
#define KEY_NUM_3 0x33
#define KEY_NUM_4 0x34
#define KEY_NUM_5 0x35
#define KEY_NUM_6 0x36
#define KEY_NUM_7 0x37
#define KEY_NUM_8 0x38
#define KEY_NUM_9 0x39
#define KEY_NUM_0 0x30
String bufferStr = "";
String last = "";
int defaultDelay = 0;
bool shift = false;
bool num_lock = false; // false is working half way
USB Usb;
HIDBoot<USB_HID_PROTOCOL_KEYBOARD> HidKeyboard(&Usb);
uint32_t next_time;
class KbdRptParser : public KeyboardReportParser{
public:
uint8_t _parse(uint8_t key);
String _getChar(uint8_t key);
protected:
void OnControlKeysChanged(uint8_t before, uint8_t after);
void OnKeyDown (uint8_t mod, uint8_t key);
void OnKeyUp (uint8_t mod, uint8_t key);
void OnKeyPressed(uint8_t key);
void _press(uint8_t key);
void _release(uint8_t key);
};
void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key){
digitalWrite(LED_BUILTIN, HIGH);
int parsedKey = _parse(key);
if(parsedKey == key){
uint8_t c = OemToAscii(mod, key);
OnKeyPressed(c);
if(c != 0x20 && c != 0x00) _press(c);
else _press(key);
}else _press(parsedKey);
digitalWrite(LED_BUILTIN, LOW);
}
// the loop function runs over and over again forever
void loop() {
if (Serial1.available()) {
String input = Serial1.readString();
input.trim();
if (input == "Ping") {
Serial1.println("A32U4 Pong");
Serial.println("A32U4 Pong");
void KbdRptParser::OnKeyUp(uint8_t mod, uint8_t key){
int parsedKey = _parse(key);
if(parsedKey == key){
uint8_t c = OemToAscii(mod, key);
OnKeyPressed(c);
if(c != 0x20 && c != 0x00){
_release(c);
Serial.print((char)c);
}
Serial.println(input);
digitalWrite(LED_BUILTIN, HIGH); // wait for a second
delay(1);
digitalWrite(LED_BUILTIN, LOW);
delay(1);
else{
_release(key);
Serial.print("0x");
Serial.print(key, HEX);
}
}else{
_release(parsedKey);
Serial.print(_getChar(key));
}
}
void KbdRptParser::OnControlKeysChanged(uint8_t before, uint8_t after) {
MODIFIERKEYS beforeMod;
*((uint8_t*)&beforeMod) = before;
MODIFIERKEYS afterMod;
*((uint8_t*)&afterMod) = after;
//left
if(beforeMod.bmLeftCtrl != afterMod.bmLeftCtrl){
if(afterMod.bmLeftCtrl) Keyboard.press(KEY_LEFT_CTRL);
else Keyboard.release(KEY_LEFT_CTRL);
Serial.print("<ctrl "+(String)afterMod.bmLeftCtrl+">");
}
if(beforeMod.bmLeftShift != afterMod.bmLeftShift){
if(afterMod.bmLeftShift) Keyboard.press(KEY_LEFT_SHIFT);
else Keyboard.release(KEY_LEFT_SHIFT);
shift = afterMod.bmLeftShift;
//Serial.print("<shift "+(String)afterMod.bmLeftShift+">");
}
if(beforeMod.bmLeftAlt != afterMod.bmLeftAlt){
if(afterMod.bmLeftAlt) Keyboard.press(KEY_LEFT_ALT);
else Keyboard.release(KEY_LEFT_ALT);
Serial.print("<alt "+(String)afterMod.bmLeftAlt+">");
}
if(beforeMod.bmLeftGUI != afterMod.bmLeftGUI){
if(afterMod.bmLeftGUI) Keyboard.press(KEY_LEFT_GUI);
else Keyboard.release(KEY_LEFT_GUI);
Serial.print("<gui "+(String)afterMod.bmLeftGUI+">");
}
//right
if(beforeMod.bmRightCtrl != afterMod.bmRightCtrl){
if(afterMod.bmRightCtrl) Keyboard.press(KEY_RIGHT_CTRL);
else Keyboard.release(KEY_RIGHT_CTRL);
Serial.print("<ctrl "+(String)afterMod.bmRightCtrl+">");
}
if(beforeMod.bmRightShift != afterMod.bmRightShift){
if(afterMod.bmRightShift) Keyboard.press(KEY_RIGHT_SHIFT);
else Keyboard.release(KEY_RIGHT_SHIFT);
shift = afterMod.bmLeftShift;
//Serial.print("<shift "+(String)afterMod.bmRightShift+">");
}
if(beforeMod.bmRightAlt != afterMod.bmRightAlt){
if(afterMod.bmRightAlt) Keyboard.press(KEY_RIGHT_ALT);
else Keyboard.release(KEY_RIGHT_ALT);
Serial.print("<alt "+(String)afterMod.bmRightAlt+">");
}
if(beforeMod.bmRightGUI != afterMod.bmRightGUI){
if(afterMod.bmRightGUI) Keyboard.press(KEY_RIGHT_GUI);
else Keyboard.release(KEY_RIGHT_GUI);
Serial.print("<gui "+(String)afterMod.bmRightGUI+">");
}
}
void KbdRptParser::OnKeyPressed(uint8_t key){
/*Serial.print("ASCII: \"");
Serial.print((char)key);
Serial.print("\" = 0x");
Serial.print(key, HEX);
Serial.print("; ");*/
};
uint8_t KbdRptParser::_parse(uint8_t key){
/*
Serial.print("0x");
Serial.print(key, HEX);
Serial.print(" = ");*/
switch(key){
case CAPS_LOCK: return KEY_CAPS_LOCK; break; // CAPS
case NUM_LOCK: return KEY_NUM_LOCK; break; // NUM LOCK
case SCROLL_LOCK: return KEY_SCROLL_LOCK; break; // SCROLL LOCK
case PRINT_SCREEN: return KEY_PRINT_SCREEN; break; // PRINT SCREEN
case NUM_1 : if (!num_lock) return KEY_NUM_1; break;
case NUM_2 : if (!num_lock) return KEY_NUM_2; break;
case NUM_3 : if (!num_lock) return KEY_NUM_3; break;
case NUM_4 : if (!num_lock) return KEY_NUM_4; break;
case NUM_5 : if (!num_lock) return KEY_NUM_5; break;
case NUM_6 : if (!num_lock) return KEY_NUM_6; break;
case NUM_7 : if (!num_lock) return KEY_NUM_7; break;
case NUM_8 : if (!num_lock) return KEY_NUM_8; break;
case NUM_9 : if (!num_lock) return KEY_NUM_9; break;
case NUM_0 : if (!num_lock) return KEY_NUM_0; break;
case 0x2C: return 0x20; break; // SPACE
case 40: return KEY_RETURN; break;
case 41: return KEY_ESC; break;
case 42: return KEY_BACKSPACE; break;
case 43: return KEY_TAB; break;
case 58: return KEY_F1; break;
case 59: return KEY_F2; break;
case 60: return KEY_F3; break;
case 61: return KEY_F4; break;
case 62: return KEY_F5; break;
case 63: return KEY_F6; break;
case 64: return KEY_F7; break;
case 65: return KEY_F8; break;
case 66: return KEY_F9; break;
case 67: return KEY_F10; break;
case 68: return KEY_F11; break;
case 69: return KEY_F12; break;
case 73: return KEY_INSERT; break;
case 74: return KEY_HOME; break;
case 75: return KEY_PAGE_UP; break;
case 76: return KEY_DELETE; break;
case 77: return KEY_END; break;
case 78: return KEY_PAGE_DOWN; break;
case 79: return KEY_RIGHT_ARROW; break;
case 80: return KEY_LEFT_ARROW; break;
case 81: return KEY_DOWN_ARROW; break;
case 82: return KEY_UP_ARROW; break;
case 88: return KEY_RETURN; break;
//=====[DE-Keyboard]=====//
case 0x64: return 236; break; // <
case 0x32: return 92; break; // #
//======================//
default: {
//Serial.print(" N/A ");
return key;
}
}
}
String KbdRptParser::_getChar(uint8_t key){
switch(key){
case CAPS_LOCK: return "<CAPS_LOCK>"; break; // CAPS
case NUM_LOCK: return "<NUM_LOCK>"; break; // NUM LOCK
case SCROLL_LOCK: return "<SCROLL_LOCK>"; break; // SCROLL LOCK
case PRINT_SCREEN: return "<PRINT_SCREEN>"; break; // PRINT SCREEN
//case NUM_1 : if (num_lock) return "<NUM_1>"; break;
//case NUM_2 : if (num_lock) return "<NUM_2>"; break;
//case NUM_3 : if (num_lock) return "<NUM_3>"; break;
//case NUM_4 : if (num_lock) return "<NUM_4>"; break;
//case NUM_5 : if (num_lock) return "<NUM_5>"; break;
//case NUM_6 : if (num_lock) return "<NUM_6>"; break;
//case NUM_7 : if (num_lock) return "<NUM_7>"; break;
//case NUM_8 : if (num_lock) return "<NUM_8>"; break;
//case NUM_9 : if (num_lock) return "<NUM_9>"; break;
//case NUM_0 : if (num_lock) return "<NUM_0>"; break;
case 0x2C: return " "; break;
case 40: return "<RETURN>\n"; break;
case 41: return "<ESC>\n"; break;
case 42: return "<BACKSPCAE>"; break;
case 43: return "<TAB>\n"; break;
case 58: return "<F1>\n"; break;
case 59: return "<F2>\n"; break;
case 60: return "<F3>\n"; break;
case 61: return "<F4>\n"; break;
case 62: return "<F5>\n"; break;
case 63: return "<F6>\n"; break;
case 64: return "<F7>\n"; break;
case 65: return "<F8>\n"; break;
case 66: return "<F9>\n"; break;
case 67: return "<F10>\n"; break;
case 68: return "<F11>\n"; break;
case 69: return "<F12>\n"; break;
case 73: return "<INSERT>"; break;
case 74: return "<HOME>\n"; break;
case 75: return "<PAGE_UP>\n"; break;
case 76: return "<DELETE>"; break;
case 77: return "<END>\n"; break;
case 78: return "<PAGE_DOWN>\n"; break;
case 79: return "<RIGHT_ARROW>\n"; break;
case 80: return "<LEFT_ARROW>\n"; break;
case 81: return "<DOWN_ARROW>\n"; break;
case 82: return "<UP_ARROW>\n"; break;
case 88: return "<RETURN>\n"; break;
//=====[DE-Keyboard]=====//
case 0x64: {
if(shift) return "<";
else return ">";
break;
}
case 0x32:{
if(shift) return "'";
else return "#";
break;
}
//======================//
default: {
return "";
}
}
}
void KbdRptParser::_press(uint8_t key){
/*Serial.print("0x");
Serial.print(key, HEX);
Serial.println(" DOWN");*/
Keyboard.press(key);
}
void KbdRptParser::_release(uint8_t key){
/*Serial.print("0x");
Serial.print(key, HEX);
Serial.println(" UP");
Serial.println();*/
Keyboard.release(key);
}
KbdRptParser parser;
void Line(String _line)
{
int firstSpace = _line.indexOf(" ");
if(firstSpace == -1) Press(_line);
else if(_line.substring(0,firstSpace) == "STRING"){
for(int i=firstSpace+1;i<_line.length();i++) Keyboard.write(_line[i]);
}
else if(_line.substring(0,firstSpace) == "DELAY"){
int delaytime = _line.substring(firstSpace + 1).toInt();
delay(delaytime);
}
else if(_line.substring(0,firstSpace) == "DEFAULTDELAY") defaultDelay = _line.substring(firstSpace + 1).toInt();
else if(_line.substring(0,firstSpace) == "REM"){} //nothing :/
else if(_line.substring(0,firstSpace) == "REPLAY") {
int replaynum = _line.substring(firstSpace + 1).toInt();
while(replaynum)
{
Line(last);
--replaynum;
}
} else{
String remain = _line;
while(remain.length() > 0){
int latest_space = remain.indexOf(" ");
if (latest_space == -1){
Press(remain);
remain = "";
}
else{
Press(remain.substring(0, latest_space));
remain = remain.substring(latest_space + 1);
}
delay(5);
}
}
Keyboard.releaseAll();
delay(defaultDelay);
}
void Press(String b){
if(b.length() == 1) Keyboard.press(char(b[0]));
else if (b.equals("ENTER")) Keyboard.press(KEY_RETURN);
else if (b.equals("CTRL")) Keyboard.press(KEY_LEFT_CTRL);
else if (b.equals("SHIFT")) Keyboard.press(KEY_LEFT_SHIFT);
else if (b.equals("ALT")) Keyboard.press(KEY_LEFT_ALT);
else if (b.equals("GUI")) Keyboard.press(KEY_LEFT_GUI);
else if (b.equals("UP") || b.equals("UPARROW")) Keyboard.press(KEY_UP_ARROW);
else if (b.equals("DOWN") || b.equals("DOWNARROW")) Keyboard.press(KEY_DOWN_ARROW);
else if (b.equals("LEFT") || b.equals("LEFTARROW")) Keyboard.press(KEY_LEFT_ARROW);
else if (b.equals("RIGHT") || b.equals("RIGHTARROW")) Keyboard.press(KEY_RIGHT_ARROW);
else if (b.equals("DELETE")) Keyboard.press(KEY_DELETE);
else if (b.equals("PAGEUP")) Keyboard.press(KEY_PAGE_UP);
else if (b.equals("PAGEDOWN")) Keyboard.press(KEY_PAGE_DOWN);
else if (b.equals("HOME")) Keyboard.press(KEY_HOME);
else if (b.equals("ESC")) Keyboard.press(KEY_ESC);
else if (b.equals("BACKSPACE")) Keyboard.press(KEY_BACKSPACE);
else if (b.equals("INSERT")) Keyboard.press(KEY_INSERT);
else if (b.equals("TAB")) Keyboard.press(KEY_TAB);
else if (b.equals("END")) Keyboard.press(KEY_END);
else if (b.equals("CAPSLOCK")) Keyboard.press(KEY_CAPS_LOCK);
else if (b.equals("F1")) Keyboard.press(KEY_F1);
else if (b.equals("F2")) Keyboard.press(KEY_F2);
else if (b.equals("F3")) Keyboard.press(KEY_F3);
else if (b.equals("F4")) Keyboard.press(KEY_F4);
else if (b.equals("F5")) Keyboard.press(KEY_F5);
else if (b.equals("F6")) Keyboard.press(KEY_F6);
else if (b.equals("F7")) Keyboard.press(KEY_F7);
else if (b.equals("F8")) Keyboard.press(KEY_F8);
else if (b.equals("F9")) Keyboard.press(KEY_F9);
else if (b.equals("F10")) Keyboard.press(KEY_F10);
else if (b.equals("F11")) Keyboard.press(KEY_F11);
else if (b.equals("F12")) Keyboard.press(KEY_F12);
else if (b.equals("SPACE")) Keyboard.press(' ');
//else Serial.println("not found :'"+b+"'("+String(b.length())+")");
}
void setup()
{
Serial.begin(115200);
//Serial1.begin(115200);
Keyboard.begin();
delay(2000);
pinMode(LED_BUILTIN, OUTPUT);
// Turn signal LED off
digitalWrite(LED_BUILTIN, LOW);
//Serial1.println("\n\nLogging keys...\n");
/*
for(int i=0;i<256;i++){
int key = parser._parse(i);
if(key == i){
Keyboard.print((String)i+" ");
Keyboard.write(i);
delay(200);
Keyboard.write(KEY_RETURN);
}
}*/
if(Usb.Init() == -1) Serial.println("OSC did not start.");
delay(200);
next_time = millis() + 5000;
HidKeyboard.SetReportParser(0, &parser);
}
void loop(){
Usb.Task();
if(Serial.available()) {
bufferStr = Serial.readStringUntil("END");
//Serial.println(bufferStr);
}
if(bufferStr.length() > 0){
bufferStr.replace("\r","\n");
bufferStr.replace("\n\n","\n");
while(bufferStr.length() > 0){
int latest_return = bufferStr.indexOf("\n");
if(latest_return == -1){
//Serial.println("run: "+bufferStr);
Line(bufferStr);
bufferStr = "";
} else{
//Serial.println("run: '"+bufferStr.substring(0, latest_return)+"'");
Line(bufferStr.substring(0, latest_return));
last=bufferStr.substring(0, latest_return);
bufferStr = bufferStr.substring(latest_return + 1);
}
}
bufferStr = "";
Serial.write(0x99);
//Serial.println("done");
}
}

View File

@@ -247,6 +247,18 @@ PROGMEM static const unsigned char menu_icons[][66] = {
0x7F, 0x00, 0x3F, 0x5F, 0x7F, 0x3D, 0x7F, 0x71, 0x3F, 0x5F, 0x77, 0x3D,
0x7F, 0x7F, 0x3F, 0x5F, 0x71, 0x3D, 0x7F, 0x75, 0x3F, 0x5F, 0x7F, 0x3D,
0x7F, 0x7F, 0x3F, 0x5F, 0x00, 0x3D, 0xFF, 0xFF, 0x3F, 0x5F, 0x55, 0x3D,
0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F},
{0xFF, 0xFF, 0x3F, 0xFF, 0xF3, 0x3F, 0xFF, 0xF3, 0x3F, 0xFF, 0xF3, 0x3F, // BAD_USB_ICO: 33
0xFF, 0xF3, 0x3F, 0xFF, 0x13, 0x3F, 0x7F, 0x13, 0x3F, 0x3F, 0x92, 0x3F,
0x3F, 0xB2, 0x3F, 0x7F, 0x93, 0x3F, 0x7F, 0xD3, 0x3F, 0x7F, 0xE3, 0x3F,
0x7F, 0xF2, 0x3F, 0xFF, 0xF0, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF3, 0x3F,
0xFF, 0xF3, 0x3F, 0xFF, 0xF3, 0x3F, 0xFF, 0xE1, 0x3F, 0xFF, 0xE1, 0x3F,
0xFF, 0xE1, 0x3F, 0xFF, 0xF3, 0x3F},
{0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, // TEST_BAD_USB_ICO: 34
0xFF, 0xFF, 0x3F, 0xFF, 0xC1, 0x33, 0xFF, 0xBE, 0x3B, 0x7F, 0xFF, 0x3D,
0xBF, 0xFF, 0x3C, 0xDF, 0x7F, 0x3C, 0xDF, 0x3F, 0x3D, 0xEF, 0x9F, 0x3D,
0x1F, 0xCE, 0x3D, 0xDF, 0xE4, 0x3D, 0xBF, 0xF1, 0x3E, 0x7F, 0x7F, 0x3F,
0xFF, 0xBE, 0x3F, 0xFF, 0xC1, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F,
0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F}
};

View File

@@ -64,7 +64,7 @@
//#define MENU_FONT &FreeMonoBold9pt7b
//#define MENU_FONT &FreeSans9pt7b
//#define MENU_FONT &FreeSansBold9pt7b
#define BUTTON_ARRAY_LEN 7
#define BUTTON_ARRAY_LEN 8
#define STATUS_BAR_WIDTH 16
#define LVGL_TICK_PERIOD 6

View File

@@ -686,6 +686,7 @@ void MenuFunctions::RunSetup()
// Main menu stuff
wifiMenu.list = new LinkedList<MenuNode>(); // Get list in second menu ready
bluetoothMenu.list = new LinkedList<MenuNode>(); // Get list in third menu ready
badusbMenu.list = new LinkedList<MenuNode>();
generalMenu.list = new LinkedList<MenuNode>();
deviceMenu.list = new LinkedList<MenuNode>();
@@ -699,13 +700,11 @@ void MenuFunctions::RunSetup()
// WiFi menu stuff
wifiSnifferMenu.list = new LinkedList<MenuNode>();
wifiScannerMenu.list = new LinkedList<MenuNode>();
wifiAttackMenu.list = new LinkedList<MenuNode>();
wifiGeneralMenu.list = new LinkedList<MenuNode>();
// Bluetooth menu stuff
bluetoothSnifferMenu.list = new LinkedList<MenuNode>();
bluetoothScannerMenu.list = new LinkedList<MenuNode>();
bluetoothGeneralMenu.list = new LinkedList<MenuNode>();
// Settings stuff
@@ -717,6 +716,7 @@ void MenuFunctions::RunSetup()
// Work menu names
mainMenu.name = " ESP32 Marauder ";
wifiMenu.name = " WiFi ";
badusbMenu.name = " Bad USB ";
deviceMenu.name = " Device ";
generalMenu.name = " General Apps ";
failedUpdateMenu.name = " Updating... ";
@@ -727,11 +727,9 @@ void MenuFunctions::RunSetup()
infoMenu.name = " Device Info ";
bluetoothMenu.name = " Bluetooth ";
wifiSnifferMenu.name = " WiFi Sniffers ";
wifiScannerMenu.name = " WiFi Scanners";
wifiAttackMenu.name = " WiFi Attacks ";
wifiGeneralMenu.name = " WiFi General ";
bluetoothSnifferMenu.name = " Bluetooth Sniffers ";
bluetoothScannerMenu.name = " Bluetooth Scanners ";
bluetoothGeneralMenu.name = " Bluetooth General ";
shutdownWiFiMenu.name = " Shutdown WiFi ";
shutdownBLEMenu.name = " Shutdown BLE ";
@@ -747,6 +745,9 @@ void MenuFunctions::RunSetup()
addNodes(&mainMenu, "Bluetooth", TFT_CYAN, NULL, BLUETOOTH, [this]() {
changeMenu(&bluetoothMenu);
});
addNodes(&mainMenu, "Bad USB", TFT_RED, NULL, BAD_USB_ICO, [this]() {
changeMenu(&badusbMenu);
});
addNodes(&mainMenu, "General Apps", TFT_MAGENTA, NULL, GENERAL_APPS, [this]() {
changeMenu(&generalMenu);
});
@@ -765,9 +766,9 @@ void MenuFunctions::RunSetup()
addNodes(&wifiMenu, "Sniffers", TFT_YELLOW, NULL, SNIFFERS, [this]() {
changeMenu(&wifiSnifferMenu);
});
addNodes(&wifiMenu, "Scanners", TFT_ORANGE, NULL, SCANNERS, [this]() {
changeMenu(&wifiScannerMenu);
});
//addNodes(&wifiMenu, "Scanners", TFT_ORANGE, NULL, SCANNERS, [this]() {
// changeMenu(&wifiScannerMenu);
//});
addNodes(&wifiMenu, "Attacks", TFT_RED, NULL, ATTACKS, [this]() {
changeMenu(&wifiAttackMenu);
});
@@ -795,24 +796,18 @@ void MenuFunctions::RunSetup()
this->drawStatusBar();
wifi_scan_obj.StartScan(WIFI_SCAN_DEAUTH, TFT_RED);
});
// Build WiFi scanner Menu
wifiScannerMenu.parentMenu = &wifiMenu; // Main Menu is second menu parent
addNodes(&wifiScannerMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
changeMenu(wifiScannerMenu.parentMenu);
});
addNodes(&wifiScannerMenu, "Packet Monitor", TFT_BLUE, NULL, PACKET_MONITOR, [this]() {
addNodes(&wifiSnifferMenu, "Packet Monitor", TFT_BLUE, NULL, PACKET_MONITOR, [this]() {
wifi_scan_obj.StartScan(WIFI_PACKET_MONITOR, TFT_BLUE);
});
addNodes(&wifiScannerMenu, "EAPOL/PMKID Scan", TFT_VIOLET, NULL, EAPOL, [this]() {
addNodes(&wifiSnifferMenu, "EAPOL/PMKID Scan", TFT_VIOLET, NULL, EAPOL, [this]() {
wifi_scan_obj.StartScan(WIFI_SCAN_EAPOL, TFT_VIOLET);
});
addNodes(&wifiScannerMenu, "Detect Pwnagotchi", TFT_RED, NULL, PWNAGOTCHI, [this]() {
addNodes(&wifiSnifferMenu, "Detect Pwnagotchi", TFT_RED, NULL, PWNAGOTCHI, [this]() {
display_obj.clearScreen();
this->drawStatusBar();
wifi_scan_obj.StartScan(WIFI_SCAN_PWN, TFT_RED);
});
addNodes(&wifiScannerMenu, "Detect Espressif", TFT_ORANGE, NULL, ESPRESSIF, [this]() {
addNodes(&wifiSnifferMenu, "Detect Espressif", TFT_ORANGE, NULL, ESPRESSIF, [this]() {
display_obj.clearScreen();
this->drawStatusBar();
wifi_scan_obj.StartScan(WIFI_SCAN_ESPRESSIF, TFT_ORANGE);
@@ -896,9 +891,9 @@ void MenuFunctions::RunSetup()
addNodes(&bluetoothMenu, "Sniffers", TFT_YELLOW, NULL, SNIFFERS, [this]() {
changeMenu(&bluetoothSnifferMenu);
});
addNodes(&bluetoothMenu, "Scanners", TFT_ORANGE, NULL, SCANNERS, [this]() {
changeMenu(&bluetoothScannerMenu);
});
//addNodes(&bluetoothMenu, "Scanners", TFT_ORANGE, NULL, SCANNERS, [this]() {
// changeMenu(&bluetoothScannerMenu);
//});
addNodes(&bluetoothMenu, "General", TFT_PURPLE, NULL, GENERAL_APPS, [this]() {
changeMenu(&bluetoothGeneralMenu);
});
@@ -913,18 +908,18 @@ void MenuFunctions::RunSetup()
this->drawStatusBar();
wifi_scan_obj.StartScan(BT_SCAN_ALL, TFT_GREEN);
});
// Build bluetooth scanner Menu
bluetoothScannerMenu.parentMenu = &bluetoothMenu; // Second Menu is third menu parent
addNodes(&bluetoothScannerMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
changeMenu(bluetoothScannerMenu.parentMenu);
});
addNodes(&bluetoothScannerMenu, "Detect Card Skimmers", TFT_MAGENTA, NULL, CC_SKIMMERS, [this]() {
addNodes(&bluetoothSnifferMenu, "Detect Card Skimmers", TFT_MAGENTA, NULL, CC_SKIMMERS, [this]() {
display_obj.clearScreen();
this->drawStatusBar();
wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);
});
// Build bluetooth scanner Menu
//bluetoothScannerMenu.parentMenu = &bluetoothMenu; // Second Menu is third menu parent
//addNodes(&bluetoothScannerMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
// changeMenu(bluetoothScannerMenu.parentMenu);
//});
// Build bluetooth general menu
bluetoothGeneralMenu.parentMenu = &bluetoothMenu;
addNodes(&bluetoothGeneralMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
@@ -941,6 +936,15 @@ void MenuFunctions::RunSetup()
changeMenu(shutdownBLEMenu.parentMenu);
});
// Bad USB Menu
badusbMenu.parentMenu = &mainMenu;
addNodes(&badusbMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
changeMenu(badusbMenu.parentMenu);
});
addNodes(&badusbMenu, "Test BadUSB", TFT_PURPLE, NULL, TEST_BAD_USB_ICO, [this]() {
a32u4_obj.test();
});
// General apps menu
generalMenu.parentMenu = &mainMenu;
addNodes(&generalMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {

View File

@@ -9,6 +9,7 @@
#include "SDInterface.h"
#include "Web.h"
#include "esp_interface.h"
#include "a32u4_interface.h"
extern Display display_obj;
@@ -17,6 +18,7 @@ extern Web web_obj;
extern SDInterface sd_obj;
extern BatteryInterface battery_obj;
extern EspInterface esp_obj;
extern A32u4Interface a32u4_obj;
// Keypad start position, key sizes and spacing
#define KEY_X 120 // Centre of key
@@ -73,6 +75,8 @@ extern EspInterface esp_obj;
#define KEYBOARD_ICO 30
#define JOIN_WIFI 31
#define ESP_UPDATE_ICO 32
#define BAD_USB_ICO 33
#define TEST_BAD_USB_ICO 34
PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
@@ -123,6 +127,7 @@ class MenuFunctions
Menu wifiMenu;
Menu bluetoothMenu;
Menu badusbMenu;
Menu generalMenu;
Menu deviceMenu;
@@ -136,13 +141,11 @@ class MenuFunctions
// WiFi menu stuff
Menu wifiSnifferMenu;
Menu wifiScannerMenu;
Menu wifiAttackMenu;
Menu wifiGeneralMenu;
// Bluetooth menu stuff
Menu bluetoothSnifferMenu;
Menu bluetoothScannerMenu;
Menu bluetoothGeneralMenu;
// Settings things menus

View File

@@ -0,0 +1,32 @@
#include "a32u4_interface.h"
HardwareSerial MySerial_two(2);
void A32u4Interface::begin() {
MySerial_two.begin(BAUD32U4, SERIAL_8N1, 25, 4);
Serial.println("Setup A32U4 Serial Interface");
this->initTime = millis();
}
void A32u4Interface::test() {
MySerial_two.println("STRING Hello, World!");
}
void A32u4Interface::main(uint32_t current_time) {
/*
if (current_time - this->initTime >= 1000) {
this->initTime = millis();
MySerial_two.write("PING");
delay(1);
if (MySerial_two.available()) {
Serial.println("Got A32U4 Serial data");
Serial.println(MySerial_two.readString());
}
}
//delay(1);*/
}

View File

@@ -0,0 +1,23 @@
#ifndef a32u4_interface_h
#define a32u4_interface_h
#include "Display.h"
#include <HardwareSerial.h>
#define BAUD32U4 115200
extern Display display_obj;
class A32u4Interface {
public:
bool supported = false;
uint32_t initTime;
void begin();
void main(uint32_t current_time);
void test();
};
#endif

View File

@@ -27,6 +27,7 @@ https://www.online-utility.org/image/convert/to/XBM
#include "TemperatureInterface.h"
#include "LedInterface.h"
#include "esp_interface.h"
#include "a32u4_interface.h"
//#include "icons.h"
/*
@@ -50,6 +51,7 @@ BatteryInterface battery_obj;
TemperatureInterface temp_obj;
LedInterface led_obj;
EspInterface esp_obj;
A32u4Interface a32u4_obj;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(Pixels, PIN, NEO_GRB + NEO_KHZ800);
@@ -71,9 +73,11 @@ void setup()
Serial.begin(115200);
Serial.begin(115200);
//Serial.begin(115200);
esp_obj.begin();
a32u4_obj.begin();
display_obj.RunSetup();
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
@@ -185,6 +189,7 @@ void loop()
battery_obj.main(currentTime);
temp_obj.main(currentTime);
esp_obj.main(currentTime);
a32u4_obj.main(currentTime);
//led_obj.main(currentTime);
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
if ((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) &&

View File

@@ -12,7 +12,9 @@ void EspInterface::begin() {
MySerial.begin(BAUD, SERIAL_8N1, 27, 26);
this->bootRunMode();
//this->bootRunMode();
this->initTime = millis();
}
void EspInterface::RunUpdate() {
@@ -71,6 +73,11 @@ void EspInterface::program() {
}
void EspInterface::main(uint32_t current_time) {
if (current_time - this->initTime >= 1000) {
this->initTime = millis();
MySerial.write("PING");
}
if (MySerial.available()) {
Serial.write((uint8_t)MySerial.read());
}

View File

@@ -14,6 +14,8 @@ class EspInterface {
public:
bool supported = false;
uint32_t initTime;
void RunUpdate();
void bootProgramMode();
void bootRunMode();

BIN
pictures/icons/badusb.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

9
pictures/xbm/badusb.XBM Normal file
View File

@@ -0,0 +1,9 @@
#define 1617929519824_width 22
#define 1617929519824_height 22
static char 1617929519824_bits[] = {
0xFF, 0xFF, 0x3F, 0xFF, 0xF3, 0x3F, 0xFF, 0xF3, 0x3F, 0xFF, 0xF3, 0x3F,
0xFF, 0xF3, 0x3F, 0xFF, 0x13, 0x3F, 0x7F, 0x13, 0x3F, 0x3F, 0x92, 0x3F,
0x3F, 0xB2, 0x3F, 0x7F, 0x93, 0x3F, 0x7F, 0xD3, 0x3F, 0x7F, 0xE3, 0x3F,
0x7F, 0xF2, 0x3F, 0xFF, 0xF0, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF3, 0x3F,
0xFF, 0xF3, 0x3F, 0xFF, 0xF3, 0x3F, 0xFF, 0xE1, 0x3F, 0xFF, 0xE1, 0x3F,
0xFF, 0xE1, 0x3F, 0xFF, 0xF3, 0x3F, };

View File

@@ -0,0 +1,9 @@
#define 1617929836316_width 22
#define 1617929836316_height 22
static char 1617929836316_bits[] = {
0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F,
0xFF, 0xFF, 0x3F, 0xFF, 0xC1, 0x33, 0xFF, 0xBE, 0x3B, 0x7F, 0xFF, 0x3D,
0xBF, 0xFF, 0x3C, 0xDF, 0x7F, 0x3C, 0xDF, 0x3F, 0x3D, 0xEF, 0x9F, 0x3D,
0x1F, 0xCE, 0x3D, 0xDF, 0xE4, 0x3D, 0xBF, 0xF1, 0x3E, 0x7F, 0x7F, 0x3F,
0xFF, 0xBE, 0x3F, 0xFF, 0xC1, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F,
0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, };