Open dreirund opened 2 years ago
I managed to get it working, with two curl
calls.
Essentially, the following is enough:
GET
a request to get the CSRF token via a cookie.POST
request where the CSRF cookie is passed, and the request data contains login=true
and also CSRFToken
properly set.That can be achieved by the following bash script:
_csrftoken="$(curl -s -o '/dev/null' --dump-header - "${_request_url}" | grep -E "^Set-Cookie:[[:space:]]+csrf=" | tail -n1 | awk '{print $2}' | awk -F= '{print $2}' | sed -E 's|;$||')"
curl -s -o '/dev/null' -b "csrf=${_csrftoken}" -d "login=true&CSRFToken=${_csrftoken}" "${_request_url}"
I made a proper script out of it, see → here, and an Arch Linux package, see → here.
Feel free to use that knowledge fix your python script.
Regards!
Since I am currently not traveling by ICE I cannot check, if there has been changes to the login. However, since there have been changes in the past this is possible. Next time I will go by ICE, I will try to check your suggestion and adapt the script.
Soomething seems to have changed on the wifionice.de-website again:
woice up
andwoice down
do not seem to change internet status.I am not familiar with website request scripting, so I cannot help mutch in debugging/ re-writing code.