Skip to content

Instantly share code, notes, and snippets.

@christian-korneck
Created November 16, 2020 16:49
Show Gist options
  • Save christian-korneck/a885411b1df2d0821323a17e5b4d2b5e to your computer and use it in GitHub Desktop.
Save christian-korneck/a885411b1df2d0821323a17e5b4d2b5e to your computer and use it in GitHub Desktop.
public wifi login

Public WIFI login from the terminal

These are curl examples for confirming the captive portal login page of some public WIFI Hotspots.

Telekom

SSID: Telekom

alias telekom='onlinestatus=; onlinestatus=$(curl --silent --data-binary "{\"rememberMe\":false}" "https://hotspot.t-mobile.net/wlan/rest/freeLogin" | jq -r ".user.wlanLoginStatus"); if [ "$onlinestatus" != "online" ]; then echo error; else echo online; fi; onlinestatus='

SWM

SSID: M-WLAN Free Wi-Fi

function swm {
local swm_useragent='User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36'
local swm_cookies=$(curl -s -Lk -H "$swm_useragent" 'http://captive.apple.com/' --output /dev/null -c -)
local swm_headers='-H "Host: hotspot.swm.de" -H "Accept: application/json, text/javascript, */*; q=0.01" -H "X-Requested-With: XMLHttpRequest" -H "Origin: https://hotspot.swm.de" -H "Sec-Fetch-Site: same-origin" -H "Sec-Fetch-Mode: cors" -H "Sec-Fetch-Dest: empty" -H "Accept-Language: en-GB,en;q=0.9,en-US;q=0.8,de;q=0.7"'
local resp=$(echo "$swm_cookies" | curl -s -Lk -H "$swm_useragent" "$swm_headers" --data "action=subscribe&type=one&connect_policy_accept=true&user_login=&user_password=&user_password_confirm=&email_address=&prefix=&phone=&private_policy_accept=false&gender=&interests=" --compressed 'https://hotspot.swm.de/portal_api.php' -b -)
local swm_user=$(echo $resp | jq -r '.info.subscribe.login')
local swm_pass=$(echo $resp | jq -r '.info.subscribe.password')
local swm_status=$(echo "$swm_cookies" | curl -s -Lk -H "$swm_useragent" "$swm_headers" --data "action=authenticate&login=$swm_user&password=$swm_pass&policy_accept=true&private_policy_accept=false&from_ajax=true&wispr_mode=false" --compressed 'https://hotspot.swm.de/portal_api.php' -b - | jq -r ".type")
if [ "$swm_status" != "CONNECT" ]; then echo "failed"; else echo "success"; fi
}

Coffee Fellows

SSID: CoffeeFellows

alias coffeefellows='curl --silent --fail --data "refreshdir=&refreshhost=captive.apple.com&refreshssl=0&AGB=on" "http://logout/authen/agblogin/" | grep Successful; if [ "$?" != "0" ]; then echo Login Failed; fi'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment