Work in progress. script available soon including gas bills.
Bordgais Energy Charts
Download CSIS Notes quickly!
This handy little script will download all your coursework in a jip
youll need php 5 and mod php_curl!
<?php
class csisDownloader
{
private $courseTitles;
private $courseLinks;
private $moduleTitles;
private $moduleLinks;
private $documentCourseTitles;
private $documentModulesTitles;
private $documentTitles;
private $documentLinks;
public function __construct( $course , $modules )
{
if( strlen($course) != 0 )
{
$this->selectedCourse = $course;
}
if( count($modules) > 0 )
{
$this->selectedModules = $modules;
}
$this->fetchCourses();
}
private function fetchCourses()
{
echo "Start\n";
$this->downloader = curl_init();
curl_setopt( $this->downloader , CURLOPT_URL , "http://www.csis.ul.ie/currentstudents/" );
curl_setopt( $this->downloader , CURLOPT_USERAGENT , "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090829 Ubuntu/9.04 (jaunty) Shiretoko/3.5.4pre" );
curl_setopt( $this->downloader , CURLOPT_TIMEOUT , '10' );
curl_setopt( $this->downloader , CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt( $this->downloader , CURLOPT_RETURNTRANSFER , 1 );
$this->store = curl_exec( $this->downloader );
curl_close( $this->downloader );
echo "Got courses\n";
$data = explode( "UNDERGRADUATE COURSES" , $this->store );
$data = explode( "</div>" , $data[1] );
$data = preg_match_all( "/(<li>.*<\/li>)/" , $data[0] , $matches);
preg_match_all( "/<a href=\"([^\"]*)\">(.*)<\/a>/iU" ,$matches[0][0] , $temp1 );
preg_match_all( "/<a href=\"([^\"]*)\">(.*)<\/a>/iU" , $matches[1][1] , $temp2 );
$courses = array_merge( $temp1 , $temp2 );
$this->courseLinks = array_merge( $courses[1] , $courses[4] );
$this->courseTitles = array_merge( $courses[2] , $courses[5] );
for( $u = 0 ; $u < count( $this->courseLinks ); $u++ )
{
if( isset( $this->selectedCourse ) )
{
if( !stristr( $this->courseLinks[$u] , $this->selectedCourse ) )
{
continue;
}
}
$this->downloader = curl_init();
$url = "http://www.csis.ul.ie" . $this->courseLinks[$u];
curl_setopt( $this->downloader , CURLOPT_URL , $url );
curl_setopt( $this->downloader , CURLOPT_USERAGENT , "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090829 Ubuntu/9.04 (jaunty) Shiretoko/3.5.4pre" );
curl_setopt( $this->downloader , CURLOPT_TIMEOUT , '10' );
curl_setopt( $this->downloader , CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt( $this->downloader , CURLOPT_RETURNTRANSFER , 1 );
$this->store = curl_exec( $this->downloader );
$data = explode( "COURSE STRUCTURE SECTION STARTS" , $this->store );
$data = explode( "COURSE STRUCTURE SECTION ENDS" , $data[1] );
preg_match_all( "/<a href=\"([^\"]*)\">(.*)<\/a>/iUms" , $data[0] , $mods );
for( $y= 0 ; $y < count($mods[2]); $y++ )
{
$mods[2][$y] = trim( $mods[2][$y] );
}
$this->moduleLinks[$u] = $mods[1];
$this->moduleTitles[$u] = $mods[2];
curl_close( $this->downloader );
echo "Starting the modules\n";
for( $z = 0 ; $z < count( $this->moduleLinks[$u] ); $z++ )
{
print $this->courseLinks[$u] . " - " . $this->moduleLinks[$u][$z] . "\n";
$moduletitle = preg_replace( "/\/coursemodule\//" , "" , $this->moduleLinks[$u][$z] );
if( isset( $this->selectedModules ) )
{
if( !in_array( $moduletitle , $this->selectedModules ) )
{
continue;
}
}
for( $w = 1 ; $w < 17; $w++ )
{
$url = "http://www.csis.ul.ie" . $this->moduleLinks[$u][$z] . "/?wkid=" . $w;
$this->downloader = curl_init();
curl_setopt( $this->downloader , CURLOPT_URL , $url );
curl_setopt( $this->downloader , CURLOPT_USERAGENT , "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090829 Ubuntu/9.04 (jaunty) Shiretoko/3.5.4pre" );
curl_setopt( $this->downloader , CURLOPT_TIMEOUT , '10' );
curl_setopt( $this->downloader , CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt( $this->downloader , CURLOPT_RETURNTRANSFER , 1 );
$this->store = curl_exec( $this->downloader );
curl_close( $this->downloader );
$data = explode( "MODULE MATERIAL SECTION STARTS" , $this->store );
$data = explode( "MODULE MATERIAL SECTION ENDS" , $data[1] );
$data = explode( "<h2>" , $data[0] );
foreach( $data as $dt )
{
preg_match_all( '/<(a.*) href="(.*?)"(.*)>(.*)((<\/a>)/i' , $dt , $docs );
if( isset($docs[2][0]) != "" )
{
$this->documentTitles[] = substr( trim( $docs[4][0]) , 1 , -1 );
$this->documentLinks[] = trim( $docs[2][0] );
$this->documentCourseTitles[] = $this->courseTitles[$u];
$this->documentModulesTitles[] = $this->moduleTitles[$u][$z];
}
}
print $this->courseLinks[$u] . " - " . $this->moduleLinks[$u][$z] . " - " . $url . "\n";
}
for( $t = 0 ; $t < count( $this->documentCourseTitles ); $t++)
{
$this->downloadFile( $this->documentCourseTitles[$t] ,$this->documentModulesTitles[$t] , $this->documentTitles[$t] , $this->documentLinks[$t] );
}
unset($this->documentCourseTitles);
unset($this->documentModulesTitles);
unset($this->documentTitles);
unset($this->documentLinks);
}
}
}
private function downloadFile( $course , $module , $docTitle , $docUrl )
{
$course = preg_replace( "/\//" , "" , $course);
$moduletitle = $module;
$doc = $docTitle;
$url = $docUrl;
if( !file_exists( "coursework" ) )
{
mkdir( "coursework" );
}
if( !file_exists( "coursework/$course" ) )
{
mkdir( "coursework/$course" );
}
if( !file_exists( "coursework/$course/$moduletitle" ) )
{
mkdir( "coursework/$course/$moduletitle" );
}
$dir = "coursework/$course/$moduletitle";
if( !file_exists( $dir . "/" . $doc ) )
{
$url = preg_replace( "/&/i" , "&" , $url );
$url = preg_replace( "/amp;/i" , "" , $url );
$url = "http://www.csis.ul.ie" . $url;
$this->downloader = curl_init();
curl_setopt( $this->downloader , CURLOPT_URL , $url );
curl_setopt( $this->downloader , CURLOPT_USERAGENT , "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090829 Ubuntu/9.04 (jaunty) Shiretoko/3.5.4pre" );
curl_setopt( $this->downloader , CURLOPT_TIMEOUT , '10' );
curl_setopt( $this->downloader , CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt( $this->downloader , CURLOPT_RETURNTRANSFER , 1 );
$this->store = curl_exec ( $this->downloader );
curl_close( $this->downloader );
$docurl = preg_match( "/action=\"(.*)\" /" , $this->store , $matches );
$match = explode( "\"", $matches[1] );
$match = preg_replace( "/&/i" , "&" , $match[0] );
$match = preg_replace( "/amp;/i" , "" , $match );
$fp = fopen( $dir . "/" . $doc , 'w' );
$this->downloader = curl_init();
curl_setopt( $this->downloader , CURLOPT_URL , $match );
curl_setopt( $this->downloader , CURLOPT_USERAGENT , "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090829 Ubuntu/9.04 (jaunty) Shiretoko/3.5.4pre" );
curl_setopt( $this->downloader , CURLOPT_HEADER, 0);
curl_setopt( $this->downloader , CURLOPT_FILE , $fp );
curl_exec( $this->downloader );
curl_close( $this->downloader );
fclose( $fp );
}
}
}
$course = "LM051";
$modules = array( "CS4416" );
new csisDownloader( $course , $modules );
?>AIB Account status
PHP curl script to fetch your aib accounts (Compilments of Jon (kudos) Cremin)
updated to work with visa validation by me!
Linux users can display this infromation neetly on your desktop using such applications as http://conky.sourceforge.net
Screenshot

Code
<?php
class aib
{
public function __construct($regnumber, $challenge_phone, $challenge_visa, $pac)
{
$this->regnumber = $regnumber;
$this->challenge_phone = $challenge_phone;
$this->challenge_visa = $challenge_visa;
$this->challenge = "";
$this->pac = str_split($pac);
array_unshift($this->pac, null);
$this->ch = curl_init();
curl_setopt( $this->ch , CURLOPT_RETURNTRANSFER , 1 );
curl_setopt( $this->ch , CURLOPT_SSL_VERIFYPEER , 0 );
curl_setopt( $this->ch , CURLOPT_COOKIEFILE , ".cookiefile" );
curl_setopt( $this->ch , CURLOPT_COOKIEJAR , ".cookiefile" );
curl_setopt( $this->ch , CURLOPT_FOLLOWLOCATION , 1 );
curl_setopt( $this->ch , CURLOPT_USERAGENT , "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-gb) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Safari/530.17" );
}
public function balances()
{
curl_setopt( $this->ch , CURLOPT_URL , "https://aibinternetbanking.aib.ie/inet/roi/login.htm" );
$output = curl_exec( $this->ch );
preg_match( '@id="transactionToken" value="(.*)"@' , $output , $token );
curl_setopt( $this->ch , CURLOPT_POST , 1 );
curl_setopt( $this->ch , CURLOPT_POSTFIELDS , "jsEnabled=TRUE&transactionToken=" . $token[1] . "®Number=".$this->regnumber."&_target1=true" );
curl_setopt( $this->ch , CURLOPT_URL , "https://aibinternetbanking.aib.ie/inet/roi/login.htm" );
$output = curl_exec( $this->ch );
preg_match( '@id="transactionToken" value="(.*)"@' , $output, $token);
preg_match( '@<label for="digit1"><strong>Digit (.*)</strong></label>@' , $output , $pac1 );
preg_match( '@<label for="digit2"><strong>Digit (.*)</strong></label>@' , $output , $pac2 );
preg_match( '@<label for="digit3"><strong>Digit (.*)</strong></label>@' , $output , $pac3 );
$this->challenge = preg_match( "/home phone number/" , $output ) > 0 ? $this->challenge_phone : $this->challenge_visa ;
$postinfo = "_finish=true&transactionToken=" . $token[1];
$postinfo .= "®Number=" . $this->regnumber;
$postinfo .= "&pacDetails.pacDigit1=" . $this->pac{$pac1[1]};
$postinfo .= "&pacDetails.pacDigit2=".$this->pac{$pac2[1]};
$postinfo .= "&pacDetails.pacDigit3=" . $this->pac{$pac3[1]};
$postinfo .= "&challengeDetails.challengeEntered=".$this->challenge;
curl_setopt( $this->ch , CURLOPT_POST , 1 );
curl_setopt( $this->ch , CURLOPT_POSTFIELDS , $postinfo );
curl_setopt( $this->ch , CURLOPT_URL , "https://aibinternetbanking.aib.ie/inet/roi/login.htm" );
$output = curl_exec( $this->ch );
if( preg_match( "/continue to account overview/" , $output ) > 0 )
{
preg_match( '@id="transactionToken" value="(.*)"@' , $output , $token );
curl_setopt( $this->ch , CURLOPT_POST , 1 );
curl_setopt( $this->ch , CURLOPT_POSTFIELDS , "iBankFormSubmission=false&transactionToken=" . $token[1] );
curl_setopt( $this->ch , CURLOPT_URL , "https://aibinternetbanking.aib.ie/inet/roi/accountoverview.htm" );
$output = curl_exec( $this->ch );
}
$output = str_replace( "\n" , "" , $output );
$output = str_replace( "\r" , "" , $output );
preg_match_all( '@<img decoding="async" src="/roi/_img/buttons/plus_pl_db.gif" alt="expand" />(.*?)<span>(.*?)</span>@s', $output , $names );
preg_match_all( '@<h3>(.*?)</h3>@s' , $output , $bal );
for( $i = 0; isset( $names[2][$i] ); $i++ )
{
$accounts[] = array( "name" => $names[2][$i] , "balance" => str_replace( " " , "" , str_replace( " " , "" , $bal[1][$i] ) ) );
}
return $accounts;
}
public function __destruct()
{
curl_close( $this->ch );
}
}
$regnumber = "88888888";
$challenge_phone = "4444";
$challenge_visa = "2222";
$pac = "77777";
$aib = new aib($regnumber, $challenge_phone, $challenge_visa, $pac);
$accounts = $aib->balances();
foreach((array)$accounts as $account)
{
echo trim($account['name']) . "\${goto 150}" . trim($account['balance']) . "\n\n";
}
?>Local Mini Python
This application is a port of my C# application called localmini.
It is entended to be a desktop interface for localhostr.com and minihref.com.
This is my first program in PyGTK.
The program currently is a desktop tray application that monitors urls in your clipboard and prompts you using dbus,
issuing the option of fetching a minihref from minihref.com.
Once fetched the minihref will be placed in your clipboard for usage in IM conversations, forums boards etc.
It Also uploads files to through the right click menu context on the tray icon
This upload option i hope to add to the nautaulis context menu also.
Just like the C# appliation it will soon have extended functionality of reading urls from firefox, uploading files and
screenshots to localhostr.com, email link functions and hotkeys, hotcorner and other functionailty.
Basic functionality is there, preferences dialog is basically a shell, awaiting link up to the underlying classes.
Screenshots
Tray View

Dbus Link Notification

Dbus Fetch in progress Notification

Dbus minhref recieved Notification

Dbus upload to localhostr progress

Dbus upload to localhostr complete

Preferences Gui

Requirements
Any linux system with Gnome DE
Python
PyGtk >=2.0
Dbus
Curl
PyCurl
Download
Tags
bash Batchfile C C# C++ CSS Curl DD-WRT DDNS Dockerfile Filebot Go Golang Google Hack HTML Intel Java Javascript Linux Logitech M4 Makefile Nautilus Opendkim Perl PHP Postfix PowerShell Prolog Puppet Python Raku raspberrypi Redis Roff Ruby Shell Smarty Synology SystemVerilog TeX Visual Basic .NET WPF XSLTCategories
- Code (149)
- Linux (30)
- Apache (1)
- Bind (1)
- Configuration Management (1)
- DD-WRT (3)
- Filebot (1)
- Opendkim (1)
- Opendmarc (1)
- Raspberry pi (1)
- Redis (1)
- Say What? (31)
- Google Extensions (2)
- HTC (1)
- Rant (2)
Meta