> ## Documentation Index
> Fetch the complete documentation index at: https://stem-docs.intellectualpoint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PayloadStudio setup

> Set up PayloadStudio PRO, activate your license, and learn the DuckyScript language basics.

## What is PayloadStudio

**PayloadStudio** is the official development environment for writing USB Rubber Ducky payloads. Built by Hak5, it gives you everything you need to write, test, and compile DuckyScript code  -  all from your web browser.

<CardGroup cols={2}>
  <Card title="Syntax highlighting" icon="palette">
    DuckyScript commands are color-coded so you can quickly distinguish between comments, delays, key presses, and string inputs.
  </Card>

  <Card title="Error checking" icon="alert-triangle">
    PayloadStudio PRO highlights errors in your code before you compile  -  catching mistakes that would cause your payload to fail on the device.
  </Card>

  <Card title="Auto-complete" icon="code">
    Start typing a DuckyScript command and PayloadStudio suggests completions, helping you learn the language as you write.
  </Card>

  <Card title="One-click compile" icon="play">
    Click "Generate Payload" and PayloadStudio compiles your DuckyScript into an `inject.bin` file ready to load onto the Rubber Ducky.
  </Card>
</CardGroup>

PayloadStudio runs entirely in your browser at **[payloadstudio.hak5.org](https://payloadstudio.hak5.org)**  -  no installation required. The **Community Edition** is free and handles basic payloads. **PayloadStudio PRO** unlocks live error checking, advanced compiler optimizations, and debugging tools.

<Info>
  Each of you has been assigned a PayloadStudio PRO license for this camp. PRO gives you real-time error feedback as you type, which makes learning DuckyScript much easier.
</Info>

***

## Setting up PayloadStudio PRO

Follow these steps to activate your PRO license and get ready to write payloads.

<Steps>
  <Step title="Open PayloadStudio">
    Go to [payloadstudio.hak5.org](https://payloadstudio.hak5.org) in your web browser. Chrome, Edge, or Firefox all work.
  </Step>

  <Step title="Navigate to license activation">
    Look for the **Pro** or **License** area in the PayloadStudio interface. Click on it to open the license activation panel.
  </Step>

  <Step title="Enter your credentials">
    Enter the **email address** and **license key** assigned to you from the table below. Every license uses the same email address  -  only the license key is different per student.
  </Step>

  <Step title="Confirm activation">
    After entering your credentials, PayloadStudio PRO should activate. You will see PRO features enabled, including live error checking and advanced compiler options.
  </Step>
</Steps>

### License key assignments

Find your name in the table below and use the corresponding license key. All licenses use the same email address.

<Warning>
  All license keys use the email address **[pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com)**. Enter this email when prompted  -  not your personal email.
</Warning>

| Student                   | Email                                                 | License key           |
| ------------------------- | ----------------------------------------------------- | --------------------- |
| Jackson Saville           | [pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com) | `UQY2-LQHG-1ZNG-GR6O` |
| Matthew Blackwell         | [pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com) | `EK8Z-BV5O-O4XC-44WR` |
| Collin Bradley            | [pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com) | `K8WE-S8YW-8F0R-LPP9` |
| Wesley Langlo             | [pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com) | `30Z5-NB1R-WACP-NE1N` |
| Amari Harman              | [pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com) | `YZFD-TF3C-Y4FA-6ADN` |
| Kaleah Wilburn            | [pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com) | `XR9C-V4DZ-X6BI-4UKZ` |
| Julius Goodbar            | [pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com) | `3NOY-ZRZS-0RN5-HTCR` |
| Stephen Ware (Instructor) | [pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com) | `J195-093S-YUOI-1HEO` |

<Tip>
  If you run into issues activating your license, ask your instructor for help. Make sure you're using the email address from the table  -  **[pjadhwani@hotmail.com](mailto:pjadhwani@hotmail.com)**  -  not your own email.
</Tip>

***

## DuckyScript quick reference

DuckyScript is the programming language you use to write Rubber Ducky payloads. Each command maps to a keyboard action  -  pressing keys, typing text, or waiting.

Here are the commands you need for today's exercises.

### Text and execution

| Command    | What it does                                        | Example                 |
| ---------- | --------------------------------------------------- | ----------------------- |
| `REM`      | Comment  -  ignored by the compiler. Use for notes. | `REM This is a comment` |
| `STRING`   | Type a series of characters exactly as written      | `STRING Hello World`    |
| `STRINGLN` | Type characters and then press Enter                | `STRINGLN echo hello`   |
| `ENTER`    | Press the Enter key                                 | `ENTER`                 |

### Timing

| Command | What it does                                   | Example                      |
| ------- | ---------------------------------------------- | ---------------------------- |
| `DELAY` | Pause for the specified number of milliseconds | `DELAY 1000` (wait 1 second) |

<Info>
  Timing is critical in DuckyScript. If you type a URL before the Run dialog is fully open, the keystrokes are lost. When in doubt, add more delay  -  you can always shorten it later.
</Info>

### Modifier keys

| Command             | What it does                              | Example                    |
| ------------------- | ----------------------------------------- | -------------------------- |
| `GUI` or `WINDOWS`  | Press the Windows key (or Command on Mac) | `GUI r` (opens Run dialog) |
| `ALT`               | Press the Alt key                         | `ALT F4` (close window)    |
| `CTRL` or `CONTROL` | Press the Control key                     | `CTRL c` (copy)            |
| `SHIFT`             | Press the Shift key                       | `SHIFT ENTER`              |

### Navigation keys

| Command  | What it does          | Example                    |
| -------- | --------------------- | -------------------------- |
| `TAB`    | Press the Tab key     | `TAB` (move to next field) |
| `ESCAPE` | Press the Escape key  | `ESCAPE` (close dialog)    |
| `UP`     | Press the Up arrow    | `UP`                       |
| `DOWN`   | Press the Down arrow  | `DOWN`                     |
| `LEFT`   | Press the Left arrow  | `LEFT`                     |
| `RIGHT`  | Press the Right arrow | `RIGHT`                    |

### Toggle and special keys

| Command     | What it does            | Example     |
| ----------- | ----------------------- | ----------- |
| `CAPSLOCK`  | Toggle Caps Lock        | `CAPSLOCK`  |
| `NUMLOCK`   | Toggle Num Lock         | `NUMLOCK`   |
| `DELETE`    | Press the Delete key    | `DELETE`    |
| `BACKSPACE` | Press the Backspace key | `BACKSPACE` |
| `SPACE`     | Press the Space bar     | `SPACE`     |

### LED control

| Command   | What it does          | Example   |
| --------- | --------------------- | --------- |
| `LED_R`   | Turn on the red LED   | `LED_R`   |
| `LED_G`   | Turn on the green LED | `LED_G`   |
| `LED_OFF` | Turn off the LED      | `LED_OFF` |

<Note>
  The LED commands control the built-in indicator light on the Rubber Ducky. You can use them to give yourself visual feedback  -  for example, blink red while the payload runs and turn green when it's done.
</Note>

### Combining modifier keys

You can combine modifier keys with other keys in a single line. The format is:

```duckyscript theme={null}
MODIFIER key
```

Common combinations:

| Combination         | Effect              | Use case                           |
| ------------------- | ------------------- | ---------------------------------- |
| `GUI r`             | Windows + R         | Open the Run dialog on Windows     |
| `GUI d`             | Windows + D         | Show the desktop                   |
| `CTRL ALT DELETE`   | Ctrl + Alt + Delete | Open the security screen (Windows) |
| `ALT TAB`           | Alt + Tab           | Switch between open windows        |
| `ALT F4`            | Alt + F4            | Close the current window           |
| `CTRL SHIFT ESCAPE` | Ctrl + Shift + Esc  | Open Task Manager directly         |
| `CTRL s`            | Ctrl + S            | Save the current file              |

***

## Arming the Rubber Ducky

Once you've compiled a payload in PayloadStudio, you need to load it onto the Rubber Ducky. This is done in **arming mode**, where the device appears as a regular USB flash drive.

<Steps>
  <Step title="Plug in the USB Rubber Ducky">
    Insert the Rubber Ducky into a USB port on your computer.
  </Step>

  <Step title="Enter arming mode">
    The Rubber Ducky should appear as a removable drive labeled **DUCKY** in File Explorer (Windows) or Finder (Mac). If it doesn't appear  -  or if it starts executing a previously loaded payload  -  press the **push button** on the device to switch to arming mode.
  </Step>

  <Step title="Open the DUCKY drive">
    Navigate to the DUCKY drive. You will see the existing `inject.bin` file (if one is loaded). There may also be other configuration files  -  leave those alone.
  </Step>

  <Step title="Replace inject.bin">
    Copy your newly compiled `inject.bin` file from PayloadStudio onto the DUCKY drive. If there's an existing `inject.bin`, replace it. The Rubber Ducky always executes the `inject.bin` file in the root directory.
  </Step>

  <Step title="Safely eject the drive">
    Right-click the DUCKY drive and select **Eject** (or use "Safely Remove Hardware" on Windows). This ensures the file is fully written to the microSD card before you unplug.
  </Step>

  <Step title="Test the payload">
    Unplug the Rubber Ducky, wait a moment, then plug it back in. It will now execute your new payload in attack mode. Make sure you're testing on your own computer.
  </Step>
</Steps>

<Warning>
  **Responsible use reminder:** Only deploy payloads on computers you own or have explicit permission to test. Plugging a Rubber Ducky into someone else's computer without permission is unauthorized access  -  a federal crime under the Computer Fraud and Abuse Act (CFAA), regardless of how harmless the payload seems.
</Warning>

***

## Your first payload: Hello World

Before you move on to the RickRoll payload, try this minimal "Hello World" script to verify your setup is working.

```duckyscript theme={null}
REM Hello World  -  opens Notepad and types a message
DELAY 1000
GUI r
DELAY 500
STRING notepad
ENTER
DELAY 1000
STRING Hello from the USB Rubber Ducky!
```

This payload:

1. Waits 1 second for the computer to recognize the device
2. Opens the Run dialog with `GUI r`
3. Waits half a second for the dialog to appear
4. Types "notepad" and presses Enter to open Notepad
5. Waits 1 second for Notepad to load
6. Types "Hello from the USB Rubber Ducky!" into Notepad

If you see the message appear in Notepad, your Rubber Ducky is set up correctly and you're ready for the RickRoll payload.

<Check>
  If the message appeared in Notepad, your PayloadStudio setup, compilation, and Rubber Ducky arming process are all working. You're ready to move on to the real payload.
</Check>
