I've actually done this before. Back 3 or 4 years ago, probably as a repercussion of the great firewall of China, all Chinese traffic seemed to always have one ASN in common. We used to have a regular DDoS against a server, and the DDoS always originated from China. I'm guessing it was a botnet that comprised of hosts infected by something that was only available in China or to people that read/write Chinese.
Either way, if you can get a full BGP feed, back then it was trivial to script an ACL that blocked all China IPs. Alternatively the public FTP servers that APNIC offer may allow you to do the same. I've parsed their public information with a bit of awk before to make lists of IPs for individual countries. I also considered doing something using Quagga and communities but never got around to it.
Eventually the DDoSes eased and we stopped blocking Chinese IPs to this server.
YMMV etc.
Cheers
Dave