Last active
October 3, 2025 14:26
-
-
Save deckerego/1a8596dd504ef584dd3437ae72eb20f3 to your computer and use it in GitHub Desktop.
Reset all USB NICs at the hardware level
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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