Created
December 21, 2016 01:02
-
-
Save Sh1n0g1/86a0bdcacb8e75b79ce7661bbe345cc5 to your computer and use it in GitHub Desktop.
IP2geolocation
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
#Bulk IP Address 2 Geolocation Using freegeoip.net | |
#Input: IP Address List | |
#Output: IP, Latitude, Longitude (CSV Format) | |
import urllib, json | |
#Paste your ipaddress list | |
ips=""" | |
1.1.1.1 | |
2.2.2.2 | |
3.3.3.3 | |
""" | |
for ip in ips.splitlines(): | |
if ip != "": | |
url = "http://freegeoip.net/json/" + ip | |
response = urllib.urlopen(url) | |
data=json.loads(response.read()) | |
print ip + "," + str(data['latitude']) + "," + str(data['longitude']) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment