Skip to content

Instantly share code, notes, and snippets.

@deckerego
Last active October 3, 2025 14:26
Show Gist options
  • Save deckerego/1a8596dd504ef584dd3437ae72eb20f3 to your computer and use it in GitHub Desktop.
Save deckerego/1a8596dd504ef584dd3437ae72eb20f3 to your computer and use it in GitHub Desktop.
Reset all USB NICs at the hardware level
check host gateway with address 192.168.1.1
restart program = "/root/reset_nic.sh"
if failed
port 443
protocol https
timeout 10 seconds
retry 3
with ssl options {verify: disable}
then restart
#!/bin/bash
for device in /sys/bus/usb/devices/*; do
grep "NIC" "$device/product" &>/dev/null
if [ "$?" == 0 ]; then
echo -n "Resetting "
cat "$device/product"
sh -c "echo 0 > $device/authorized"
sh -c "echo 1 > $device/authorized"
echo "Device reset."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment