Created
October 21, 2013 01:16
-
-
Save vxf/7077357 to your computer and use it in GitHub Desktop.
python script to quickly geolocate ip addresses en masse with libgeoip ( cat ips.txt | python ip2geo.py )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, GeoIP, fileinput | |
geo = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE) | |
for line in fileinput.input(): | |
try: | |
print(geo.country_code_by_addr(line.strip())) | |
except IOError: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment