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!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | <?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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | <?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 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
.Net Ajax Apache Audiophile bash C++ Chrome CSIS Curl DD-WRT DDNS Dell DS410 Extension Filebot Framework Golang Google GTK IRC Java Javascript Jquery Linux Logitech M-audio Nautilus Ncat Opendkim PHP Postfix Pthreads Python raspberrypi Redis Robocode Samba Screen SDL Synology Tcpdump Virtual Machine Vmware WPF ZorkCategories
- Code (39)
- Linux (28)
- Apache (1)
- Bind (1)
- Configuration Management (1)
- DD-WRT (3)
- Filebot (1)
- Opendkim (1)
- Opendmarc (1)
- Raspberry pi (1)
- Redis (1)
- Say What? (13)
- Google Extensions (2)
- HTC (1)
- Rant (2)
Meta