hackney_libraries_autologin
Introduction
CLR James library offers free Wi-Fi. However, every hour my Mac gets booted off; I suspect they either require explicit re-login to demonstrate client liveliness or just don't support Macs.
This tool logs into their web portal when needed; your connection will die for on average 5 seconds before the tool kicks in.
Requirements
- Python with pip.
- (optional, recommended) install virtualenv and virtualenvwrapper.
Quickstart
- Clone the repo.
- (if you installed virtualenv and virtualenvwrapper):
mkvirtualenv hackney_libraries_autologin
workon hackney_libraries_autologin
pip install -r requirements.txt
- Launch the
Keychain Access
application. - Add a new account called
Hackney Libraries
.- Set the username field to your library card's number.
- Set the password to your PIN.
- Quit the
Keychain Access
application. - Execute
./src/auto_login.py
. - If you want to immediately attempt to login rather than wait for the script, press ENTER.
How it works
- Use the
airport
command-line utility to confirm that we are both connected to a Wi-Fi network and that the Wi-Fi network's SSID isLBH-Libraries
. - If the above is true, determine if we need to re-login by attempting to HTTP GET
https://securelogin.arubanetworks.com/
; it times out if we don't need to log in, and redirects to a login page if we do need to log in. - If we need to log in, HTTP POST to
https://securelogin.arubanetworks.com/cgi-bin/login
with appropriatex-url-form-encoded
content, cookies, and referrer. - We get the credentials directly from
Keychain Access
by executingsecurity
.
That should be enough instructions to modify the script if need be; consult the top-most section titled Constants
for stuff to change if need be.