Advertisement
Guest User

Xfinitywifi autologin bash script

a guest
Jul 20th, 2018
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.01 KB | None | 0 0
  1. #!/bin/bash
  2. # Auto Xfinity Wifi reset
  3.  
  4. clear
  5.  
  6. toilet --gay Automated Free Xfinity Wifi  #Displays title in fancy font
  7.  
  8. if [ "$1" != "retry" ]          #If first parameter doesnt equal retry then
  9. then
  10.  
  11. echo ""
  12.  
  13. echo "Shuting down network interface..."
  14. ifconfig wlo1 down         #Brings down internal wifi
  15.  
  16. echo ""
  17.  
  18. echo "Changing mac address..."
  19. macchanger -r wlo1         #Changes mac address
  20.  
  21. echo ""
  22.  
  23. echo "Restarting network interface..."
  24. service network-manager restart     #Restarts entire network-manager
  25.  
  26. echo ""
  27.  
  28. iwgetid=$(iwgetid)          #Declares variable and sets it
  29.  
  30. check=0                 #Declares variable and sets it
  31.  
  32. while [[ $iwgetid != *xfinitywifi\" ]]  #If connection doesnt have xfinitywifi then do
  33.  
  34.     do
  35.  
  36.     if [[ $check = 0 ]]
  37.  
  38.     then echo "Waiting for a connection... "    #While loop waits for a Xfinity connection
  39.     check=$check++          #displays echo once
  40.     fi
  41. iwgetid=$(iwgetid)          #resets the variable
  42.      
  43. done
  44.  
  45. echo ""
  46.  
  47. paplay /usr/share/sounds/freedesktop/stereo/network-connectivity-established.oga &
  48.  
  49. echo "Xfinitywifi connected..."
  50.  
  51. echo ""
  52.  
  53. sleep 1.5               #Gives time to finish loop
  54.  
  55.  
  56. else  
  57.     if [ "$2" = "failed" ]
  58.     then
  59.         echo ""
  60.  
  61.         echo "Connection failed, retrying..."
  62.     fi
  63.    
  64.     echo ""
  65.  
  66.     echo "Skipping conection reset..."
  67.    
  68.     echo ""
  69.    
  70.  
  71. fi
  72.  
  73. echo "Opening automated browser..."
  74.  
  75. echo ""
  76.  
  77. myscript                #Opens Automated script
  78.  
  79. xdotool key alt+Tab
  80.  
  81. echo "Testing internet connection..."
  82.  
  83. echo ""
  84.  
  85. wget -q --tries=1 --timeout=10 --spider http://yahoo.com    #Tests Connection
  86.  
  87. if [[ $? -eq 0 ]]           #If connection is good then continue
  88. then
  89.  
  90. echo "Connection established :)"
  91.  
  92. paplay /usr/share/sounds/freedesktop/stereo/complete.oga &
  93.  
  94. echo ""
  95.  
  96. hour=0
  97. min=59
  98. sec=0
  99.  
  100.        while [ $hour -ge 0 ]; do
  101.                 while [ $min -ge 0 ]; do
  102.                         while [ $sec -ge 0 ]; do
  103.                                 echo -ne "Restarting Script in $min:$sec\033[0K\r"
  104.                                 let "sec=sec-1"
  105.                                 sleep 1
  106.                         done        #while loop for countdown timer
  107.                         sec=59
  108.                         let "min=min-1"
  109.                 done
  110.                 min=59
  111.                 let "hour=hour-1"
  112.         done
  113.  
  114. paplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga &
  115.  
  116. xdotool key alt+Tab &
  117.  
  118. sleep 1
  119.  
  120. xdotool mousemove 1007 42 click 1 &
  121.  
  122. exec bash x             #Restarts script
  123.  
  124. else                    #If connection is no good then retrys script from failed state
  125.  
  126. echo "No internet connection :( Retrying Script..."
  127.  
  128. paplay /usr/share/sounds/freedesktop/stereo/network-connectivity-established.oga    sudo pl  &
  129.  
  130. xdotool key alt+Tab
  131.  
  132. sleep 1
  133.  
  134. xdotool mousemove 1007 42 click 1 &
  135.  
  136. sleep 3
  137.  
  138. exec bash x "retry" "failed"        #Restarts scripts to failed state
  139.  
  140. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement