> 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/payload-development/duckyscript-for-packet-squirrel/usb_storage.md).

# USB\_STORAGE

The `USB_STORAGE` command indicates if external USB storage is available.

Payloads which require USB storage can use this to determine if a USB drive is connected.

## Return values

`USB_STORAGE` sets a return code of `0` if storage is present and non-zero if it is not.

To learn how to write payloads which can handle responses, check the [Advanced Bash](/packet-squirrel-mark-ii/advanced-payloads.md) section!

## Experimenting

You can experiment using the USB\_STORAGE command live, either in the Web Shell in the web UI, or via `ssh`!

<figure><img src="/files/JsRNWWSShX2zEU4zDjlT" alt=""><figcaption><p>Example of the USB_STORAGE command in the Web Shell</p></figcaption></figure>

## Examples

Payloads using the `USB_STORAGE` command must handle the output; for example the following payload sets the LED based on USB storage being available.  For more information about writing advanced payloads, see the [Advanced Bash](/packet-squirrel-mark-ii/advanced-payloads.md) section!

```bash
#!/bin/bash

# Title: USB_STORAGE demo
# 
# Description: Set the LED color based on USB stroage.

NETMODE NAT

USB_STORAGE && { 
        LED G SINGLE
} || { 
        LED R SINGLE
}
```
