Simple Ducky Script

Overview

Ducky Script is a simple scripting language used in the Bad USB community. It was initially developed for the USB Rubber Ducky, a popular hardware keystroke injection tool. Ducky Script allows users to create scripts that emulate keyboard inputs and actions, effectively automating tasks or executing commands on a target system.

Ducky Script is composed of a series of commands, each representing a specific keystroke or action. These commands can include typing text, pressing special keys (such as Enter or Shift), delaying between commands, and executing complex sequences of actions. The syntax of Ducky Script is straightforward and easy to understand, making it accessible to both beginners and experienced users.

By programming Ducky Script onto a compatible Bad USB device, such as an Arduino board or a USB Rubber Ducky, the device can be used to simulate keyboard input on a target system. This can be useful for automation, penetration testing, or educational purposes. However, it's important to note that the use of Ducky Script or any keystroke injection tool must be done ethically and legally, with proper authorization and consent.

DuckyScript is the programming language of the USB Rubber Ducky, Hak5 hotplug attack gear and officially licensed devices (Trademark Hak5 LLC. Copyright © 2010 Hak5 LLC. All rights reserved.)

DuckyScript officially licensed and supported devices are backward compatible with previous versions, excluding any device-specific functionality.

E.g. DuckyScript 1.0 payloads written for the USB Rubber Ducky is valid DuckyScript 3.0 and will function on the New USB Rubber Ducky without modification

DuckyScript Version

Device Compatibility

1.0

Original USB Rubber Ducky (USB-A Only)

2.X

Bash Bunny, Key Croc, Packet Squirrel, LAN Turtle, Shark Jack, O.MG Devices

3.0

New USB Rubber Ducky (USB-A & USB-C)

How to write a Ducky Script?

To write a Ducky Script, which is a scripting language used for Rubber Ducky USB devices, follow these steps:

  1. Plan your script: Determine the actions you want the Rubber Ducky to perform when connected to a computer. This can include keystrokes, commands, delays, and other functions.

  2. Understand Ducky Script syntax: Familiarize yourself with the syntax of Ducky Script. It uses simple commands and symbols to specify key presses, delays, and other actions. For example, the "STRING" command is used to input text, the "DELAY" command adds a delay between commands, and the "REM" command allows you to add comments.

  3. Write your script: Using a text editor, create a new file and start writing your Ducky Script commands based on your planned actions. Each command should be written on a new line. You can use commands like "REM" for comments, "STRING" for inputting text, "DELAY" for adding delays, "ENTER" for pressing the Enter key, and more. Refer to the official Ducky Script documentation for a comprehensive list of available commands.

  4. Test and refine your script: Once you have written your Ducky Script, test it on a compatible Rubber Ducky device or by emulating it using software tools. Verify that the script performs the desired actions as expected. Make any necessary adjustments or refinements to your script if needed.

  5. Save your Ducky Script: Save your script with a ".txt" file extension or any other text file format.

YOU WILL FIND ALL COMMANDS AND CODE ON THOSE DOCUMENTATION:

YOU CAN ALSO USE CHAT GPT TO WRITE SIMPLE DUCKY SCRIPT

Hak5 Payload Studio (Community Version: Free)

PayloadStudio is used to generate ducky script for Hak5 USB rubber ducky

Ready Ducky Script To Use

YouTube Tutorials About Ducky Script

Several YouTube tutorials are accessible about ducky script:

Last updated