Created
February 14, 2017 18:06
-
-
Save ntfc/cd37a3b822183b1741f132247197a1eb to your computer and use it in GitHub Desktop.
Auto re-connect to Nova Arcada's Free Wi-fi
This file contains 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
#!/usr/bin/env bash | |
# TODO: wait for no Internet connection to run this script | |
set -x | |
while true | |
do | |
ABC=$(curl -L -I www.abola.pt | grep '^Location' | awk '{print $2}' | grep -o 'loginurl=.*$' | cut -d'=' -f2) | |
export ABC="$ABC" | |
DEF=$(python2 -c 'import urllib2; import os; print urllib2.unquote(os.environ["ABC"])') | |
sleep 1 | |
DEF=${DEF%$'\r'} | |
GHI=$(curl "$DEF" | sed ':a;N;$!ba;s/\n//g' | grep -Po '(?<=<a id="button" href=")[^"]*') | |
sleep 1 | |
JKL=$(curl -I "$GHI" | grep -o 'url=.*' | cut -d'=' -f2-) | |
sleep 1 | |
JKL=${JKL%$'\r'} | |
curl "$JKL" | |
sleep 10m | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment