From d8c54cd177536c9077325b7c159f88a12b2a2a68 Mon Sep 17 00:00:00 2001 From: neptune Date: Fri, 28 May 2021 02:11:20 -0400 Subject: Actualizado a GeoLite2 --- cgi/GeoIP.dat | Bin 878459 -> 0 bytes cgi/GeoLite2-Country.mmdb | Bin 0 -> 3990267 bytes cgi/framework.py | 6 ++++-- 3 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 cgi/GeoIP.dat create mode 100644 cgi/GeoLite2-Country.mmdb (limited to 'cgi') diff --git a/cgi/GeoIP.dat b/cgi/GeoIP.dat deleted file mode 100644 index b98993c..0000000 Binary files a/cgi/GeoIP.dat and /dev/null differ diff --git a/cgi/GeoLite2-Country.mmdb b/cgi/GeoLite2-Country.mmdb new file mode 100644 index 0000000..90c1146 Binary files /dev/null and b/cgi/GeoLite2-Country.mmdb differ diff --git a/cgi/framework.py b/cgi/framework.py index 94f6f30..faea8d9 100644 --- a/cgi/framework.py +++ b/cgi/framework.py @@ -108,8 +108,10 @@ def getCountry(ip): if ":" in ip: return "v6" else: - import geoip - return geoip.country(ip) + import geoip2.database + with geoip2.database.Reader('GeoLite2-Country.mmdb') as reader: + response = reader.country(ip) + return response.country.iso_code def getHost(ip): -- cgit v1.2.1-18-gbd029