WIFIonICE Reloaded

Posted on Mon 08 January 2018 in linux

As discussed in WIFIonICE the Deutsche Bahn (DB) provides free WiFi in ICEs. However, since my last post on this topic, things have changed: the DB "improved" the login landing page so that the old login mechanisms does not working anymore. Some new fancy stuff with CSFR protection has been introduced so that more effort is required to login. To simplify the login procedure I decided to create a simple python package that does all the login magic. It can be found in the corresponding github repository.

The simplest way to make the script accessible is to install it directly via pip. Of course an encapsulation of the script in a virtualenv is possible, but for reasons of simplicity not used here.

To install the package directly from the github repository do:

sudo pip install -U https://github.com/keans/woice/archive/master.zip

This will install the woice python script to /usr/local/bin/woice -- making it accessible from everywhere on the system.

The script can be called with the up or down parameter to login or respectively logout. Additionally, the status and usage arguments are available to check the current connection state and the used data traffic. Since the script is located in the PATH, it should be manually executable anywhere on the system.

NetworkManager Setup

For an automation of the login process we again utilize the NetworkManager. A similar bash script as shown in the previous post is used, just adapted to apply the new python script.

You can directly download the file from the corresponding examples directory on github:

# download the bash script to the NetworkManager dispatch directory
cd /etc/NetworkManager/dispatcher.d
sudo wget https://raw.githubusercontent.com/keans/woice/master/examples/wifionice.sh

# change owner to root and make it executable
sudo chown root:root /etc/NetworkManager/dispatcher.d/wifionice.sh
sudo chmod u+x /etc/NetworkManager/dispatcher.d/wifionice.sh

Et voilĂ . Just deactivate and activate the WiFi again to see if the automatic login is working correctly. If not check the corresponding logs.