The SWITCH command returns the current position of the sliding switch.

Advanced payloads can use this to determine user input.

This does not necessarily reflect the switch position when the Packet Squirrel was booted, only the current position of the switch.

Return values

When called with a timeout, the SWITCH script will return the position of the switch (switch1 through switch4).

To learn how to write payloads which can handle responses, check the Advanced Bash section!


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


Payloads using the SWITCH command must handle the output; for example the following payload sets the LED based on the switch position. For more information about writing advanced payloads, see the Advanced Bash section!


# Title: Switch Demo
# Description: Set the LED color based on the position of the switch.



case $SP in
                LED R SINGLE
                LED B SINGLE
                LED G SINGLE
                LED W SINGLE

Last updated