Writing a BadUSB script is super easy and can be learned in just 5 minutes. You can write a script in any text editor. The syntax is based on duckyscript
The best way to learn how to script is to dissect some scripts! The below script simply opens up notepad and types It's super easy to script for MalDuino!
LOCALE US
DELAY 1000
GUI r
STRING notepad
ENTER
DELAY 500
STRING It's super easy to script for MalDuino!
LOCALE US
The LOCALE
command is used to set the keyboard language of the target pc. Currently supported languages: DE, GB, US, ES, FR, DK, RU
DELAY 1000
the DELAY
command is used to tell MalDuino to wait a specified number of milliseconds, there’re 1000 milliseconds in a second, so this command tells MalDuino to wait a second before it does anything else. Delays are important as you may have to wait for a certain task on the target pc to complete before you can run another command, in this example we need to wait a second for the computer to initialise the MalDuino once we plug it in.
GUI r
This command presses WIN + r, opening a run prompt. The GUI
command by itself presses the windows key on windows, cmd on MacOS, etc. Adding in the r
simply presses these two keys in combination, you could replace the r
with another key instead if your circumstances require it
STRING notepad
The STRING
command is simply used to type something, anything
ENTER
This simply presses the enter key
DELAY 500
Again, we’re using a delay here as we need to tell the MalDuino to wait a moment for notepad to open before we can act on it (500 milliseconds = half a second)
STRING It's super easy to script for MalDuino!
Just typing out some text
The end result is as below!
Some commands concern only the running of the MalDuino itself and do not effect the characters typed
Command | Parameters | Notes |
---|---|---|
LOCALE |
DE, GB, US, ES, FR, DK, RU |
Sets the keyboard language MalDuino should use |
DELAY |
0-> | Defines a delay (milliseconds) |
DEFAULTDELAY |
0-> | Defines a default delay for all subsequent commands, default: 5 (milliseconds) |
DEFAULTCHARDELAY |
0-> | Defines how long each key should be pressed, default: 5 (milliseconds) |
REPEAT |
0-> | Repeat the previous command x times |
REM |
a…z A…Z 0..9 !…) `~ += _- “’ :; <, >. ?/ \ | | Defines a comment - The MalDuino interpreter will ignore this line |
Some commands can form combos, this is useful when you want to press 2 keys at once; for example the command: CTRL a
would press CTRL AND a
simultaneously
We call CTRL
, ALT
, SHIFT
(to name a few), modifier keys because they modify the normal function of another key. Modifer keys must always be in CAPS. Modifer keys must be used as follows:
MODIFIER_KEY [MODIFIER_KEY2, MODIFIER_KEY3...] KEY
, alternatively they can be used as a standalone command
Below are the modifier keys and some examples:
Command | Combo examples |
---|---|
CTRL |
CTRL a , CTRL SHIFT DELETE |
SHIFT |
SHIFT w |
ALT |
ALT p |
ALT_RIGHT |
ALT_RIGHT x |
GUI |
GUI l |
MalDuino can press any key a keyboard can, below is the full list of other compatible commands
Command | Notes |
---|---|
STRING |
Used via STRING [a...z A...Z 0..9 !...) \~ += _- "' :; <, >. ?/ \ \|] |
ENTER |
|
CAPSLOCK |
|
DELETE |
|
END |
|
ESC |
|
HOME |
|
INSERT |
|
PAGEUP |
|
PAGEDOWN |
|
SPACE |
|
TAB |
|
BACKSPACE |
|
UP |
|
DOWN |
|
LEFT |
|
RIGHT |
|
PRINTSCREEN |
|
F1 ... F12 |
|
NUM_0 ... NUM_0 |
Refers to numpad keys |
NUM_ASTERIX |
|
NUM_ENTER |
|
NUM_Minus |
|
NUM_PERIOD |
|
NUM_PLUS |