# 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](https://olddocs.hak5.org/packet-squirrel-mark-ii/advanced-payloads) 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="https://932701053-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F520JUF2JxB2RMXztRVAV%2Fuploads%2FLaWff1yFuuUpRm8BLQu1%2FScreenshot%20from%202023-02-21%2017-03-42.png?alt=media&#x26;token=b77ffd82-62fc-4e54-91ed-fce1617c5978" 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](https://olddocs.hak5.org/packet-squirrel-mark-ii/advanced-payloads) 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
}
```
