Posts

Showing posts from June, 2008

pyVerify version 2

Following on from my previous post that shows how to verify cd or dvd integrity, I have this following update: The volumeid.sh script now reads the whole isoinfo -d -i from the dvd and pipes it through to md5sum to generate a "signature" that identifies the disk. The thinking here is that it would be near impossible to have have two disk headers that match completely. Even those that share volume ids... For example openSUSE 11.0 i386 and openSUSE 11.0 x86_64 The Verify class now includes checking for more than one row in the database that has the same volume label. ( md5sum result from volumeid.sh ) This is to catch anything that matches for some strange reason. The updated code for all the files is included below. volumeid.sh #!/bin/sh # # small utility to find the md5sum of the isoinfo header information # isoinfo -d -i /dev/cdrom | md5sum | cut -d " " -f 1 verify.sh #!/bin/sh # # Start with verifying CDs # device="/dev/cdrom" checksumtype=$1 #Find de

Python + Bash + isoinfo + mysql = Python CD Integrity Verifier

I have a requirement to verify by md5sum or sha1sum, CDs or DVDs that I burn - so I wrote a bunch of scripts. I am not saying that this is the best way to skin this particular cat, but it is working. First of all a bit of background info. This stuff only works on Linux because the commands make use of Linux tools such as isoinfo and dd. I am sure Windows command line equivalents exist... I have a mysql database with one table in it that has the following fields: distro_label --- Volume ID of CD or DVD distro_name ---- Name of the CD or DVD hash_type ------ 1 = md5sum, 2 = sha1sum hash_detail ---- Known good md5sum or sha1sum of the particular CD or DVD Here is an example record: distro_label --- Slack11d1 distro_name ---- Slackware 11 Disk 1 hash_type ------ 1 hash_detail ---- a7cfcb4be158beca63af21b3b4dbc69c In case you are wondering how I know the volume id - try this while you have a CD or DVD in your cd / dvd drive: [~]$ isoinfo -d -i /dev/cdrom Requirements T

Python + inotify = Pyinotify [ how to watch folders for file activity ]

Sometimes it just might be handy to be able to watch a folder on a hard disk for changes. For example: A client app might drop small files on a shared folder. A server app might be watching the folder for just such an event. Once the file is created, the server will kick into action and perform whatever tasks are required. This all comes from my CD burning application. I am currently thinking that the client apps will drop small xml files containing information about what to burn onto a folder the webserver has access to and the cdburner service will be watching... The linux kernel provides inotify. This from wikipedia : notify is a Linux kernel subsystem that provides file system event notification. It was written by John McCutchan with help from Robert Love and later Amy Griffis to replace dnotify . It was included in the mainline kernel from release 2.6.13 (2005-06-18), and could be compiled into 2.6.12 and possibly earlier releases by use of a patch . Its function is essen

Python + YAMI = 3 Tier

Background I have spent most of last night and this afternoon working out how to implement a website for my local LAN that would enable use of my DVD writer from a remote host over a web interface. I need to provide a small web application that can be used to burn ISO images onto CDs or DVDs. The application should also verify the CD or DVD once it has been burnt. Security To start with I needed to find out how to control the CD or DVD burner from the website. There is the small problem of security here. I could not simply add the Apache user access to /dev/sr0 ( the cd device ) because then it is conceivable that anyone or any rouge application might be able to use the Apache service to monkey with my device. I had to provide some kind of abstraction which could authenticate / authorise the request prior to performing it. Python Python is fast becoming my favourite scripting language for working in Linux. It has some very nice libraries that makes things like network programming

So Whatddya Know?

Social networking sites seem to tap in to the idea that we should all be connected together and on-line. We should be able to do something, upload a photo, write a comment, update a status or simply forward something along to all of our friends for them to see. Don't you mean, "So what do your mates know?" It's not what we know that is important any more. What is important is what we share. The information we give out to people about our feelings and experiences has suddenly - through the exponential growth [ reference ] of social networking sites - become valuable. Valuable to our friends who are now taking notice of us... and valuable to big business who piggy-back their relevant and targeted marketing. Every post you write will be read by at least half a dozen of your friends. If you have a popular profile / blog it will be read by half a dozen thousand people. That's a lot of people that know stuff about you. So what - I am more popular now than ever be