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 section!

Experimenting

You can experiment using the USB_STORAGE command live, either in the Web Shell in the web UI, or via ssh!

Example of the USB_STORAGE command in the Web Shell

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 section!

  #!/bin/bash

# 

NETMODE NAT

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