Skip to content

Instantly share code, notes, and snippets.

@ntfc ntfc/auto-connect.sh
Created Feb 14, 2017

Embed
What would you like to do?
Auto re-connect to Nova Arcada's Free Wi-fi
#!/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
You can’t perform that action at this time.