Should anyone ask, I prefer my neighbours to see up-side down images.
It’s the silly season here and I noticed I had a couple more people using my wireless access points to check their email and surf the web. Since all traffic goes through a transparent proxy on my network I decided to have a little fun with the redirect_program directive in my squid.conf configuration file. I set it to:
redirect_program /home/simon/bin/redirect.pl
and then added the following to redirect.pl:
#!/usr/bin/perl $|=1; $count = 0; $pid = $$; while () { chomp $_; if ($_ =~ /(.*.jpg)/i) { $url = $1; system("/usr/bin/wget", "-q", "-O","/var/web/www.imaginator.com/squid/$pid-$count.jpg", "$url"); system("/usr/bin/mogrify", "-flip","/var/web/www.imaginator.com/squid/$pid-$count.jpg"); system("/bin/chmod", "a+r","/var/web/www.imaginator.com/squid/$pid-$count.jpg"); print "http://www.imaginator.com/squid/$pid-$count.jpgn"; } elsif ($_ =~ /(.*.gif)/i) { $url = $1; system("/usr/bin/wget", "-q", "-O","/var/web/www.imaginator.com/squid/$pid-$count.gif", "$url"); system("/usr/bin/mogrify", "-flip","/var/web/www.imaginator.com/squid/$pid-$count.gif"); system("/bin/chmod", "a+r", "/var/web/www.imaginator.com/squid/$pid-$count.gif"); print "http://www.imaginator.com/squid/$pid-$count.gifn"; } elsif ($_ =~ /(.*.png)/i) { $url = $1; system("/usr/bin/wget", "-q", "-O","/var/web/www.imaginator.com/squid/$pid-$count.png", "$url"); system("/usr/bin/mogrify", "-flip","/var/web/www.imaginator.com/squid/$pid-$count.png"); system("/bin/chmod", "a+r", "/var/web/www.imaginator.com/squid/$pid-$count.png"); print "http://www.imaginator.com/squid/$pid-$count.pngn"; } else { print "$_n";; } $count++; }
Resulting in:
and an evil laugh.