DuckyScript
termKept in this browser · My desk
The scripting language of Hak5's USB Rubber Ducky and related tools, compiled into a binary payload that the device types as keystrokes.
Hak5 says the language began in 2010 with three commands, keystroke injection and delays among them, was coupled with the Bash shell on the Bash Bunny in 2017, and became a structured language, DuckyScript 3.0, with the 2022 Ducky; Mischief Gadgets licenses it for the O.MG devices.
Basics. Each line is processed in order: REM for a comment, DELAY for a pause in milliseconds, STRING to type characters (with Shift held for capitals), and named keys such as ENTER or key combinations such as WINDOWS r. Compilation. Payload Studio compiles the source into inject.bin, using a Language File that maps characters to key codes for a given keyboard language, so a payload must match the target's layout. Version 3.0. Adds ATTACKMODE (keyboard, storage, both or off, with identifier spoofing), variables, conditionals, loops, functions, extensions, randomization and jitter, a random delay between key presses with a 20 ms default maximum. Device dialects. On the Bash Bunny the same commands sit inside Bash scripts and select serial, Ethernet, storage and keyboard modes; the Key Croc and the Shark Jack use their own dialects.
Also known as: Ducky Script, DuckyScript 3.0
Sources
- Hak5 documentation, USB Rubber Ducky (read 2026-11-16): originally three commands; DuckyScript 1.0 (2010) a macro language of keystrokes and delays; coupled with Bash on the Bash Bunny (2017); 3.0 (2022) adds conditionals, loops, functions, extensions; licensed to the O.MG platform by Mischief Gadgets
- Hak5 documentation, Hello, World! (read 2026-11-16): REM, DELAY, STRING and special keys; compilation to inject.bin in Payload Studio; the Language File per keyboard language
- Hak5 documentation, Jitter (read 2026-11-16): randomized delay between key presses, 20 ms default maximum
- Hak5 documentation, Bash Bunny ATTACKMODE (read 2026-11-16): DuckyScript command choosing serial, RNDIS or ECM Ethernet, storage and HID; default VID 0xF000 per mode combination