LogoLogo
DocumentationPayloadsCommunitySupport
  • Packet Squirrel Mark II by Hak5
  • Setup
    • Connecting the Packet Squirrel
    • Setting up the Packet Squirrel
  • Getting Started
    • Changes & New features
    • Packet Squirrel Basics
    • Accessing the Packet Squirrel
    • Web UI
    • Getting the Packet Squirrel online
    • Status LED
    • Cloud C²
    • USB storage support
    • Selecting and editing payloads
    • Configuring payloads
    • Running payloads
    • Networking and modes
  • Networking Tutorial
    • Glossary
    • OSI layers
    • Private IP ranges
    • Network masks
    • Packet injection
    • Translation and redirection
    • Packet capture
  • Payload Development
    • Payload development basics
    • DuckyScript for Packet Squirrel
      • BUTTON
      • C2EXFIL
      • C2NOTIFY
      • C2WATCHDIR
      • DYNAMICPROXY
      • KILLPORT
      • KILLSTREAM
      • LED
      • MATCHPORT
      • MATCHSTREAM
      • NETMODE
      • SELFDESTRUCT
      • SSH_START
      • SSH_STOP
      • SPOOFDNS
      • SWITCH
      • UI_START
      • UI_STOP
      • USB_FREE
      • USB_STORAGE
      • USB_WAIT
  • Advanced payloads
    • Quotes and expansions
    • Flow control
    • Redirecting output
    • Payload configuration
    • Return codes & success
    • Background commands
    • Command groups
    • Processing JSON
    • USB encryption
    • VPN configuration
    • Network manipulation
    • Tips, tricks, & pitfalls
    • Python
  • Payload repository
  • Troubleshooting
    • Troubleshooting networking
    • Troubleshooting payloads
    • Factory reset
  • Software Updates
    • Upgrading firmware
Powered by GitBook
On this page
  • Return values
  • Experimenting
  • Examples

Was this helpful?

  1. Payload Development
  2. DuckyScript for Packet Squirrel

USB_STORAGE

Last updated 2 years ago

Was this helpful?

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

Experimenting

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

Examples

#!/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
}

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

Advanced Bash
Advanced Bash
Example of the USB_STORAGE command in the Web Shell