Created
February 7, 2024 22:59
-
-
Save D8xRbD/805a164c18a5f23047cea70c7b753c98 to your computer and use it in GitHub Desktop.
disable-awdl0.sh
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 | |
| # Prompt for the sudo password at the beginning | |
| echo "Please enter your sudo password:" | |
| sudo -v | |
| # Check if sudo authentication was successful | |
| if [ $? -eq 0 ]; then | |
| echo "Sudo authentication successful." | |
| else | |
| echo "Sudo authentication failed. Exiting." | |
| exit 1 | |
| fi | |
| # Define the interface name | |
| INTERFACE="awdl0" | |
| # Infinite loop with a 5-second delay | |
| while true; do | |
| # Get the current timestamp | |
| TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S") | |
| # Check if the interface is up | |
| if ifconfig $INTERFACE | grep -q "status: active"; then | |
| # If the interface is up, bring it down | |
| echo "$TIMESTAMP - Interface $INTERFACE is up. Bringing it down..." | |
| sudo ifconfig $INTERFACE down | |
| else | |
| sudo echo "$TIMESTAMP - Interface $INTERFACE is not up." | |
| fi | |
| # Wait for 5 second before looping again | |
| sleep 5 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment