IWEUA.COM

Logging in with CURL
The NTE 1 or 4 will neatly mount into
an XLR barrel giving you a very cost
effective balance, isolator and level
changer all in one.
I find I use Linux quite a lot these days and having a good head for the command line can really pay off. I use
Ubuntu desktop, FreeBSD on the Raspberry Pis and and OpenWRT on my Arduino YUN... lots of linux.

I use
BT Openzone as my primary ISP with a Linux laptop machine acting as a WiFi client to the service, and
acting as an OpenVPN tunnel and a DHCP server to all my little boxes as I work away on a Window 7 machine.

It is easy to SSH using Putty into my linux machine but every once in a while the WiFi to Openzone would drop off,
necessitating a trip to the other ( in winter, cold ! ) room to re log in through the browser.... now, no longer!

I worked out how to write a CURL script to login in 5 seconds, it took rather longer to work out the script : it is
Christmas, and I was enjoying a quiet night in!

The trick to working out what the Browser was receiving and sending back to the Login page  really lay for me in
using the Firefox Inspector to look at the GET and PUSH requests and, getting a handle on using CURL to store
the session cookie and retransmit that back with the user data.

For BT Openzone : to retrieve the Login cookie

curl -c BTOZCookie.txt https://www.btopenzone.com:8443

this would store the cookie " BTOZCookie.txt" in my home folder, it looked something like this :

#######################################################################################
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

#HttpOnly_www.btopenzone.com    FALSE   /       TRUE    0       JSESSIONID      8B2F5A43BEB0B85B04BEFE9864C3B6D1
###################################################################################################

So when posting back your login data, you had to post back the Cookie which has the JSessionID embedded

The command was as follows :

curl -s -d BTOZCookie.txt -d "username=MYUSERNAME&password=MYPASSWORD" https://www.btopenzone.com:8443/ante


How did I find the post back URL https://www.btopenzone.com:8443/ante ?

I logged into to the website using Firefox with the inspector active and looked at the POST request.

My connection script saved as a text file called 'con' being simply:

curl -c BTOZCookie.txt https://www.btopenzone.com:8443
curl -s -d BTOZCookie.txt -d "username=MYUSERNAME&password=MYPASSWORD" https://www.btopenzone.com:8443/ante

As a note : It doesn't seem that I need to click a Radio button or -d this information : this would have been in the
POST request if required and wasn't, the script works as above.
Nov 2020

I use this script daily on my OpenWRT box to connect to BT Wifi
Obviously replace USERNAME and PASWORD with your BT WiFi creds

./con

curl -s -c BTOZ2.txt https://www.btopenzone.com:8443
curl -s -d BTOZ2.txt -d "username=
USERNAME&password=PASSWORD "https://www.btopenzone.com:8443/ante

ping 9.9.9.10

To disconnect
./dcon

curl https://www.btopenzone.com:8443/accountLogoff/home
curl https://www.btopenzone.com:8443/accountLogoff/home?confirmed=true