[clue-tech] Fun perl script
Mike Staver
staver at fimble.com
Tue Aug 1 09:33:49 MDT 2006
I'm hoping some of you perl hackers out there can help me with this. I
got a squid proxy up and running like was mentioned in this funny article:
http://www.ex-parrot.com/~pete/upside-down-ternet.html
I had never used squid before, but it didn't take me long to figure out
how to set it up and point it at the redirector script, which I had to
slightly modify for my own purposes:
#!/usr/bin/perl
$|=1;
$count = 0;
$pid = $$;
while (<>) {
chomp $_;
if ($_ =~ /(.*\.jpg)/i) {
$url = $1;
system("/usr/bin/wget", "-q",
"-O","/space/WebPages/images/$pid-$count.jpg", "$url");
system("/usr/bin/mogrify",
"-flip","/space/WebPages/images/$pid-$count.jpg");
print "http://10.0.0.16/squid/$pid-$count.jpg\n";
}
elsif ($_ =~ /(.*\.gif)/i) {
$url = $1;
system("/usr/bin/wget", "-q",
"-O","/space/WebPages/images/$pid-$count.gif", "$url");
system("/usr/bin/mogrify",
"-flip","/space/WebPages/images/$pid-$count.gif");
print "http://10.0.0.16/squid/$pid-$count.gif\n";
}
else {
print "$_\n";;
}
$count++;
}
Since I've not done much in perl before, I'm a little confused as to
where the source code of the webpage comes into play here. Which
variable would it be? I ask because I'd like to run something like this
against the source of the page:
$source =~ s/Bush/Kerry/g;
It's my understanding that this line will scan the entire document and
replace the word Bush with the word Kerry... imagine the fun you could
have with this, replacing words like Israel with Canada? If anyone can
help me modify this script for use with squid before I unleash it on my
victims in the office today, I'd be very grateful :)
--
-Mike Staver
staver at fimble.com
mstaver at globaltaxnetwork.com
More information about the clue-tech
mailing list