-
-
Save quantenProjects/4050863f5b232eb8a337d6fb647b8f81 to your computer and use it in GitHub Desktop.
NetworkManager WIFIonICE login automation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script goes to /etc/NetworkManager/dispatcher.d/ | |
IF=$1 | |
STATUS=$2 | |
case "$2" in | |
up) | |
if [ "$CONNECTION_ID" == "WIFIonICE" ] | |
then | |
logger -s "logging in to wifionice" | |
/opt/wifionice.sh | |
elif [ "$CONNECTION_ID" == "FlixBus Wi-Fi" ] | |
then | |
logger -s "logging in to flixbuswifi" | |
curl https://www.ombord.info/hotspot/hotspot.cgi?method=login > /dev/null 2> /dev/null | |
fi | |
;; | |
*) | |
;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get the CSRF token required for login | |
TOKEN=$(curl --silent --cookie /tmp/wifionice_cookie --cookie-jar /tmp/wifionice_cookie 'http://wifionice.de/en/' | grep CSRFToken | cut -d '"' -f 12) | |
# perform WIFIonICE login | |
curl -vvv --cookie /tmp/wifionice_cookie --cookie-jar /tmp/wifionice_cookie --data "login=true&CSRFToken=$TOKEN&connect=" "http://wifionice.de/en/" | |
# remove cookie file | |
rm /tmp/wifionice_cookie |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment