> For the complete documentation index, see [llms.txt](https://documentation.hak5.org/packet-squirrel-mark-ii/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/packet-squirrel-mark-ii/getting-started/selecting-and-editing-payloads.md).

# Selecting and editing payloads

## Choosing a payload&#x20;

The payload is selected by the switch position at boot.

To pick a payload, simply set the desired switch position and power on (or reboot) your Packet Squirrel!

## Modifying payloads

Payloads can be edited live in the Packet Squirrel web UI, copied via `scp`, or edited on the Packet Squirrel in a ssh terminal.

### Editing payloads in the web UI

The web UI features an in-browser option for editing payloads, with basic syntax highlighting and other code-editing features; simply edit your payload and hit save!

<figure><img src="/files/Ledqr8QbN5HDUOZFF5DT" alt=""><figcaption><p>Packet Squirrel web UI payload editing</p></figcaption></figure>

### Uploading and downloading payloads in the web UI

Each payload in the web UI has an Upload and Download button in the bottom left.

These can be used to easily transfer payloads to and from the Packet Squirrel.

### Editing payloads via SSH

Payloads can be edited directly on the Packet Squirrel via `ssh`.

SSH (or Secure SHell) is a standard tool for connecting to remote systems.  Most operating systems include a `ssh` client by default; alternately, third-party SSH clients such as [PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) are available.

Connect to your Packet Squirrel as `root`, using the same password you set during the initial setup:

```bash
$ ssh root@172.16.32.1
```

Payloads can be found in `/root/payloads/switchN/payload` where `N` is the switch position (so `/root/payloads/switch1/payload`, `/root/payloads/switch2/payload`, and so on.

To edit a payload on the Packet Squirrel, use the command `nano` (or `vi` if you prefer, both editors are included).

```bash
$ nano /root/payloads/switch1/payload
```

<figure><img src="/files/cTK7a7N0EsTdnoD53jCr" alt=""><figcaption><p>A nano editing session in ssh</p></figcaption></figure>

To save your changes and exit, press `^X` (Control-X).

### Copying payloads via SCP

SCP (or Secure CoPy), is a standard tool for copying files to or from remote systems.  Most operating systems include a `scp` command line client by default; third-party SCP clients with a UI such as [WinSCP](https://winscp.net/eng/index.php) are available as well.

Payloads can be found in `/root/payloads/switchN/payload` where `X` is the switch position (so `/root/payloads/switch1/payload`, `/root/payloads/switch2/payload`, and so on.

#### Copying FROM the Packet Squirrel

To copy a payload **FROM** the Packet Squirrel, open a terminal and use the command line `scp` tool, or navigate to `/root/payloads/switchN/` in a graphical SCP tool.

`scp` expects the source and destination.  To copy a file *from* the Packet Squirrel, the source is the root user, the IP of the Packet Squirrel, and the path to the file.  The destination is the local file name.

To copy the payload from slot one on the Packet Squirrel to the file `payload` on our computer, renaming it as a text file, we run:

```bash
$ scp root@172.16.32.1:/root/payloads/switch1/payload payload.txt
```

The payload is now in whatever location we ran `scp` from (typically your users home directory).

{% hint style="info" %}
Payload files are generally text files containing the payload script!

In this example we rename the file to `payload.txt` to make it simple to edit.

You can also usually right-click the payload file and choose "Open with..." to edit it in the text editor of your choice!

If you are using a smart text editor, you can rename your payload based on the contents:  Most payloads are written in Bash script, and could be renamed `payload.sh` if your editor does not automatically identify what language the payload is in.
{% endhint %}

#### Copying TO the Packet Squirrel

To copy the payload back **TO** the Packet Squirrel, we reverse the process:

```bash
$ scp payload.txt root@172.16.32.1:/root/payloads/switch1/payload
```

Remember to always name your payload file `payload`! Above, we do this while copying the file with the command-line `scp` tool (notice the destination name is simply `payload`), or you can rename the file using your GUI secure copy tool after it is transferred.

{% hint style="warning" %}
Remember - you need to rename your payload file to just `payload`!  You can name it whatever you wish on your computer, but rename it when you copy it!

Payloads uploaded via the `Upload` button in the web UI are automatically renamed.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.hak5.org/packet-squirrel-mark-ii/getting-started/selecting-and-editing-payloads.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
