#Covered by GPL V 2.0 import string import httplib,sys from socket import * import re global word global w global limit global result result =[] limit = 1000 print "\n================================================" print "= Netcraft subdomain Finder V.01 =" print "= Coded by Christian Martorella =" print "= laramies2k@yahoo.com.ar =" print "= Edge-Security Team =" print "================================================" def run(w): h = httplib.HTTP('searchdns.netcraft.com') h.putrequest('GET',"/?host="+w+"&position=limited") h.putheader('Host', 'searchdns.netcraft.com') h.putheader('User-agent','Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051111 Firefox/1.5') h.putheader('Accept-Encoding','gzip,deflate') h.endheaders() returncode, returnmsg, headers = h.getreply() data=h.getfile().read() for e in ('>',':','=','"','<','/','\\','@'): data = string.replace(data,e,' ') r1 = re.compile('[a-zA-Z0-9.-_]*\.'+w) res = r1.findall(data) return res def test(argv): word=sys.argv[1] res = run(word) print "Subdomains found:\n" for x in res: if result.count(x) == 0: result.append(x) for x in result: print x print"\n" def usage(): print "\nUsage: netcrafthost.py domain" print "Ex.: netcrafthost.py microsoft.com\n" sys.exit(1) if __name__ == "__main__": if len(sys.argv) < 2: usage() try: test(sys.argv[1:]) except KeyboardInterrupt: print "Search interrupted by user.." except: sys.exit()