T
tim
A Perl script I wrote for a CGI is getting spammed. So I'm identifying
and blocking ranges of IP addresses.
At first I used IF statements like this:
# 218.73.64.0 - 218.73.79.255 banned
@ip = split(/\./, $ENV{'REMOTE_ADDR'});
if ($ip[0] == 218 && $ip[1] == 73 && ($ip[2] >= 64 && $ip[2] <= 79)) {
$banned = 1;
}
I know that's probably horrible programming and not very elegant. But
it worked.
Now the list I want to block is getting longer. I could continue to add
IF statements but I feel that's probably stupid.
Any suggestions how I might try to more elegantly process a list of
banned IP's?
Thanks!
--Tim
and blocking ranges of IP addresses.
At first I used IF statements like this:
# 218.73.64.0 - 218.73.79.255 banned
@ip = split(/\./, $ENV{'REMOTE_ADDR'});
if ($ip[0] == 218 && $ip[1] == 73 && ($ip[2] >= 64 && $ip[2] <= 79)) {
$banned = 1;
}
I know that's probably horrible programming and not very elegant. But
it worked.
Now the list I want to block is getting longer. I could continue to add
IF statements but I feel that's probably stupid.
Any suggestions how I might try to more elegantly process a list of
banned IP's?
Thanks!
--Tim