fix: dependence on hard-coded url
This commit is contained in:
3
Makefile
3
Makefile
@@ -1,6 +1,7 @@
|
|||||||
default: debug
|
default: debug
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
bash -x wifi4eu.login
|
# return true to not see Makefile errors
|
||||||
|
sh -x wifi4eu.login || true
|
||||||
deploy:
|
deploy:
|
||||||
scp *.login router:/etc/travelmate
|
scp *.login router:/etc/travelmate
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# auto-login for https://wifi4eu.ec.europa.eu or general fortigate
|
# auto-login for https://wifi4eu.ec.europa.eu or general fortigate
|
||||||
trm_fetch="$(command -v curl)"
|
trm_fetch="$(command -v curl)"
|
||||||
trm_domain="http://10.0.1.1:1000"
|
trm_captiveurl="$(uci_get travelmate global trm_captiveurl "http://detectportal.firefox.com")"
|
||||||
|
|
||||||
# initial request to get magic id
|
# initial request to get login url
|
||||||
magic="$($trm_fetch -Ls -o /dev/null -w '%{urle.query}' $trm_domain)"
|
trm_url="$($trm_fetch -Ls -o /dev/null -w '%{url_effective}' $trm_captiveurl)"
|
||||||
|
# extract magic id into $2
|
||||||
|
IFS="?"
|
||||||
|
set -- $trm_url
|
||||||
|
|
||||||
# log in
|
# log in
|
||||||
$trm_fetch $trm_domain \
|
$trm_fetch "$1?$2" \
|
||||||
-X POST \
|
-X POST \
|
||||||
-L \
|
-L \
|
||||||
-H "Referer: $trm_domain/fgtauth?$magic" \
|
-w '%{http_code}' \
|
||||||
|
-H "Referer: $1?$2" \
|
||||||
--data "4Tredir=https://krksistemi.hr/rijeka2/" \
|
--data "4Tredir=https://krksistemi.hr/rijeka2/" \
|
||||||
--data "magic=$magic" \
|
--data "magic=$2" \
|
||||||
--data "username=Disclaimer+user" \
|
--data "username=Disclaimer+user" \
|
||||||
--data "password=123"
|
--data "password=123"
|
||||||
[ "${?}" = "0" ] && exit 0 || exit 255
|
[ "${?}" = "0" ] && exit 0 || exit 255
|
||||||
|
|||||||
Reference in New Issue
Block a user