Archive for the “Free Software” Category

Sometimes you want to execute a particular command, but only when you’re at home. Examples would be running fetchmail (or fetchnews) through cron, but you don’t want this to run when you’re in the train, connected to the Internet through GPRS…

My idea here would be to create a script (say “athome.sh”) which returns 0 if you’re at home, and 1 otherwise. The key of the script is that the MAC address of your (default) gateway is unique.

#!/bin/sh

GW=$(/sbin/ip route | awk '/default/ {print $3}');
MGW=$(/sbin/arp -e | grep ${GW} | awk '{print $3}');

if [ "${MGW}" = "00:11:22:33:44:55" ]
then
  exit 0;
else
  exit 1;
fi

With this script, you can then run athome.sh && fetchmail. If you aren’t home, athome.sh will return 1 and the fetchmail command will never be executed. When you are, the command returns 0 and fetchmail is launched.

Comments No Comments »

I know that repeatable password generators are less secure than random character generators. After all, if you want a strong password, you can simply perform head -c 8 /dev/urandom | mimencode to obtain a nice, random password string.

However, in certain cases you might want to generate passwords given a particular entry which always returns the same password. For instance, for low-profile web sites. Most people use mneumonics (such as username reversed and appended with domainname abbreviation to give an example) but mneumonics can be quite insecure, especially if you use a mneumonic that, once someone sees one of your passwords, he can deduce all passwords.

An example would be the above-given algorithm, which yields for the following sites:

bugs.gentoo.org, user foobar, password raboofbgo
forums.gentoo.org, user bleh, password helbfgo
www.sourceforge.net, user mynick, password kcinymwsn

I’m sure you can find the password for other sites I would show you, so this kind of passwords are not that secure.

Enter hex2passwd, a tool which generates (the same) password for the same input over and over again. With the tool you can make your mneumonic a bit more secure as it uses hashfunctions to create a pseudorandom sequence and a character mapping to convert the hash result into a possible password.

An example for the above sites / mneumonic would yield:

For bugs.gentoo.org, user foobar
$ echo raboofbgo | sha1sum | hex2passwd -n 8
XqXgOYce
For forums.gentoo.org, user bleh
$ echo helbfgo | sha1sum | hex2passwd -n 8
l8U.tdzg
For www.sourceforge.net, user mynick
$ echo kcinymwsn | sha1sum | hex2passwd -n 8
70z4Bu3k

Of course, the tool offers some more flexibility, such as choosing your own character maps or scrambling the maps before you use them. In any case, if you think such a tool is useful for you as well, don’t hesitate to download, compile and install it – it’s a simple C program, probably too ugly to show ;-)

Comments 2 Comments »

Some time ago I received a digital camera; however, due to diskspace shortage I need to clean up my home directory. One of the directories that eats most of my sectors is one where I store all my pictures.

I know I have a lot of duplicate pictures, pictures deduced from master pictures (lower resolution, some editing) and similar pictures (same scene taken 4 or 5 times with different camera settings, hoping to get at least one good shot) but managing them wasn’t easy.

I now played a bit with gqview and this tool seems to provide some features I find very interesting; one of them is the “find duplicates” where you can even search for pictures with “similar” content and I must say that it does work. Of course, nothing is perfect, but I’ve managed to clean up the picture directory so it works for me.

Comments No Comments »