Skip to content

Instantly share code, notes, and snippets.

@Akendo
Created March 4, 2019 11:46
Show Gist options
  • Save Akendo/7a1f26bf1bff8e1cedfbc3808c738e4e to your computer and use it in GitHub Desktop.
Save Akendo/7a1f26bf1bff8e1cedfbc3808c738e4e to your computer and use it in GitHub Desktop.
This scripts will allow you to login on the Webportal for Wifi on ICE
#!/usr/bin/env bash
CSRF_TOKEN=$(curl http://www.wifionice.de/de/|grep -oE 'value="[0-9a-f]{32}"' | cut -d = -f2|sed 's/"//g')
echo $CSRF_TOKEN
# This is what the website is going to request to the backend...
# POST /de/ HTTP/1.1
# Host: www.wifionice.de
# User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0
# Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
# Accept-Language: en-US,en;q=0.5
# Accept-Encoding: gzip, deflate
# Referer: http://www.wifionice.de/de/
# Content-Type: application/x-www-form-urlencoded
# Content-Length: 62
# DNT: 1
# Connection: close
# Cookie: csrf=${CSRF_TOKEN}
# Upgrade-Insecure-Requests: 1
#
# login=true&CSRFToken=${CSRF_TOKEN}&connect="
POST_DATA="
login=true&CSRFToken=${CSRF_TOKEN}&connect="
URL=http://www.wifionice.de/de/
curl -v -d "$(echo $POST_DATA |sed 's/ /%20/g')" curl -v -A "Mozilla/9000.0 (X11; Linux x86_64; rv:65.0) Gecko/20000000 Firefox/1337" -H "Cookie: csrf=${CSRF_TOKEN}" -d "${POST_DATA}" $URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment