Page is a not externally linkable
- Local
-- Foo
---- Attack of the Robots, Spiders, Crawlers.etc


Brett_Tabke - 10:12 pm on Dec 1, 2005 (gmt 0)


2by4 - also noticed that folks that run with bot names, are most often bots trying to slip by filters and thus end up autobanned by the cron job at the end of the day.

eg: if you have an ip that has been banned and you are running as a bot name - that's why...

Actual ip parsing is left as an excersize to the reader:

#####################
#!/usr/bin/perl

#use CGI::Carp qw (fatalsToBrowser);

print "Content-type: text/plain\n\n"; # if needed...

$ip = $ENV{'REMOTE_ADDR'};
$hta= ".htaccess";

&GetHtaccess;
# print "s $success $ip" if $debug;
&BurnIP($ip);
&PutHtaccess;

sub BurnIP {
$z=shift;
foreach $t (@htaccess) {
if ($t =~ /deny from/gi &&!$done) {
$t.=" $z";
$done++;
push(@out,$t);
}
else {
push(@out,$t);
}
}
if (!$done) {
push(@out,qq¦\ndeny from $z\n¦);
}
undef @htaccess;
@htaccess=@out;
undef @out;
}

sub PutHtaccess {
open(FILE2,">$hta");
foreach $t (@htaccess) {
print FILE2 "$t\n";

}
close(FILE2);
}

sub GetHtaccess {
return(0) if!-e "$hta";
open(FILE3,"$hta");
@htaccess =<FILE3>;
chomp @htaccess;
close(FILE3);
1;
}

#####################


Thread source:: http://www.webmasterworld.com/foo/9618.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com