清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#!/usr/bin/python2.7 # -*- coding:utf-8 -*- import urllib,urllib2 import re import subprocess import sys output='' def html(html): #print str response=urllib2.urlopen(html) return str(response.readlines()) def getpage(html): pattern=re.compile("\.\.\.\s(\d+)",re.S) #print html p=pattern.findall(html) #print '页数为:'+p[0] if len(p)==0: print '无查询结果' exit() else: return int(p[0]) def getAllDomain(html): #print html pattern1=re.compile("t<a\shref=\"http://(.*?)/\"\srel",re.S) domain=pattern1.findall(html) result=[] i=0 #print domain for pp in domain: result.append(pp) i+=1 return result def nslookup(domain): ns=subprocess.Popen('nslookup '+domain,shell=True,stdout=subprocess.PIPE) ns_result=ns.stdout.read() #print ns_result #如果nslookup输出不一样需要修改正则,正则不会写,很多疏漏,简单写下能实现就行 re_domain=re.compile("Name:\t([\s\S\w\W]*?)\nAddress:([\s\S\w\W]*?)\n", re.S) return re_domain.findall(ns_result) def nslookupThread(allDomain): for d in allDomain: r=nslookup(d) #跳过未查询到的 if len(r)==0: continue for i in range(len(r)): x=r[i][0].strip() y=r[i][1].strip() #print '%s:%s' % (x,y) #提取解析到此ip的域名 if cmp(y,ip)==0: print x