USB Killswitch
Find a file
2026-03-15 16:45:13 -05:00
vendor Basic implementation 2026-03-15 15:36:35 -05:00
.gitignore Help menu, arbitrary command 2026-03-15 15:58:38 -05:00
go.mod Fix 2026-03-15 16:14:49 -05:00
go.sum Basic implementation 2026-03-15 15:36:35 -05:00
LICENSE Initial commit 2026-03-15 20:33:19 +00:00
main.go Readme 2026-03-15 16:13:08 -05:00
README.md Poweroff not shutdown 2026-03-15 16:45:13 -05:00

usb-ks

usb-ks is a USB killswitch program, inspired by https://github.com/BusKill/buskill-app, but simplified and written in Go instead of Python. Additionally, usb-ks executes the specified command on all USB device changes, not just disconnects. When governments seize devices they often use USB devices to exfiltrate data and to ensure systems with FDE don't shutdown. It is thusly evident shutdown behaviors should be initiated on connection and disconnection.

installation

go install git.laack.co/andrewlaack/usb-ks@64b02669e38c8a1099492523a93b11757e5754d1

Then optionally:

sudo install ~/go/bin/usb-ks /usr/local/bin/

NOTE: ensure your go installation directory (default: ~/go/bin) is on your path as this is the default installation location. If you run the optional command, ensure the first argument to install contains the correct go installation path.

dependencies

  • go
    • for building
  • libudev
    • for listening to usb device changes
  • a shell
    • /bin/sh to execute the specified command

usage

Basic invocation, executing xscreensaver on USB device change:

usb-ks

NOTE: Since xscreensaver does not shutdown your system (i.e. doesn't engage FDE protections), it may not be desirable for certain threat models.

For better protection, I recommend using poweroff:

usb-ks poweroff

See options:

usb-ks --help