Blame support/phf_abuse_log.cgi.in

Packit 90a5c9
#!@perlbin@
Packit 90a5c9
#
Packit 90a5c9
# Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
# contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
# this work for additional information regarding copyright ownership.
Packit 90a5c9
# The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
# (the "License"); you may not use this file except in compliance with
Packit 90a5c9
# the License.  You may obtain a copy of the License at
Packit 90a5c9
#
Packit 90a5c9
#     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
#
Packit 90a5c9
# Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
# distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
# See the License for the specific language governing permissions and
Packit 90a5c9
# limitations under the License.
Packit 90a5c9
#
Packit 90a5c9
#
Packit 90a5c9
# This script is used to detect people trying to abuse the security hole which
Packit 90a5c9
# existed in A CGI script direstributed with Apache 1.0.3 and earlier versions.
Packit 90a5c9
# You can redirect them to here using the "<Location /cgi-bin/phf*>" suggestion
Packit 90a5c9
# in httpd.conf.  
Packit 90a5c9
#
Packit 90a5c9
# The format logged to is
Packit 90a5c9
#    "[date] remote_addr remote_host [date] referrer user_agent".
Packit 90a5c9
Packit 90a5c9
$LOG = "/var/log/phf_log";
Packit 90a5c9
Packit 90a5c9
require "ctime.pl";
Packit 90a5c9
$when = &ctime(time);
Packit 90a5c9
$when =~ s/\n//go;
Packit 90a5c9
$ENV{HTTP_USER_AGENT} .= " via $ENV{HTTP_VIA}" if($ENV{HTTP_VIA});
Packit 90a5c9
Packit 90a5c9
open(LOG, ">>$LOG") || die "boo hoo, phf_log $!";
Packit 90a5c9
print LOG "[$when] $ENV{REMOTE_ADDR} $ENV{REMOTE_HOST} $ENV{$HTTP_REFERER} $ENV{HTTP_USER_AGENT}\n";
Packit 90a5c9
close(LOG);
Packit 90a5c9
Packit 90a5c9
print "Content-type: text/html\r\n\r\n<BLINK>Smile, you're on Candid Camera.</BLINK>\n";