Guest User

Untitled

a guest
Jan 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import urllib2
  2. import re
  3.  
  4. ## Open Connection ##
  5. opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
  6. oururl = opener.open('http://www.ip-lookup.net')
  7.  
  8. ## IP Addresss finder ##
  9. theIP = re.compile(r"d{1,3}.d{1,3}.d{1,3}.d{1,3}")
  10. ip = re.search(theIP, str(oururl))
  11.  
  12. ## Country finder ##
  13. roughCountry = re.compile('([A-Z]w+)( [A-Z]w+){0,2}(?=</a>ss)')
  14. Country = re.search(roughCountry, str(oururl))
  15.  
  16. ## Print out ##
  17. print "Your IP is:", ip
  18. print "Your Country is:", Country
Add Comment
Please, Sign In to add comment