> 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/cloud-c-duckyscript.md).

# Cloud C² DuckyScript

These DuckyScript commands interface with a Hak5 Cloud C² server — a self-hosted web-based command and control system for remote pentesting. [Learn more about Cloud C²](https://shop.hak5.org/products/c2).&#x20;

## C2CONNECT

The `C2CONNECT` command initiates a connection to the configured Cloud C² server. When executed, the device attempts to establish a secure handshake with the server using the credentials and settings defined in the device configuration.

## C2DISCONNECT

The `C2DISCONNECT` command terminates the active connection to the Cloud C² server. This command is typically used at the end of a payload to gracefully close the session and ensure that the device returns to a disconnected state.

## C2EXFIL

The `C2EXFIL` command sends a file to the Cloud C² server (if one is connected). This will appear on the Cloud C² dashboard.

### Options  <a href="#options" id="options"></a>

`C2EXFIL` takes one or two options:

When called with a single argument, the file is sent as a binary file to the Cloud C² server:

```none
C2EXFIL /tmp/some-file
C2EXFIL /usb/logs/some-file
```

When called with the `STRING` argument, the file will be sent as a text file; this will enable viewing it live via the Cloud C² interface.

```none
C2EXFIL STRING /tmp/some-file.txt
C2EXFIL STRING /usb/logs/some-other-file.txt
```

### Examples  <a href="#examples" id="examples"></a>

```bash
#!/bin/bash

LED SETUP
NETMODE DHCP_CLIENT
WAIT_FOR_LINK
WAIT_FOR_IP
LED ATTACK
ifconfig eth0 > /root/loot/eth0.log
C2EXFIL STRING /root/loot/eth0.log
LED FINISH
```

## C2NOTIFY

The `C2NOTIFY` command sends a notification to the Cloud C² server (if one is connected). This will appear on the Cloud C² dashboard.

### Options  <a href="#options" id="options"></a>

`C2NOTIFY` expects two options: the type of notification, and the message itself.

```none
C2NOTIFY INFO some message
C2NOTIFY ERROR some more severe message
```

### Examples  <a href="#examples" id="examples"></a>

```bash
#!/bin/bash

LED SETUP
NETMODE DHCP_CLIENT
WAIT_FOR_LINK
WAIT_FOR_IP
LED ATTACK
WAIT_FOR_BUTTON
C2NOTIFY INFO "The button was pressed!"
LED FINISH
```

## C2GETCONFIG

The `C2GETCONFIG` command displays the current Cloud C² configuration settings for the device. This provides a quick reference for the server URL, device ID, and various security keys currently in use.

### Usage

When invoked, the command outputs the configuration parameters in a key-value format:

```
root@shark:~# C2GETCONFIG
TYPE	Shark Jack
ID	52
HTTPS	True
SERVER	c2c2-dev.hak5.org
HTTPPORT	443
SIGNKEY	ffffff07ff[redacted]
ENCRYPTKEY	ff2bff57621[redacted]
REFRESH	5
SSHPUBKEY	ssh-rsa AAAAB3NzaC1y[redacted]==
```

## ENABLE\_C2

The `ENABLE_C2` command enables C2 Client as a service to run on boot.

## DISABLE\_C2

The `DISABLE_C2` command will disable the C2 Client service. The device will stay registered and service restartable.

## DEREGISTER\_C2

The `DEREGISTER_C2` command permanently removes the device from the registered Cloud C² server and disables the C² client. This action effectively severs the trust relationship between the device and the server, requiring a new registration process if connectivity to a Cloud C² instance is desired in the future. The device provisioning file `/etc/device.config` will be removed.
