8000 GitHub - analogic/ipgeo: Public datasets with IP-country pairs, updated daily · GitHub
[go: up one dir, main page]

Skip to content
analogicPublic

About

Public datasets with IP-country pairs, updated daily

Resources

Stars

57 stars

Watchers

3 watching

Forks

Repository files navigation

IPGeo

Daily updated free database of subnet-country and subnet-ASN pairs usable in various purposes. It is open, lightweight and less accurate alternative to Maxmind's GeoLite (without cities, latitude and longitude).

ipgeo-country.mmdb

  • same structure as GeoLite2-Country (database type IPGeo), names in English only
  • example result {"country": {"iso_code": "CZ", "names": {"en": "Czechia"}}, "continent": {"iso_code": "EU", "names": {"en": "Europe"}}}

ipgeo-asn.mmdb

  • same structure as GeoLite2-ASN (database type IPGeo-ASN)
  • example result {"autonomous_system_number": 13335, "autonomous_system_organization": "CLOUDFLARENET - Cloudflare, Inc."}
  • autonomous_system_organization is missing for few ASNs without name in RIPE list
  • addresses not announced in BGP are not found

ipgeo.mmdb

  • combination of ipgeo-country.mmdb and ipgeo-asn.mmdb in one database (database type IPGeo-Country-ASN)
  • example result {"country": {"iso_code": "AU", ...}, "continent": {"iso_code": "OC", ...}, "autonomous_system_number": 13335, "autonomous_system_organization": "CLOUDFLARENET - Cloudflare, Inc."}

All .mmdb files can be read by any MaxMind DB reader (e.g. maxminddb for Python, mmdblookup). Libraries checking database type (e.g. Python geoip2) mostly refuse them, use generic reader there (maxminddb.open_database(...).get(ip)).

db.sql

  • country data only, meant to be imported to sqlite3 with command:

    sqlite3 ip.sqlite < db.sql

    Subnets should be searched in subnet_all view with normalized IP's converted to binary form like this:

    sqlite> select country_code, country_name, continent_code, continent_name from subnet_all where start <= X'291324F3' and `end` >= X'291324F3';
    ZA|South Africa|AF|Africa
    

    Same queries work for IPv4 (4 bytes) and IPv6 (16 bytes) in binary form

all.ipv4.csv, all.ipv6.csv

  • comma delimited csv continent,country,cidr
  • example EU,CZ,104.254.80.0/21

asn.ipv4.csv, asn.ipv6.csv

  • comma delimited csv asn,cidr,organization (organization quoted when needed)
  • example 13335,1.0.0.0/24,"CLOUDFLARENET - Cloudflare, Inc."
  • prefixes may overlap (more specific routes inside less specific), mmdb lookup returns the most specific one

by-country/, by-continent/

  • one CIDR per line, file named by country (by-country/CZ) or continent code (by-continent/EU), IPv6 in .ipv6 files (by-country/CZ.ipv6)
  • ready for ipset, firewall rules etc.

About

Public datasets with IP-country pairs, updated daily

Resources

Stars

57 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

0