#!/usr/bin/perl # #AutoProxyChecker1.0 # # # ##This Script check ProxyServer automaticaly. # port 8080,3128,80 #Result is written in allow/deny file. #Before Checking, compare allow/deny file & input host list. # #You must setup penv.cgi on other server. # #penv.cgi'source ##! /usr/local/bin/perl #print "Content-type: text/plain\n\n"; #print "kusi-ok-desu\n"; # foreach (sort keys %ENV){ # print "$_=$ENV{$_} \n"; # } #exit; #__END__ #If your server forbids the use of socket, this script don't work. #SET UP #nph-prox.cgi (755) #log.dat (666) #deny.dat (666) #allow.dat (666) #lock (directory:777) $|=1; #perl' magic word $cginame='nph-prox.cgi'; $method = 'POST'; $title = 'AutoProxyChecker'; $body='
'; $checkmax =30;#one session checkking host's maximum $timeout = 15;#15sec, timeout $new_file = './log.dat';#input host data is written here(666) $deny_file = './deny.dat';#host data which is Access denied(666) $allow_file = './allow.dat';#host data which is Access allowed(666) #Important !!! $host = 'www.myhost.com';#Host name where This Script set up. $ip = '200.0.1.102';#IP address where This Script set up. $uri='http://www.foo.bar.com/~zzz/penv.cgi';#penv.cgi URL ## print "HTTP/1.0 200 OK\n"; #&jikan;#if you need.. (STOP 8:00AM- 10:00PM) &lock;#forbidden to work doubly. &decode; &html if($buffer eq '');#Input form HTML &html unless( ($ENV{'HTTP_REFERER'} eq '') || ($ENV{'HTTP_REFERER'} =~/$cginame/));#invald access ?? if ($] >= 5.0) { # socket use eval 'use Socket'; } else { eval 'require "sys/socket.ph"'; } #$printall = '0';#debug... Print all data $Referer = 'http://www.goo.ne.jp/'; $From = ''; $machine='';$port=''; $cmd = "GET $uri HTTP/1.0\r\n"; $cmd .= "User-Agent: Mozilla/4.04; (Neko/98; G3)\r\n"; $cmd .= "Pragma: no-cache\r\n"; $cmd .= "Referer: $Referer\r\n" if $Referer; $cmd .= "From: $From\r\n" if $From; $cmd .= "Accept: */*\r\n"; $cmd .= "\r\n"; &mainprog; &ended(); ################################### sub mainprog{ print "Content-type: text/html\n\n"; print <<"_HTML_";