Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib2
- import os
- import json
- from time import sleep
- os.system("clear");
- print """
- IP TRACKER
- """
- ip = raw_input("IP : ")
- url_api = "https://tools.keycdn.com/geo.json?host="
- req = urllib2.Request(url_api + ip)
- opener = urllib2.build_opener()
- f = opener.open(req)
- json = json.loads(f.read())
- if json['status'] == "success":
- print('\n--------------------------------------')
- print "\n"
- print('IP : ' + ip)
- print('Status : ' + json['status'])
- print('RDNS : ' + json['data']['geo']['rdns'])
- print('ISP : ' + json['data']['geo']['isp'])
- print('Lat & Lon : ' + str(json['data']['geo']['latitude']) + '.' + str(json['data']['geo']['longitude']))
- print('Time Zone : ' + json['data']['geo']['timezone'])
- print('Location : ' + str(json['data']['geo']['city']) + ' - ' + str(json['data']['geo']['region_name']) + ', ' + str(json['data']['geo']['country_name']) + ' ( ' + str(json['data']['geo']['continent_name']) + ' ) ')
- print('\n--------------------------------------')
- else:
- print('\n--------------------------------------')
- print "\n"
- print('Status : Failed To Get Data, ReOpening')
- print('\n--------------------------------------')
- sleep(3)
- os.system("python url.py")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement