Firefox Russian Roulette in Bash

an evil revenge prank

A few years ago I worked in a small team of systems administrators, some of the best I’ve ever worked with. We all got on with each other very well and are still good friends to this day. It was always great fun working in that closely knit team.

We played pranks on each other often, especially if someone left their computer unlocked. Pictures of goats as desktop backgrounds and embarrassing posts to Facebook (“Just got out on bail…“) were the norm.

I left my machine unlocked once and worse, had left a root shell terminal open. The buggers changed my Xorg server configuration to make it listen on the network (-listen tcp) and ran xhost + to accept and trust all connections. I didn’t notice.

Once that was done, they used xspy (I can’t find a copy of the original source by John A. Maxwell) to connect to my Xorg server, sniff my X11 traffic and capture my keystrokes. They had captured almost all of my passwords after a week or two (they sat on it and kept quite for a while before doing anything else) and then did a fair bit of damage on my Facebook account, email signature, and shell (they added a small, random amount of sleep to ${PROMPT_COMMAND}).

Revenge is best served cold

I got my own back on the ring leader of this set of pranks though, when one day he left his machine unlocked (he was only a few feet away with his back turned), but I managed to launch a new terminal window and quickly wrote this while loop:

while true
    do [ $[ ${RANDOM} % 6 ] = 0 ] && echo killall -9 firefox
    sleep 30
done

Once that was done, I resized the terminal window to as small as I could make it, and dragged it off the side of the screen where it was barely visible.

The result of this loop was a one in six chance of Firefox (the only browser he used) being killed every 30 seconds. This was brilliant as sometimes hours would pass without Firefox dying, other times it would die every few minutes.

This drove my poor victim nuts - he was convinced one of the plugins like the Flash player was the culprit. He struggled for days to fix the problem, rebuilding Firefox, Flash etc (he ran OpenBSD) and trying different combinations of plugins enabled/disabled. Eventually he rebuilt his entire system and rebooted.

This appeared to fix the problem, but in reality rebooting simply killed my while loop. When I eventually told him it was me, he was furious but agreed that we were even after the total pwnage of my Xorg server and passwords.

It took him a little while longer to figure out that I had also aliased grep to grep -v :-D