If you need to know what IP address ranges are allocated for an entire country, you can download a list for each country from the IPdeny website. This would be useful if you wanted to just firewall block an entire country from accessing your server like all of those hackers in China hammering your SSH or web server looking for exploits.
Each list is a plain text file with one CIDR notation address range per line. The plain text file and standard CIDR notation makes parsing the file with a script easy to do. The lists are updated fairly often. Here is the direct link to download the lists: http://www.ipdeny.com/ipblocks/