Thursday, August 24, 2006

Hacking jExam

Are you bored of continuously going to jExam's site, type your password plus your pin once again just to confirm that the results of your exams are still not there?

This simple (and primitive...) PERL script creates a RSS-file containing all your notes. Just add it to your news ticker program and forget about logging into jExam until October.

Set the variable "domain" to "52005" if you use the domain of the University instead of the faculty's one.

#!/usr/bin/perl

use WWW::Mechanize;
use HTML::TokeParser;

my $login = 'your_login';
my $password = 'your_password';
my $domain = '52004';
my $pin = 'your_pin';

my $jexam = "https://jexam.inf.tu-dresden.de/jexamV3";

my $mech = WWW::Mechanize->new();

$mech->get($jexam);
$mech->form(1);
$mech->field("loginName", $login);
$mech->field("password", $password);
$mech->field("domain", $domain);
$mech->click();
$mech->get("$jexam/ResultsPage.event?newPage=t");
$mech->form(2);
$mech->field("pin", $pin);
$mech->click();

my $stream = HTML::TokeParser->new(\$mech->{content});

my ($tag, $subject, $note, $points, $rss);

$rss = "<rdf:rdf>\n";
$rss .= "<channel>\n";
$rss .= "<title>jExam: Ergebnisse</title>\n";
$rss .= "</channel>\n";

$tag = $stream->get_tag("table");
$tag = $stream->get_tag("table");
$tag = $stream->get_tag("table");
$tag = $stream->get_tag("table");
$tag = $stream->get_tag("table");

while ($tag = $stream->get_tag("table")) {

$tag = $stream->get_tag("span");
$subject = $stream->get_trimmed_text("/span") ."\n";

if ($subject =~ m/ist online/) {
last;
}

$tag = $stream->get_tag("table");
$tag = $stream->get_tag("tr");
$tag = $stream->get_tag("tr");
$tag = $stream->get_tag("td");
$tag = $stream->get_tag("td");
$tag = $stream->get_tag("td");

$note = $stream->get_trimmed_text("/td") ."\n";

$tag = $stream->get_tag("tr");
$tag = $stream->get_tag("td");
$tag = $stream->get_tag("td");
$tag = $stream->get_tag("td");

$points = $stream->get_trimmed_text("/td") ."\n";

$rss .= "<item><title>$subject [[$note]]</title></item>\n";

}

$rss .= "</rdf:rdf>\n";

print $rss;

0 Comments:

Post a Comment

<< Home