Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Subdomains Grabber
- #By INJ3CTOR_M4 // facebook.com/H4ck19
- import re, urllib2, socket, os, sys
- from urlparse import urlparse
- from platform import system
- if system() == 'Linux':
- os.system('clear')
- if system() == 'Windows':
- os.system('cls')
- def Bing_sub(domain):
- alldomains = []
- i = 1
- while True:
- bing = urllib2.urlopen('http://www.bing.com/search?q=domain:'+domain+'&first='+str(i)+'&go=&filt=all&FORM=PERE2').read()
- data = re.findall('<h2><a href="(.*?)"', bing)
- for domains in data:
- domains = urlparse(domains)
- alldomains.append(domains.netloc.replace('www.', ''))
- i+=10
- if not re.search('class="sb_pagN"', bing):
- break
- return list(set(alldomains))
- try:
- domain = sys.argv[1]
- os.unlink('subdomains.txt')
- i = 0
- for b in Bing_sub(domain):
- print (b+' : '+socket.gethostbyname(b))
- subdomains = open('subdomains.txt', 'ab')
- subdomains.write('http://'+b+'\r\n')
- subdomains.close()
- i+=1
- print 'Number of Subdomains : '+str(i)
- except IndexError:
- print '\t\tUsage: python '+sys.argv[0]+' [site.com]\n'
Advertisement
Add Comment
Please, Sign In to add comment