Skip to content
Snippets Groups Projects
Commit b68aa56a authored by nimrod's avatar nimrod
Browse files

- Correct finding of login URL.

parent 58da9f8e
No related branches found
No related tags found
No related merge requests found
...@@ -53,9 +53,12 @@ if [ "$interface" = "ISRAEL-RAILWAYS" ] && [ "$action" = "up" ] ...@@ -53,9 +53,12 @@ if [ "$interface" = "ISRAEL-RAILWAYS" ] && [ "$action" = "up" ]
then then
redirect_url="$(curl --output /dev/null --silent --write-out '%{redirect_url}' http://google.com/)" redirect_url="$(curl --output /dev/null --silent --write-out '%{redirect_url}' http://google.com/)"
debug "Train wifi redirect url: $redirect_url" debug "Train wifi redirect url: $redirect_url"
login_url="$(echo "$redirect_url" | awk -F\? '{printf("%s?allowAccess=true", $1)}' )" login_ip="$(echo "$redirect_url" | grep --only-matching '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*')"
debug "Train wifi login url: $login_url" debug "Train wifi login IP: $ip"
curl "$login_url" login_url="http://$ip/loginHandler.php?allowAccess=true"
debug "Train wifi login URL: $login_url"
http_code="$(curl --output /dev/null --silent --write-out '%{http_code}' "$login_url")"
debug "Train wifi login HTTP code: $http_code"
else else
debug "Interface isn't ISRAEL-RAILWAYS or action isn't up, not signing in to the train wifi." debug "Interface isn't ISRAEL-RAILWAYS or action isn't up, not signing in to the train wifi."
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment