Introduction to DuckyScript

Introduction to DuckyScript

DuckyScript is a lightweight scripting language designed to automate keyboard input. Originally used in the USB Rubber Ducky, it has since become a versatile language for various HID (Human Interface Device) injection tools, including the NJCTR3000.

DuckyScript allows you to automate tasks by emulating a keyboard. It can type strings, use key combinations, and interact with systems in a way that is virtually indistinguishable from a physical keyboard.


What is a Payload?

A payload is a DuckyScript file that contains a series of commands designed to execute specific tasks. These files are simple text files with a .quack extension and are stored on the device’s SD card under the PAYLOADS folder.

When the NJCTR3000 is powered on, it can automatically execute a payload or allow you to trigger one remotely through Wi-Fi.


Structure of a DuckyScript File

A typical DuckyScript file consists of commands that are executed in sequence. Each line of the file represents one action or command. You can think of a DuckyScript payload as a list of instructions that the NJCTR3000 will follow.

Here’s an example of a simple DuckyScript payload:

DEFAULT_DELAY 100
REM This script opens Notepad and types a message
GUI r
DELAY 500
STRING notepad
ENTER
DELAY 1000
STRING Hello from NJCTR3000!
ENTER

Explanation:

Command Explanation
DEFAULT_DELAY 100 Sets a default delay of 100 milliseconds between each command.
REM Adds a comment in the script. This line is ignored during execution.
GUI r Simulates pressing the Windows key + R to open the Run dialog on Windows.
STRING notepad Types the word “notepad” into the Run dialog.
ENTER Simulates pressing the Enter key to launch Notepad.
DELAY 500 Waits for 500 milliseconds before the next command.
STRING Hello from NJCTR3000! Types a message into Notepad.
ENTER Simulates pressing Enter after typing the message.

How to Write DuckyScript

Writing DuckyScript is straightforward, as it consists of simple text-based commands that represent keypresses, delays, or strings. You’ll learn more about individual commands and how to use them in the following sections of this guide.

To get started, connecct to the NJCTR3000, and use the web based payload editor to create a new script and then test it agains the target environment. You can also manually edit paylaods .


Next, let’s dive into the Basic Syntax of DuckyScript.