Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../server/etc/scripts/squid/remove-ip
Real path: /www/server/etc/scripts/squid/remove-ip
Zurück
#!/usr/bin/perl # cleanup.pl V0.1 05-03-1997 by ftpsoft # Usage: # % cleanup [-y] inputfiles # Output on stdout # If -y is specified, use NIS to get local hosts. # Removes requests from local hosts from access logfiles # Default: local hosts from informatik.hu-berlin: # 141.20.20.x - 141.20.29.x # 141.20.31.x - 141.20.39.x if ($#ARGV > -1 && $ARGV[0] eq "-y") { shift(@ARGV);$USENIS = 1; } else { $USENIS = 0; } if ( $USENIS ) { open(YPCAT,"ypcat hosts|");$nCnt = 0; while(<YPCAT>) { chop($_); ($ip,$trash) = split(/ /, $_, 2); if ( $ip =~ /\d+\.\d+.*/ ) { @localhost[$nCnt++] = $ip; } } $nBytes = 4; # Compare all bytes of IP-Address } else { @localhost = ("141.20.20.", "141.20.21.", "141.20.22.", "141.20.23.", "141.20.24.", "141.20.25.", "141.20.26.", "141.20.27.", "141.20.28.", "141.20.29.", "141.20.31.", "141.20.32.", "141.20.33.", "141.20.34.", "141.20.35.", "141.20.36.", "141.20.37.", "141.20.38.", "141.20.39." ); $nBytes = 3; } while (<>) { chop($_); # get host IP ($waste1,$waste2,$hostip,$trash) = split(/ +/, $_, 4); ($hostip1,$hostip2,$hostip3,$hostip4) = split(/\./, $hostip, 4); if ( $nBytes == 3 ) # We are lazy - default is 4. { # remove last bye of ip $hostip = $hostip1.".".$hostip2.".".$hostip3."."; } foreach $ip (@localhost) { if ($ip eq $hostip) { $hostip = "local";last; } } if ($hostip ne "local") { print $_, "\n"; } }