Advertisement
Guest User

getipInfo.py

a guest
Jan 21st, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. import yaml
  2. from ipify import get_ip
  3. from geoip import geolite2
  4.  
  5. ip = get_ip()
  6.  
  7. match = geolite2.lookup(ip)
  8.  
  9. print "IP Address: %s" % ip
  10.  
  11. #print match
  12.  
  13. print "Country: %s" % match.country
  14.  
  15. a = match.subdivisions
  16.  
  17.  
  18. b = str(a)
  19. d = b.strip("frozenset")
  20. e = d.strip('()')
  21. f = e.strip('[]')
  22. g = f.strip("''")
  23. print "State: %s" % g
  24.  
  25. if match.country == "US":
  26.    
  27.     print "VPN is offline"
  28.    
  29. else:
  30.    
  31.     print "VPN Active"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement