I'm working on ways to automate the updating of .htaccess
to block IP ranges that have come in and tried to hack the site.
I've been doing it manually for a while, pulling an IP address, then using a web based whois utility to find the range it's in, then manually adding the range to the blocked IP list for the site. It's a pain.
Now I'm parsing the logfile to find the IP address of suspicious entry attempts with a Perl script, and I want to find the IP address range to which that IP address belongs, and maybe pull some other descriptive information that will quickly tell me if this is a range I want to block.
I know it can be done because the web utilities provide the information. Here's an example
.
I can run gethostbyaddr
on them, but that's not what I need.
I've seen some whois modules that had some information, but could not find access to the range to which the IP address belongs. I'm hoping there is a module I can use to pull the address range from to help me speed up the security process.