Automate BTWiFi login using a FON account

4

1

I'm a user of British Telecom's Wifi hotspot. The service is good, but after some time of inactivity it logs me off and asks for user name and password.

It's really annoying in the long run.

Did anybody already reverse-engineer the login system and produced a Python/Bash/Perl script?

Or is there a generic way to do these kind of things?

sscarduzio

Posted 2014-08-24T21:32:02.597

Reputation: 161

Android? Are you using the BT Wi-fi app? – MrWhite – 2014-08-24T22:25:35.093

I don't own any android, I have a raspberry pi though! – sscarduzio – 2014-08-25T17:36:48.017

Answers

2

Save this as a scrip and have it run every 10 mins. Dont forget to add your username and password at the top!

#!/bin/bash

# CONF

DBG=true
RELOG_UNAME=usernamehere
RELOG_PASSW=passwordhere

# 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

MrBeanzy

Posted 2014-08-24T21:32:02.597

Reputation: 121

1Thanks for this answer, but an explanation would be nice :-) – bertieb – 2015-08-15T13:20:46.203

Sorry i was in a rush so it was a bit of a brain dump, have that run every 10mins or so and it will keep you logged in. Just replace the username and password. Part of the script was credit to someone else. But cant remember where from now – MrBeanzy – 2015-08-16T15:31:43.097

4

Well, this is awkward. You did not write the code you pasted, and I'm certain because I wrote it myself one year ago, a few days after posting my question.

https://gist.github.com/sscarduzio/05ed0b41d6234530d724

– sscarduzio – 2015-08-17T13:28:23.673

@sscarduzio any chance to have an equivalent script working with the Vodafone free wifi (Fon)? I am looking at it right now but I have no clue on how to get the http commands. – Michele Dall'Agata – 2016-02-18T09:45:08.543

1You can do it yourself, I used chrome "inspect element" -> select network tab, look at the HTTP requests, right click and copy curl command. Then I adapted curl to wget because I didn't have curl installed in my embedded device. – sscarduzio – 2016-02-18T10:04:29.087

Meh. I am getting mad with it. I have curl, lynx and I just can't make it working. Thanks anyway. – Michele Dall'Agata – 2016-03-05T11:35:16.957

1

@sscarduzio I've found the solution for Vodafone. The problem was that at each new connection it issues a challenge number, which is never the same. If you (or anyone else) are interested you can find it in here: http://superuser.com/questions/1053990/automatic-login-to-vodafone-community-wifi-fon-via-unix-script/1062530#1062530 Thanks for your help!

– Michele Dall'Agata – 2016-04-07T10:29:02.667

Really nice exercise. Logging in with Vodafone must be really annoying if you went all the way to circumvent the challenge parameter, kill the captive network detector etc :) – sscarduzio – 2016-04-07T17:51:26.610

1yeah, that's what has been the pain indeed. But after few runs with Chrome as you suggested it became clearer what was going on with the challenge number. Then the captive network assistant blocking the DNS queries just added damage to injury. No wonder I was stuck. But today I took my time and it eventually came out! Although I must say that having a script killing that annoying splash window just feels gooood. >:) – Michele Dall'Agata – 2016-04-07T21:17:10.497