> For the complete documentation index, see [llms.txt](https://documentation.hak5.org/shark-jack-display/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.hak5.org/shark-jack-display/profile-duckyscript.md).

# Profile DuckyScript

{% hint style="info" %}
Use Payload Profiles to save and switch between different payload configurations directly from the Shark Jack Display. [Learn more about Payload Profiles](/shark-jack-display/payload-basics/payload-profiles.md).
{% endhint %}

The Shark Jack Display includes the following DuckyScript commands for interacting with and configuring payloads; `GET_PAYLOAD_CONFIG_OPTION`, `SET_PAYLOAD_CONFIG_OPTION` and `PAYLOAD_CONFIG_MENU`.

### GET\_PAYLOAD\_CONFIG\_OPTION

The `GET_PAYLOAD_CONFIG_OPTION` command retrieves a specific key-value pair from a payload configuration file. If the key is missing or the file cannot be accessed, it gracefully drops back to a provided default value.

#### **Usage**

```bash
GET_PAYLOAD_CONFIG_OPTION "PARAMETER" "DEFAULT_VALUE" ["CONFIG_FILE"]
```

* `PARAMETER`: The specific configuration key to locate within the file.
* `DEFAULT_VALUE`: The fallback string output if the parameter is missing.
* `CONFIG_FILE` *(Optional)*: The relative or absolute path to the configuration profile. Defaults to `"default.cfg"` if omitted.

### **Example**

```bash
# Attempt to read 'HOST_TIMEOUT' from 'custom.cfg', falling back to '30s'
TIMEOUT=$(GET_PAYLOAD_CONFIG_OPTION "HOST_TIMEOUT" "30s" "custom.cfg")

SCREEN_WRITE "Scan timeout set to: $TIMEOUT"
```

### Example

```bash
get_config_options() {
  NMAP_SCAN="$(GET_PAYLOAD_CONFIG_OPTION NMAP_SCAN "-sL" $PROFILE)"
  HOST_TIMEOUT="$(GET_PAYLOAD_CONFIG_OPTION HOST_TIMEOUT "30s" $PROFILE)"
  MAX_RETRIES="$(GET_PAYLOAD_CONFIG_OPTION MAX_RETRIES "2" $PROFILE)"
  SCAN_NETMODE="$(GET_PAYLOAD_CONFIG_OPTION SCAN_NETMODE "DHCP_CLIENT" $PROFILE)"
  SCAN_TARGET="$(GET_PAYLOAD_CONFIG_OPTION SCAN_TARGET "SUBNET" $PROFILE)"
}
```

### SET\_PAYLOAD\_CONFIG\_OPTION

The `SET_PAYLOAD_CONFIG_OPTION` command set parameters inside a payload configuration profile.

#### **Usage**

```bash
SET_PAYLOAD_CONFIG_OPTION "PARAMETER" "VALUE" ["CONFIG_FILE"]
```

* `PARAMETER`: The configuration key targeting modification.
* `VALUE`: The new data string to write to the key.
* `CONFIG_FILE` *(Optional)*: The profile profile target. Defaults to `"default.cfg"` if omitted.

#### **Example**

```bash
save_as_new_profile() {
  # Save current configuration as user specified profile cfg file
  RESP="$(TEXT_PICKER "Profile Name" "profile01" "abcdefghijklmnopqrstuvwxyz_0123456789")"
  if [ "$RESP" = "← Back" ]; then
    ALERT "Cancelled" 2 false
    return
  fi
  PROFILE="${RESP}.cfg"
  SET_PAYLOAD_CONFIG_OPTION NMAP_SCAN "$NMAP_SCAN" $PROFILE
  SET_PAYLOAD_CONFIG_OPTION HOST_TIMEOUT "$HOST_TIMEOUT" $PROFILE
  SET_PAYLOAD_CONFIG_OPTION MAX_RETRIES "$MAX_RETRIES" $PROFILE
  SET_PAYLOAD_CONFIG_OPTION SCAN_NETMODE "$SCAN_NETMODE" $PROFILE
  SET_PAYLOAD_CONFIG_OPTION SCAN_TARGET "$SCAN_TARGET" $PROFILE
  ALERT "Profile: $PROFILE Saved" 3 false
  get_config_options
}
```

### PAYLOAD\_CONFIG\_MENU

The `PAYLOAD_CONFIG_MENU` command generates an interactive user interface on screen by reading all profile configurations within the payload's directory. It provides the ability to `Load Profiles` and `Save Profile`.

```bash
# Call the Payload Config Menu and capture the file selected
RESP=$(PAYLOAD_CONFIG_MENU)

case "$RESP" in
  "← Back")
    ALERT "Configuration cancelled." 1 false
    ;;
  *)
    # Assign the chosen profile path to target variables
    PROFILE="$RESP"
    ALERT "Loaded Profile: $PROFILE" 2 false
    ;;
esac
```
