I designed most of, and built a chunk of, the WAF and firewall stuff at Cloudflare. That includes wirefilter (a wireshark display filter inspired firewall), and coupled with Cloudflare using maxmind you get to block ASNs in addition to other characteristics of the request.
With that context, I used bgp.he.net to look up the big ones I know and then wrote the rules.
You can try out our free IP to Country ASN database[0]. You can just grep the IP addresses by looking up the ASN or AS domains. Then just extract the IP address range and you should be good to go. [1]
The paid databases comes with AS type (hosting, ISP, business etc.) and we have a VPN detection database as well.
With that context, I used bgp.he.net to look up the big ones I know and then wrote the rules.