Checking TelkomSpeedy Usage Using XMLHTTPRequest

If you have a TelkomSpeedy ADSL connection, oftenlly you’ll check your internet account usage. The bad thing is, you need to access telkom’s website download their huge flash just for view a couple lines of information about bandwith limit and usage. So, I’ve create a little javascript application for viewing current TelkomSpeedy usage. I mean, just the usage

This little script is utilizing the useful XMLHttpRequest and Javascript capabilities. The XMLHTTP object will do all the HTTP communication. This javascript can be run in your Windows Box using WScript.exe or CScript.exe, this two apps is shipped with your Windows instalation.

Usage

You can directly download the scripts here. Just edit the files with notepad to change the username and password with your speedy account username and password. And then, connect to internet with your speedy account, run the file by double-click it.

Here’s the screenshot:

For developers, here a little bit explanation about the script. First we create the xmlhttp object

var xmlhttp = false;

// create xmlhttp object
try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
  try {
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch(e) {
    // no xml http, bail
    WScript.Echo("Error, cannot create XMLHTTP object");
    WScript.Quit();
  }
}

And then, we need to send the login information, and retrieve the session cookie

var cookie = '';
var logged_in = false;

xmlhttp.open("POST", "http://divre5.telkomspeedy.com/session.php", false);
xmlhttp.onreadystatechange = function() {
  if (xmlhttp.readyState==4) {
    // retrieve session cookie
    cookie = xmlhttp.getResponseHeader('set-cookie');
    //check for login status
    body = xmlhttp.responseText;
    if (body.match(/location.href='\/\?'/)) {
      logged_in = true;
    } else {
      WScript.Echo("Error, login failed!");
      WScript.Quit();
    }
  }
}
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send('username='+username+'&password='+password);

When our loggin success, their website gives a JS redirection code:

location.href='/?';

So we just need to follow their redirection and parse the speedy bandwith info.

xmlhttp.open("POST", "http://divre5.telkomspeedy.com/?", false);
xmlhttp.onreadystatechange = function() {
  if (xmlhttp.readyState==4) {
    cookie = xmlhttp.getResponseHeader('set-cookie');
    body = xmlhttp.responseText;
    // retrieve speedy usage
    pos = body.indexOf('Sisa Limit');
    limit = body.substring(pos + 33, pos + 38);
    pos = body.indexOf('Pemakaian

');
    used = body.substring(pos + 32, pos + 37);
    WScript.Echo("Speedy Usage For: " + username + "\nSisa Limit: " + limit + "%\nTerpakai  : " + used + "%" );
  }
}
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Cookie", cookie);
xmlhttp.send('');

And there’s we grep the useful information of speedy usage, minus downloading the image
and javascript.

Attachment

13 komentar

  1. Aryo Sanjaya bilang:

    Great script!

    Unfortunally, I have no Speedy connection :(

    December 25th, 2006 at 14:17
  2. Kiyat bilang:

    Finnaly, this trick is very usefull
    btw how about application for check speedy billing that is downloaded from telkomspeedy web?

    but i think this is better, small and useful

    mas aryo, biasane pake opo :p

    January 1st, 2007 at 08:43
  3. ferdhie bilang:

    why download and use 2 megs application if all you need is only the percentage use info?

    “Don’t use a cannon to kill a mosquito”

    hehehe

    February 8th, 2007 at 22:58
  4. JOKERz bilang:

    Size does matter Right?!?!?!

    Btw, can you add more detail about how much the bandwidth has been used. Not just the percentage.

    February 10th, 2007 at 10:42
  5. ferdhie bilang:

    # Btw, can you add more…

    I’ll work on that, thanks for the input

    February 10th, 2007 at 11:52
  6. ndra bilang:

    kok gua coba masih error ya? syntak username & passwordnya yg bener gimana? bisa kasih contoh?

    March 9th, 2007 at 14:09
  7. ferdhie bilang:

    Biasa kok mas,
    username: #####@telkom.net
    dan password: bla2

    btw, klo boleh tau, pesan errornya apa yak?

    March 9th, 2007 at 14:13
  8. benybee bilang:

    saya di daerah sini mas:
    https://divre1plg.telkomspeedy.com/
    url yang perli saya ganti dah di ganti..
    user:pass dah di masukin
    katanya error ngga bisa loggin…
    koq ngga bisa yah..
    apa mang dah berubah lagi…
    tegkyu mas ferdhie

    December 20th, 2007 at 12:39
  9. Zoiz bilang:

    Lol, kewl script.. haha

    January 11th, 2008 at 10:43
  10. Joandi bilang:

    lu lagi bikin apa sih? ribet amat?

    bikinan gue ga pake password nih hahaha, jalan di semua sistem operasi!
    http://www.joandilee.com/2008/05/31/telkom-speedy-alert-community-edition/

    July 2nd, 2008 at 10:55
  11. Joandi bilang:

    just type and click…

    lagian kenapa kalo ga pake password? emangnya lu tau no speedy tetangga lu? haha…

    July 2nd, 2008 at 10:57

Tinggalkan Komentar





*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word