Basic Syntax

Basic Syntax

DuckyScript is a simple scripting language designed to automate keyboard input. Below is a guide to the basic syntax you’ll need to start writing your own payloads.


Comments

Use the REM command to add comments to your script. Comments are ignored during execution and are useful for documenting your code.

REM This is a comment
REM The following line types "Hello"
STRING Hello

Delays

The DELAY command pauses execution for a specified number of milliseconds. You can also set a default delay for all commands using DEFAULT_DELAY.

DELAY 1000
REM Waits for 1 second
STRING Hello World

Set a default delay between commands:

DEFAULT_DELAY 500
REM All commands will have a 500 ms delay
STRING First
STRING Second

Strings

The STRING command types a string of text as if you typed it on the keyboard. This is useful for inputting large amounts of text quickly.

STRING Welcome to NJCTR3000!

You can include variables in your script (specific to NJCTR3000):

STRING Connecting to Wi-Fi: {WIFI_SSID}

Repeats

The REPEAT command repeats the previous command a specified number of times.

STRING Hello!
ENTER
REPEAT 5
REM Presses ENTER 5 times

Combining Commands

You can combine the above commands to create more complex scripts. For example, a script that waits, types a message, and then presses Enter multiple times:

DEFAULT_DELAY 500
STRING Setting up your system...
ENTER
REPEAT 3

Next, learn about the Special Keys, which let you automate keyboard functions like CTRL, ALT, and the function keys.