Skip to content

Instantly share code, notes, and snippets.

@sscarduzio
Created August 24, 2014 21:20
Show Gist options
  • Star 37 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save sscarduzio/05ed0b41d6234530d724 to your computer and use it in GitHub Desktop.
Save sscarduzio/05ed0b41d6234530d724 to your computer and use it in GitHub Desktop.
BtWiFi_with_FON automatic login written as a bash script. I have this running every 10 minutes on my raspberry pi
#!/bin/bash
# CONF
DBG=true
RELOG_UNAME=your@email.com
RELOG_PASSW=xxxxxxxxxxxxxxx
# END CONF
IS_LOGGED_IN=$(wget "https://www.btopenzone.com:8443/home" --timeout 30 -O - 2>/dev/null | grep "accountLogoff")
if [ "$IS_LOGGED_IN" ]
then
[[ $DBG ]] && echo "currently logged in. Nothing to do.."
else
[[ $DBG ]] && echo "It's not logged in.. Will log in!"
OUT=$(wget -qO- --post-data "USERNAME=$RELOG_UNAME&PASSWORD=$RELOG_PASSW" "https://btwifi.portal.fon.com/remote?res=hsp-login&HSPNAME=FonBT%3AGB&WISPURL=https%3A%2F%2Fwww.btopenzone.com%3A8443%2FfonLogon&WISPURLHOME=https%3A%2F%2Fwww.btopenzone.com%3A8443&VNPNAME=FonBT%3AGB&LOCATIONNAME=FonBT%3AGB")
ONLINE=$(echo $OUT | grep youre_online )
if [ "$ONLINE" ]
then
[[ $DBG ]] && echo "You're online!"
else
[[ $DBG ]] && echo "Could not login :("
fi
fi
@adammcguk
Copy link

@shuckster I tried the 2nd way and I also changed the main config file in the cloud connect plugin, as it also references the SSID. Not sure if this was required but after doing both, it is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment