###### listing 1 ###### #!/usr/bin/perl -Tw use strict; print STDERR join (" ", map "[$_]", scalar localtime, "404 ERROR", map { $ENV{$_} || "-" } qw(REDIRECT_URL REMOTE_HOST HTTP_REFERER)), "\n"; my $red_url = $ENV{REDIRECT_URL} || "?unknown?"; eval { if ($red_url =~ /^\/~.*/s) { my $html = $red_url; $html =~ s/[\x00-\x20"<&>"\x80-\xff]/&\#@{[ord$&]}\;/g; my $tp_html = "http://www.teleport.com$html"; print <File Not found

File Not found

The requested URL $html was not found on this server.

Perhaps you were looking for something at Teleport's web-server, such as $tp_html? DQ exit 0; } }; print <<"DQ"; Content-type: text/html Status: 404 Not Found File Not found

File Not found

The requested URL $red_url was not found on this server.

Try looking at the home page. DQ ###### listing 2 ###### #!/usr/bin/perl use strict; $|=1; use LWP::Simple; my $LOGDIR = "/home/merlyn/Logs"; @ARGV = ( (map { "gunzip <$_|" } <$LOGDIR/error_log.*[0-9].gz>), <$LOGDIR/error_log.*[0-9]>, "$LOGDIR/error_log", ); my %seen; while (<>) { next unless /404 ERROR/; s/^\[//; s/\]\s*$//; my @fields = split /\] \[/; my ($time, $wanted, $ref) = @fields[0,2,4]; next unless $ref =~ /^http:/; # solid HTTP fetch next if $ref =~ /\?/; # no CGI searches next if $seen{$ref}++; # once only print "[$time $wanted $ref]\n"; my $content = get $ref; unless (defined $content) { print "... content not available\n"; next; } my @stonehenge = $content =~ /(\S*stonehenge\S*)/mig; if (@stonehenge) { print map " hit: $_\n", @stonehenge; print map " mailto: $_\n", $content =~ /(\S*mailto:\S*)/mg; } }