Files
openwrt-travelmate-login/wifi4eu.login
eneller 12bfaa2dfe fix: source functions
sourcing /lib/functions so uci_get is in scope
2025-11-22 22:36:49 +01:00

25 lines
663 B
Bash
Executable File

#!/bin/sh
# auto-login for https://wifi4eu.ec.europa.eu or general fortigate
. "/lib/functions.sh"
trm_fetch="$(command -v curl)"
trm_captiveurl="$(uci_get travelmate global trm_captiveurl "http://detectportal.firefox.com")"
# initial request to get login url
trm_url="$($trm_fetch -Ls -o /dev/null -w '%{url_effective}' $trm_captiveurl)"
# extract magic id into $2
IFS="?"
set -- $trm_url
# log in
$trm_fetch "$1?$2" \
-X POST \
-L \
-w '%{http_code}' \
-H "Referer: $1?$2" \
--data "4Tredir=https://krksistemi.hr/rijeka2/" \
--data "magic=$2" \
--data "username=Disclaimer+user" \
--data "password=123"
[ "${?}" = "0" ] && exit 0 || exit 255