4

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?

2
  • Android? Are you using the BT Wi-fi app?
    – MrWhite
    Aug 24 '14 at 22:25
  • I don't own any android, I have a raspberry pi though!
    – sscarduzio
    Aug 25 '14 at 17:36
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
9
  • 1
    Thanks for this answer, but an explanation would be nice :-)
    – bertieb
    Aug 15 '15 at 13:20
  • 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. gist.github.com/sscarduzio/05ed0b41d6234530d724
    – sscarduzio
    Aug 17 '15 at 13:28
  • 1
    You 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
    Feb 18 '16 at 10:04
  • 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: superuser.com/questions/1053990/… Thanks for your help! Apr 7 '16 at 10:29
  • 1
    yeah, 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. >:) Apr 7 '16 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.