Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Auto Xfinity Wifi reset
- clear
- toilet --gay Automated Free Xfinity Wifi #Displays title in fancy font
- if [ "$1" != "retry" ] #If first parameter doesnt equal retry then
- then
- echo ""
- echo "Shuting down network interface..."
- ifconfig wlo1 down #Brings down internal wifi
- echo ""
- echo "Changing mac address..."
- macchanger -r wlo1 #Changes mac address
- echo ""
- echo "Restarting network interface..."
- service network-manager restart #Restarts entire network-manager
- echo ""
- iwgetid=$(iwgetid) #Declares variable and sets it
- check=0 #Declares variable and sets it
- while [[ $iwgetid != *xfinitywifi\" ]] #If connection doesnt have xfinitywifi then do
- do
- if [[ $check = 0 ]]
- then echo "Waiting for a connection... " #While loop waits for a Xfinity connection
- check=$check++ #displays echo once
- fi
- iwgetid=$(iwgetid) #resets the variable
- done
- echo ""
- paplay /usr/share/sounds/freedesktop/stereo/network-connectivity-established.oga &
- echo "Xfinitywifi connected..."
- echo ""
- sleep 1.5 #Gives time to finish loop
- else
- if [ "$2" = "failed" ]
- then
- echo ""
- echo "Connection failed, retrying..."
- fi
- echo ""
- echo "Skipping conection reset..."
- echo ""
- fi
- echo "Opening automated browser..."
- echo ""
- myscript #Opens Automated script
- xdotool key alt+Tab
- echo "Testing internet connection..."
- echo ""
- wget -q --tries=1 --timeout=10 --spider http://yahoo.com #Tests Connection
- if [[ $? -eq 0 ]] #If connection is good then continue
- then
- echo "Connection established :)"
- paplay /usr/share/sounds/freedesktop/stereo/complete.oga &
- echo ""
- hour=0
- min=59
- sec=0
- while [ $hour -ge 0 ]; do
- while [ $min -ge 0 ]; do
- while [ $sec -ge 0 ]; do
- echo -ne "Restarting Script in $min:$sec\033[0K\r"
- let "sec=sec-1"
- sleep 1
- done #while loop for countdown timer
- sec=59
- let "min=min-1"
- done
- min=59
- let "hour=hour-1"
- done
- paplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga &
- xdotool key alt+Tab &
- sleep 1
- xdotool mousemove 1007 42 click 1 &
- exec bash x #Restarts script
- else #If connection is no good then retrys script from failed state
- echo "No internet connection :( Retrying Script..."
- paplay /usr/share/sounds/freedesktop/stereo/network-connectivity-established.oga sudo pl &
- xdotool key alt+Tab
- sleep 1
- xdotool mousemove 1007 42 click 1 &
- sleep 3
- exec bash x "retry" "failed" #Restarts scripts to failed state
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement