This open-source project aims to provide a user-friendly tool to learn about keystroke injection attacks and 'BadUSBs'.
By emulating a USB keyboard, tools like this can gain full access to any computer with a USB port in a matter of seconds!
This is made possible by the fact that keyboards are trusted by computers. You can have full control over a computer with just a keyboard.
A BadUSB pretends to be a keyboard to the computer to send keystrokes.
But unlike a human, it can type hundreds of characters per second.
By using a simple scripting language, it's easy to make BadUSBs type whatever you want.
With the WiFi Duck, you can simply connect via WiFi to manage all scripts from within a web interface. This means that, unlike other BadUSBs, you don't need to install an app, log in, compile or copy scripts to an SD card.
File
> Preferences
.https://raw.githubusercontent.com/SpacehuhnTech/arduino/main/package_spacehuhn_index.json
. You can add multiple URLs, separating them with commas.Tools
> Board
> Board Manager
, search for wifi duck
and install WiFi Duck AVR Boards
and WiFi Duck ESP8266 Boards
.esp_duck/esp_duck.ino
with the Arduino IDE.Tools
> Board
in the WiFi Duck ESP8266
section, select your ESP8266atmegaduck/atmega_duck.ino
with the Arduino IDE.Tools
> Board
select the normal arduino leonardo (not the wifi duck one)Soldering
ESP8266 | Atmega32u4 |
---|---|
D1 alias GPIO 5 |
3 alias SCL |
D2 alias GPIO 4 |
2 alias SDA |
GND |
GND |
To properly debug, you need to have both the Atmega32u4 and the ESP8266 connected via USB to your computer.
That can be tricky when you only have a all in one board, so it might be useful you built one yourself. You don't need to solder it, for example you can use an Arduino Leonardo and a NodeMCU and connect them with jumper cables.
Now open 2 instances of Arduino (so they run as separate processes!), select the COM port and open the serial monitor for each device. You might need to reset the Atmega32u4 to see serial output. If that causes problems with the i2c connection, try to reset the ESP8266 too.
If you would like to modify the web interface, you can!
The web/
folder contains all .html
, .css
, .js
files.
You can edit and test them locally as long as you're connected to the WiFi Duck
network thanks to the websocket connection handled by JavaScript in the background.
To get the new files onto the ESP8266, run python3 webconverter.py
in the
repository folder.
It gzips all files inside web/
, converts them into a hex array
and saves it in esp_duck/webfiles.h
.
Now you just need to flash the ESP8266 again.
Currently supported keyboard layouts:
All standard keys are defined in usb_hid_keys.h.
To translate a keyboard layout, you have to match each character on
your keyboard to the one(s) of a US keyboard.
This stuff is hard to explain in writing and requires a lot of manual work and testing.
#include "locale_xx.h"
to the end of the locales.h file.locale_xx.h
-> locale_de.h
,ascii_xx
-> ascii_de
,locale_xx
-> locale_de
,utf8_xx
-> utf8_de
.combinations_xx
-> combinations_de
, KEY_MOD_LSHIFT
, then a character key.
Some ASCII characters can't be typed or don't require a modifier,
that's where you must place KEY_NONE
.
Check usb_hid_keys.h for the available keys.KEY_MOD_RALT | KEY_MOD_LSHIFT
.Z
is saved as KEY_MOD_LSHIFT, KEY_Y
.ASCII_20
(20 in hexadecimal) is the 32th character in our ascii array. 0x84, KEY_NONE, KEY_APOSTROPHE, // ä
.~~ 0xc3, 0x84, 0x00, 0x00, KEY_MOD_LSHIFT, KEY_APOSTROPHE, // Ä
. // LOCALE (-> change keyboard layout)
you can see a bunch of else if statements.
You need to copy one for your layout. Before adding GB layout:
if (compare(w->str, w->len, "US", CASE_SENSETIVE)) {
keyboard::setLocale(&locale_us);
} else if (compare(w->str, w->len, "DE", CASE_SENSETIVE)) {
keyboard::setLocale(&locale_de);
}
After adding GB layout:
if (compare(w->str, w->len, "US", CASE_SENSETIVE)) {
keyboard::setLocale(&locale_us);
} else if (compare(w->str, w->len, "DE", CASE_SENSETIVE)) {
keyboard::setLocale(&locale_de);
} else if (compare(w->str, w->len, "GB", CASE_SENSETIVE)) {
keyboard::setLocale(&locale_gb);
}
LOCALE DE
STRING !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_abcdefghijklmnopqrstuvwxyz{|}~²³äöüÄÖÜ߀°§`
ENTER
This tool is intended to be used for testing, training, and educational purposes only.
Never use it to do harm or create damage!
The continuation of this project counts on you!
This software is licensed under the MIT License. See the license file for details.
https://github.com/SpacehuhnTech > For the Project https://github.com/todely > For the soldering solution https://github.com/robertio > For updating the ESP8266 Flashmode script https://github.com/nodemcu/nodemcu-flasher/blob/master/Win64/Release/ESP8266Flasher.exe > ESP8266 Flasher
Software libraries used in this project: