home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 April / PCO0499.ISO / filesbbs / os2 / apach134.arj / APACH134.ZIP / src / support / phf_abuse_log.cgi < prev    next >
Encoding:
Text File  |  1996-10-08  |  785 b   |  22 lines

  1. #!/usr/local/bin/perl
  2.  
  3. # This script can be used to detect people trying to abuse the security hole which
  4. # existed in A CGI script direstributed with Apache 1.0.3 and earlier versions.
  5. # You can redirect them to here using the "<Location /cgi-bin/phf*>" suggestion in
  6. # httpd.conf.  
  7. #
  8. # The format logged to is "[date] remote_addr remote_host [date] referrer user_agent".
  9.  
  10. $LOG = "/var/log/phf_log";
  11.  
  12. require "ctime.pl";
  13. $when = &ctime(time);
  14. $when =~ s/\n//go;
  15. $ENV{HTTP_USER_AGENT} .= " via $ENV{HTTP_VIA}" if($ENV{HTTP_VIA});
  16.  
  17. open(LOG, ">>$LOG") || die "boo hoo, phf_log $!";
  18. print LOG "[$when] $ENV{REMOTE_ADDR} $ENV{REMOTE_HOST} $ENV{$HTTP_REFERER} $ENV{HTTP_USER_AGENT}\n";
  19. close(LOG);
  20.  
  21. print "Content-type: text/html\r\n\r\n<BLINK>Smile, you're on Candid Camera.</BLINK>\n";
  22.