Skip to content

Instantly share code, notes, and snippets.

@supertask
Created March 4, 2016 06:35
Show Gist options
  • Save supertask/c4ce5ef91222906f3f14 to your computer and use it in GitHub Desktop.
Save supertask/c4ce5ef91222906f3f14 to your computer and use it in GitHub Desktop.
A script finding a real address from ip address.
import geoip2.database
reader = geoip2.database.Reader('/usr/local/share/Geoip/GeoLite2-City.mmdb')
import sys
ip_address = raw_input('ip address -> ')
response = reader.city(ip_address)
print "%s, %s, %s" % (response.country.name, response.subdivisions.most_specific.name, response.city.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment