Skip to content

Instantly share code, notes, and snippets.

@whoo
Created October 10, 2019 00:45
Show Gist options
  • Save whoo/527a231eab8c5bad334d4c39bf9da08f to your computer and use it in GitHub Desktop.
Save whoo/527a231eab8c5bad334d4c39bf9da08f to your computer and use it in GitHub Desktop.
test
# wget "https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz"
#
import geoip2.database
reader = geoip2.database.Reader('./GeoLite2-City.mmdb')
listtt="""
8.8.8.8
123.12.12.12
23.23.2.2
"""
ip="127.0.0.1"
for l in listt.split("\n"):
if (l is not ""):
response = reader.city(l)
print("{};{};{} ".format(l,response.country.iso_code, response.city.name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment