[clue-tech] Fun perl script
Bamm Visscher
bamm.visscher at gmail.com
Thu Aug 3 12:15:54 MDT 2006
You're looking at a redirector, so you'd need to pull the web page in
question (wget), modify it to meet your needs (s/foo/bar/g) and then
serve up the new page from with your HTTP server.
Try something like the following for modifying any page with a .html suffix:
elsif ($_ =~ /(.*\.html)/i) {
$url = $1;
$infile = "/var/www/html/mangled_pages/$pid-$count.tmp.html"
$outfile = "/var/www/html/mangled_pages/$pid-$count.html"
system("/usr/bin/wget", "-q", "-O","$infile", "$url");
open (INFILE, "$infile");
open (OUTFILE, "> $outfile");
while (<INFILE>) {
chomp;
$out = $_;
# Make your subs here.
$out =~ s/foo/bar/g;
print OUTFILE "$out\n";
}
close(INFILE);
unlink($infile);
close(OUFILE);
print "http://127.0.0.1/mangled_files/$pid-$count.html\n";
On 8/3/06, Mike Staver <staver at fimble.com> wrote:
> Well, since I wasn't able to use squid to search and replace words on an
> html document as it's being served, I had to settle for the image
> flipping. It worked quite well, here's one example of a company wide
> message that got sent out this morning:
> ---------------------------------------------------------------
>
> Hi -
> Has anyone else logged into the website today?
> There is something weird about it...
> Amy
>
> ---------------------------------------------------------------
>
> You gotta love mass confusion :)
>
> William wrote:
> > Mike Staver wrote:
> >> That's, that's what I was looking for. I'll see what kind of havoc I
> >> can cause today.
> > Please share the fun stories that are sure to come out of this! :)
> >
> > _______________________________________________
> > clue-tech mailing list
> > clue-tech at cluedenver.org
> > http://www.cluedenver.org/mailman/listinfo/clue-tech
>
> --
>
> -Mike Staver
> staver at fimble.com
> mstaver at globaltaxnetwork.com
> _______________________________________________
> clue-tech mailing list
> clue-tech at cluedenver.org
> http://www.cluedenver.org/mailman/listinfo/clue-tech
>
--
sguil - The Analyst Console for NSM
http://sguil.sf.net
More information about the clue-tech
mailing list