Advertisement
0xCor3

IP TRACKER

Jul 2nd, 2018
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1. import urllib2
  2. import os
  3. import json
  4. from time import sleep
  5.  
  6. os.system("clear");
  7. print """
  8.            IP TRACKER
  9. """
  10. ip = raw_input("IP : ")
  11. url_api = "https://tools.keycdn.com/geo.json?host="
  12. req = urllib2.Request(url_api + ip)
  13. opener = urllib2.build_opener()
  14. f = opener.open(req)
  15. json = json.loads(f.read())
  16. if json['status'] == "success":
  17.     print('\n--------------------------------------')
  18.     print "\n"
  19.     print('IP        : ' + ip)
  20.     print('Status    : ' + json['status'])
  21.     print('RDNS      : ' + json['data']['geo']['rdns'])
  22.     print('ISP       : ' + json['data']['geo']['isp'])
  23.     print('Lat & Lon : ' + str(json['data']['geo']['latitude']) + '.' + str(json['data']['geo']['longitude']))
  24.     print('Time Zone : ' + json['data']['geo']['timezone'])
  25.     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']) + ' ) ')
  26.     print('\n--------------------------------------')
  27. else:
  28.     print('\n--------------------------------------')
  29.     print "\n"
  30.     print('Status    : Failed To Get Data, ReOpening')
  31.     print('\n--------------------------------------')
  32.     sleep(3)
  33.     os.system("python url.py")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement