Generate MaxMind format GeoIPASNum.dat from
Python Shell
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

GeoIPASNum Generator

MaxMind's version of ASN database doesn't include overriden description (e.g. or CIDRs that are announced by multiple ASNs (e.g.

This set of scripts will get ASNs from and generate (legacy) MaxMind format GeoIPASNum.dat.

How to use

  1. Run bash ./ to generate all ASNum list and save to asn.txt.
  2. Start your socks5 proxies starting from port 60000 (60000, 60001, ...), modify TCNT in to the proxies you have.
  3. Run python ./ This will generate GeoIPASNumC.csv and GeoIPASNumCv6.csv
  4. Run cat GeoIPASNumC.csv |sort -n|uniq > GeoIPASNum1.csv
  5. Run cp GeoIPASNum1.csv GeoIPASNum1v6.csv && cat GeoIPASNumCv6.csv |sort -n|uniq >> GeoIPASNum1v6.csv
  6. Run python ./ This will generate GeoIPASNum2.csv
  7. Run python ./ ipv6. This will generate GeoIPASNum2v6.csv
  8. Run python ./ -w GeoIPASNum2.dat mmasn GeoIPASNum2.csv. This will generate GeoIPASNum2.dat
  9. Run python ./ -w GeoIPASNum2v6.dat mmasn6 GeoIPASNum2v6.csv. This will generate GeoIPASNum2v6.dat
  10. Run bash ./, bash ./ and bash ./ to download other resources.


  • GeoIPASNum2.dat is a IPv4 only version, GeoIPASNum2v6.dat supports both IPv4 and IPv6.
  • is stolen from mteodoro/mmutils.
  • The function to bypass browser test for is deleted to prevent from bad guys XD. You should figure how it works and implement it in ccbypass of
  • will combine ASN descriptions if they have same CIDR. If there's containing relation, it will substrate smaller block from bigger block.
  • Files are cached in html folder and will expire in 5 days.


See also

Set up a light weight GeoIP query server using OpenResty