Created
September 14, 2017 16:53
-
-
Save vStone/cae838dcfdeb900ce1899bb14c409975 to your computer and use it in GitHub Desktop.
Telenet Telemeter Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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