@sanderson321 -- I did some research and I really cannot find a way via a shell script to determine how to find out where an IP address is registered in which country. I did, however, find a site that allows you to enter the range of IPs and then try to do a 'lookup':
MULTIPLE IP ADDRESS LOOKUP --
http://software77.net/geo-ip/multi-lookup/---
@mplungjan -- Honestly, I highly doubt your going to find an API that does nslookup or whois checks as these are standard applications found on UNIX/Linux platforms.