Thursday, April 27, 2006

Shell games

Though not the pea under the thimble trick![^]

Nope, this is a trick I played on Cliff many years ago when we worked at Hewlett Packard Australia on a 4GL language product.

Our development system was a Unix box with character based terminals. Sometime after I left HP I visited some friends there and they'd advanced to using X Windows and I have to say that the idea of having wallpaper and icons in 1989 seemed pretty cool. Very few of us were serious about using Windows in 1989 - it was pretty much a toy operating system back then.

You could send a particular escape sequence to the terminal and it'd lock the keyboard. Send another escape sequence and it'd unlock. Being children in adult guise with high tech toys to play with, we frequently sent the lock escape sequence to /dev/ttyXX to lock up someones terminal. They'd type something, see that it didn't appear, look around, see the smirk and swear! Then we'd send the unlock sequence and work went on.

After a while that got boring. So I wrote a script that monitored the victims home directory. Every 60 seconds it'd check the length of the .kshhistory file (I may have the filename wrong) and if the file had changed it'd wait another 60 seconds and send the terminal lock sequence. Then it'd wait a random amount of time between 5 and 30 seconds and send the unlock sequence. The beauty of this scheme is that if the victim didn't run any shell commands nothing happened. If the victim did run the odd command the random time delay hid the relationship. It took the victim literally weeks to conclude that some bastard (ie, me) was running a script against them!

Need I even say that Cliff was the first victim?

No comments: