IP addresses to countries



I have a file full of unique IP addresses, one per line, from
machines that I block access to my server. At present I use a
script to add each individual IP to an iptables ruleset.

I've collected over a hundred, and I am interested in the
statistics of what countries they are commonly from. I know I
could manually check each one but would prefer, obviously, to use
a simple script to do the job as the list grows.

What I would like the script to do is check each IP address, get
the IP block/range it belongs to along with what country it's
from. Would you use whois $IP_ADDR, grep 'inetnum' and
'country'? When I tried manually on a couple, I got "Unknown AS
number or IP network. Please upgrade this program."

Any ideas/pointers?

--
Troy Piggins | http://piggo.com/~troy
RLU#415538 ,-O (o- O
O ) //\ O
`-O V_/_ OOO
.



Relevant Pages