smziaurrashid

Reverse IP & Domain Details Script

Jul 29th, 2015
1,632
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.74 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import urllib, urllib2
  4. import cookielib
  5. import re, sys, os
  6.  
  7. os.system('cls' if os == "nt" else "clear")
  8.  
  9. h = sys.argv[1]
  10.  
  11. demo = '''
  12. |-------------------------------------------------
  13. | Reverse IP & Domain Details Script
  14. | Love To: TiGER-M@TE, Ne0-h4ck3r, F0RTYS3V3N
  15. | Use: python reverseip.py site.com
  16. |-------------------------------------------------
  17. '''
  18.  
  19. print demo
  20. print ""
  21. print "1. Reverse IP "
  22. print "2. Domain Information "
  23. print ""
  24.  
  25. ans = raw_input('Select your Options: ')
  26. print ""
  27.  
  28. def domain():
  29.        
  30.         try:
  31.             if ans == "1":
  32.                 cj = cookielib.CookieJar()
  33.                 opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
  34.                 opener.addheader = [('User-Agent', 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0')]
  35.                 url = "http://viewdns.info/reverseip/?host="+h+"&t=1"
  36.  
  37.                 uagent= {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0'}
  38.                 ip = urllib2.Request(url, headers=uagent)
  39.                 site = opener.open(ip).read()
  40.              
  41.                 reverse = re.findall('<tr><td>\S+</td><td', site)
  42.                      
  43.                 for neo in reverse:
  44.                     s = neo.replace('<tr><td>', "").replace('</td><td', "")
  45.                     if s.startswith("http//"):
  46.                         pass
  47.                     else:
  48.                         print "http://" + s
  49.            
  50.             elif ans == "2":
  51.                 Domain_Info = "http://www.viewdns.info/whois/?domain=" + h
  52.                 whoi = urllib2.urlopen(Domain_Info).read()
  53.                
  54.                 yes = re.findall('<font size="2" face="Courier">(.*)><tr></tr>', whoi)
  55.                
  56.                 for lucy in yes:
  57.                     p = lucy.replace('<br>', "\n").replace("</td></tr", "")
  58.                     if "DNSSEC" in p:
  59.                         print p.split("DNSSEC")[0]
  60.                     elif 'Disclaimer' in p:
  61.                         print p.split("Disclaimer")[0]
  62.            
  63.                        
  64.         except Exception, e:
  65.                 print e
  66.                
  67.  
  68. domain()
Advertisement
Add Comment
Please, Sign In to add comment