I realise this is an old topic but as my broadband went down I actually needed to figure out how to do this to keep things online via nearby BTWiFi-with-FON hotspots.
I couldn't figure out how to get all the dependencies for the perl script above so downloaded it and picked out the bits I needed to authenticate manually with BTWiFi-with-FON spots.
I saved the following script as /root/fon, chmod 755 fon and then added it to /etc/rc.local so it starts at boot:
#!/bin/sh
while [ 1 = 1 ]; do
DATE=$(date)
CONNECTED=$(ifconfig wlan0 | grep "inet addr")
if [ -n "$CONNECTED" ]; then
ROUTER=$(route -n | grep UG | awk '{ print $2;}')
AUTHENTICATED=$(ping -c5 -W 1 -w 5 8.8.8.8 -q | grep "100% packet loss")
DATE=$(date)
if [ -n "$AUTHENTICATED" ]; then
logger "BTFON: $DATE Internet access is blocked, attempting to login to BTFON..."
wget -O /tmp/fonlogin --quiet --no-check-certificate "https://www.btopenzone.com:8443/wbacOpe … d=password"
sleep 10
else
logger "BTFON: $DATE FON is working!"
fi
else
logger "BTFON: $DATE wlan0 has no IP, waiting for DHCP to complete..."
fi
sleep 5
done
Dependencies:
You need to install the full version of wget as the busybox version does not support SSL.
Customisation:
wlan0 above needs to be the wifi card used to connect to FON.
If you are using this to login with a BTFON account you just need to change the email@ddress and password to your own. If you want to login with a BT Broadband account you will need to change the BTFON/ prefix as well although I cannot remember off the top of my head what it needs to be.
If you are wanting to use BTFON spots or any other FON provider, the URL will be completely different. You can find this out from the page source of the login page.
Also, it WILL fill your log with messages but as I am using a router dedicated to this task it made sense for it be as verbose as possible for me. Just comment out logger "BTFON: $DATE FON is working!" to remove the majority of the log messages.