Skip to content

Instantly share code, notes, and snippets.

@vStone
Created September 14, 2017 16:53
Show Gist options
  • Save vStone/cae838dcfdeb900ce1899bb14c409975 to your computer and use it in GitHub Desktop.
Save vStone/cae838dcfdeb900ce1899bb14c409975 to your computer and use it in GitHub Desktop.
Telenet Telemeter Script
#!/bin/bash
# requirements:
# - curl
# - nokogiri
# usage: fill in username and password here, execute, and it spits out json array with your usage
username=<< Fill your username in here >>
password=<< Fill your password in here >>
curl -L --cookie cookies --cookie-jar cookies https://mijn.telenet.be/mijntelenet/telemeter/showUsage.do?identifier=${username} -s >/dev/null
curl -L --cookie cookies --cookie-jar cookies https://login.prd.telenet.be/openid/login.do -H 'Origin: https://login.prd.telenet.be' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.8,en-GB;q=0.6,nl;q=0.4' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: https://login.prd.telenet.be/openid/login' -H 'Connection: keep-alive' -H 'DNT: 1' --data "j_username=${username}&j_password=${password}&rememberme=true" --compressed -s >/dev/null
curl -L --cookie cookies --cookie-jar cookies https://mijn.telenet.be/mijntelenet/telemeter/showUsage.do?identifier=${username} -H 'DNT: 1' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.8,en-GB;q=0.6,nl;q=0.4' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -s | nokogiri --type html -e "puts \$_.xpath(\"//*[@id='ContentPane']/div/@ng-init\")" | sed -n '/totalMax/p' | sed 's/..$//' | sed 's/^ *//g' | sed "s/'/\"/g"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment