Last active
March 28, 2024 12:23
-
-
Save PfannenHans/b9867e0e4abb34a30042f88b12f543c7 to your computer and use it in GitHub Desktop.
Small bash script for automatic captive portal log in to the “@BayernWLAN” using curl.
This file contains hidden or 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
#!/usr/bin/env -S bash -e | |
# Only works with DNS name if using provider DNS | |
# ADDRESS="hotspot.vodafone.de/bayern" | |
# IP-Address might be different depending on location | |
ADDRESS="10.175.177.131" | |
LOGIN_PROFILE="6" | |
SESSION_KEY=$(curl -ks 'https://'${ADDRESS}'/api/v4/session' | jq '.session') | |
CURRENT_PROFILE=$(curl -ks 'https://'${ADDRESS}'/api/v4/session' | jq '.currentLoginProfile') | |
if [ ${CURRENT_PROFILE} != ${LOGIN_PROFILE} ]; then | |
echo "Not logged in! Logging in..." | |
curl -k 'https://'${ADDRESS}'/api/v4/login?loginProfile='${LOGIN_PROFILE}'&accessType=termsOnly&sessionID='${SESSION_KEY} | |
else | |
echo "Already logged in, nothing to do..." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment