Skip to content

Instantly share code, notes, and snippets.

@sscarduzio
Created August 24, 2014 21:20
Show Gist options
  • 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
[email protected]
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
@SpikeTheLobster
Copy link

not entirely sure will try targeting 32 bit specifically, current timings are coded as follows, IF NO INTERNET = ping (500ms timeout), wait (500ms), Ping (500ms Timeout), Run Selected Login IF INTERNET Ping (Timeout Not Relevant), Wait (1000ms), Loop Back To Ping

I don't think anyone still uses 32-bit, do they? Not sure why mine (x64) won't run it, to be honest, but then I haven't reformatted and reinstalled for years (used to do it every 6 months) so Windows has probably accumulated a whole load of icky stuff that gets in the way...
The timing thing: I meant between checks, sorry. I have my current batch going every 2 minutes or so, which can give a fair bit of downtime if the network's rubbish but avoids getting things piled up with constant checks!

@aidanmacgregor
Copy link

aidanmacgregor commented Jun 13, 2022

not entirely sure will try targeting 32 bit specifically, current timings are coded as follows, IF NO INTERNET = ping (500ms timeout), wait (500ms), Ping (500ms Timeout), Run Selected Login IF INTERNET Ping (Timeout Not Relevant), Wait (1000ms), Loop Back To Ping

I don't think anyone still uses 32-bit, do they? Not sure why mine (x64) won't run it, to be honest, but then I haven't reformatted and reinstalled for years (used to do it every 6 months) so Windows has probably accumulated a whole load of icky stuff that gets in the way... The timing thing: I meant between checks, sorry. I have my current batch going every 2 minutes or so, which can give a fair bit of downtime if the network's rubbish but avoids getting things piled up with constant checks!

ahh its set to loop so if first test passes waits 1 second and runs the same single packet ping again :)

EDIT: v4 Windows Exe Now Available
https://github.com/aidanmacgregor/BT_Wi-fi_Autologin_-_OpenWrt_Windows.EXE_Linux_Chrome-OS_Android-Macrodroid

@Gadgetoid
Copy link

@aidanmacgregor also now using your script (OpenWRT service). Nice work, thank you! Though I swapped the config over to /etc/btwifi.conf since I'm not sure what owns rc.local on OpenWRT.

@aidanmacgregor
Copy link

@aidanmacgregor also now using your script (OpenWRT service). Nice work, thank you! Though I swapped the config over to /etc/btwifi.conf since I'm not sure what owns rc.local on OpenWRT.

Hey Awesome! Glad its Working Well For You, and i was under impression nothing touched it besides from the user :)

@adammcguk
Copy link

@shuckster With the SSID of BT WiFi hotspots now changing to "EE WiFi", will the cloud-connect plugin need to be altered, and if so, what is required?

@shuckster
Copy link

@adammcguk - Thanks for the report.

If you're already using the plugin, you can try modifying this line in this file in your local filesystem.

Change it from:

BT_SSID=${CC_WIRELESS_SSID_MATCH:-"BTWi-fi\|BTWifi-with-FON"}

To:

BT_SSID=${CC_WIRELESS_SSID_MATCH:-"EE WiFi\|BTWi-fi\|BTWifi-with-FON"}

I have a suspicion the space may cause issues, so if the above doesn't work, try:

BT_SSID=${CC_WIRELESS_SSID_MATCH:-"EE\ WiFi\|BTWi-fi\|BTWifi-with-FON"}

If you are able try this and check that it works, I'll update the plugin in the repo so others can benefit.

@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.

@topdag
Copy link

topdag commented Jun 23, 2025

Hi, the BT landing zone on EE looks to have changed recently from the previous "https://www.btwifi.com:8443/tbbLogon" to something more complex like this:
"https://auth.bt.com/9e48dc1b-bb65-4264-9a66-21e9c24affc7/b2c_1a_rpbt_signin/oauth2/v2.0/authorize?scope=openid+profile+offline_access+https%3A%2F%2Fauth.bt.com%2Fapi%2Fbtc-wifi-eligibility-api-v1.getWifi&response_type=code&redirect_uri=https%3A%2F%2Fee-wifi.ee.co.uk%3A443%2FsafCallback%2FBT&client_id=5669a528-fd57-4e10-ac60-f681717579ce&response_mode=form_post"

Has anyone any ideas on how to amend my simple script (below) to accommodate this change ?
(Running on GLiNET AR750S router)

SCRIPT:

#!/bin/sh

CONF

DBG=true
RELOG_UNAME="xxxx@xxxx"
RELOG_PASSW="xxxx"

END CONF

IS_LOGGED_IN=$(wget "https://ee-wifi.ee.co.uk/home" --no-check-certificate --timeout 30 -O - 2>/dev/null | grep "you are now connected")

if [ "$IS_LOGGED_IN" ]
then
$DBG && echo "Currently logged in. Nothing to do... :)"

$DBG && logger -t "logon_fon" "Currently logged in. Nothing to do... :)"

else

$DBG && echo "You're not logged in... will log in now!"
$DBG && logger -t "logon_fon" "You're not logged in... will log in now!"
OUT=$(wget -qO - --no-check-certificate --post-data "username=$RELOG_UNAME&password=$RELOG_PASSW" "https://www.btwifi.com:8443/tbbLogon")

ONLINE=$(echo $OUT | grep "now logged on" )

if [ "$ONLINE" ]

then
$DBG && echo "You're online!"
$DBG && logger -t "logon_fon" "You're online!"

else
$DBG && echo "Could not login :("
$DBG && logger -t "logon_fon" "Could not login :("
fi

fi

@transilluminate
Copy link

Hi, the BT landing zone on EE looks to have changed recently from the previous "https://www.btwifi.com:8443/tbbLogon" to something more complex like this: "https://auth.bt.com/9e48dc1b-bb65-4264-9a66-21e9c24affc7/b2c_1a_rpbt_signin/oauth2/v2.0/authorize?scope=openid+profile+offline_access+https%3A%2F%2Fauth.bt.com%2Fapi%2Fbtc-wifi-eligibility-api-v1.getWifi&response_type=code&redirect_uri=https%3A%2F%2Fee-wifi.ee.co.uk%3A443%2FsafCallback%2FBT&client_id=5669a528-fd57-4e10-ac60-f681717579ce&response_mode=form_post"

Has anyone any ideas on how to amend my simple script (below) to accommodate this change ? (Running on GLiNET AR750S router)

SCRIPT:

#!/bin/sh

CONF

DBG=true RELOG_UNAME="xxxx@xxxx" RELOG_PASSW="xxxx"

END CONF

IS_LOGGED_IN=$(wget "https://ee-wifi.ee.co.uk/home" --no-check-certificate --timeout 30 -O - 2>/dev/null | grep "you are now connected")

if [ "$IS_LOGGED_IN" ] then $DBG && echo "Currently logged in. Nothing to do... :)"

$DBG && logger -t "logon_fon" "Currently logged in. Nothing to do... :)"

else

$DBG && echo "You're not logged in... will log in now!" $DBG && logger -t "logon_fon" "You're not logged in... will log in now!" OUT=$(wget -qO - --no-check-certificate --post-data "username=$RELOG_UNAME&password=$RELOG_PASSW" "https://www.btwifi.com:8443/tbbLogon")

ONLINE=$(echo $OUT | grep "now logged on" )

if [ "$ONLINE" ]

then $DBG && echo "You're online!" $DBG && logger -t "logon_fon" "You're online!"

else $DBG && echo "Could not login :(" $DBG && logger -t "logon_fon" "Could not login :(" fi

fi

Hey! Just updated my own script to auto login to EE hotspot, see here https://github.com/transilluminate/eewifi-daemon

@topdag
Copy link

topdag commented Jun 24, 2025

Hi, the BT landing zone on EE looks to have changed recently from the previous "https://www.btwifi.com:8443/tbbLogon" to something more complex like this: "https://auth.bt.com/9e48dc1b-bb65-4264-9a66-21e9c24affc7/b2c_1a_rpbt_signin/oauth2/v2.0/authorize?scope=openid+profile+offline_access+https%3A%2F%2Fauth.bt.com%2Fapi%2Fbtc-wifi-eligibility-api-v1.getWifi&response_type=code&redirect_uri=https%3A%2F%2Fee-wifi.ee.co.uk%3A443%2FsafCallback%2FBT&client_id=5669a528-fd57-4e10-ac60-f681717579ce&response_mode=form_post"
Has anyone any ideas on how to amend my simple script (below) to accommodate this change ? (Running on GLiNET AR750S router)
SCRIPT:
...
Hey! Just updated my own script to auto login to EE hotspot, see here https://github.com/transilluminate/eewifi-daemon

Thanks transilluminate I've tested your script, but it doesn't seem to work (for me). I've updated the config file with account details, added rc.local . I wonder is it anything to do with the "https://ee-wifi.ee.co.uk/ante" where the script is trying to post the username and password login information to?
When logging into eewifi manually, on the landing page, I notice that the BT broadband home customer option now redirects to a very long path starting with "https://auth.bt.com/". I think previously it was just a simple path ("https://www.btwifi.com:8443/tbbLogon")
Welcome any thoughts

@transilluminate
Copy link

@topdag this works for me with the paid EE WiFi option, on a GLiNet router.

You could try ssh’ing and pasting the commands manually and seeing the return to debug… or flipping the debug to “true” and seeing what it fails on!

It may be the WiFi interface is different for you… type “iwinfo info” to see all the devices available and edit the config file and change that

@topdag
Copy link

topdag commented Jun 30, 2025

Thanks @transilluminate
It fails on "Error: Authenticating to EE WiFi was unsuccessful"
iwinfo shows same wifi interface (wlan-sta0) - so all good there.
My old script seems to keep the connection live without the need to login when changed to:

OUT=$(wget -qO - --no-check-certificate --post-data "username=$RELOG_UNAME&password=$RELOG_PASSW" "https://ee-wifi.ee.co.uk:443/tbbLogon ")

@aidanmacgregor
Copy link

My openwrt service has stopped working a week or so ago, my windows exe was still working until 2 days ago, the raw HTTP Post URL now returns this
"

120
100
Service temporarily unavailable - please try later

"

Thanks @transilluminate It fails on "Error: Authenticating to EE WiFi was unsuccessful" iwinfo shows same wifi interface (wlan-sta0) - so all good there. My old script seems to keep the connection live without the need to login when changed to:

OUT=$(wget -qO - --no-check-certificate --post-data "username=$RELOG_UNAME&password=$RELOG_PASSW" "https://ee-wifi.ee.co.uk:443/tbbLogon ")

Dosent seem to work for me on windows, i have notaced im not getting logged off after 4 hours, last night signed in via web page & went out and this morning checked heating app and it was still connected

image

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