#!/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