Advertisement
Guest User

Untitled

a guest
Apr 7th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3.  
  4. # One may need to change this as well. This is the code for Italy
  5. COUNTRY=VF_IT
  6.  
  7. # The URL uses "%40" for "@". We do the same
  8. USERNAME=<your username>%40<your domain>
  9. PASSWORD=<your password>
  10.  
  11.  
  12. while [ true ]
  13. do
  14. ifconfig en0 | grep "inactive" || wget -qO- http://captive.apple.com/hotspot-detect.html 2>&1 | grep 'Success' > /dev/null
  15.  
  16. if [ $? != 0 ]; then
  17.  
  18. #
  19. # if Captive Network Assistant app launches, for some reason DNS doesn't work.
  20. # Just kill it
  21.  
  22. killall -9 "Captive Network Assistant" 2>&1 > /dev/null
  23.  
  24. # The challenge number seems to change at each connection. Grab it
  25. # Grab it querying an IP number in case DNS isn't active.
  26.  
  27. CHALLENGE=$(wget 8.8.8.8 2>&1 | grep challenge | awk -F= '{ print $7 }' | tail -1 | awk -F& '{ print $1 }')
  28.  
  29. # Just for debug purposes
  30. # echo challenge is $CHALLENGE
  31.  
  32. # I have changed the **nasid** and **mac numbers** for security reasons
  33. # I believe one should use their own anyway.
  34.  
  35. wget --save-cookies cookiejar --keep-session-cookies
  36. --post-data "chooseCountry=$COUNTRY%2F&userFake=$USERNAME$&UserName=$COUNTRY%2F$USERNAME&Password=$PASSWORD&_rememberMe=on"
  37. "https://it.portal.vodafone-wifi.com/jcp/it?res=login&nasid=90-35-6E-E8-E1-60&uamip=192.168.6.1&uamport=80&mac=F4-5B-89-83-00-2D&challenge=$CHALLENGE"
  38. 2> /dev/null
  39. fi
  40. sleep 10
  41. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement