PYTHON自动化WEB旁注目录扫描器
#!/usr/bin/env python#encoding = utf-8import urllib,httplibfrom urllib2 import Request, urlopen, URLErrorimport Queue,sys,timeimport reimport socketimport sysfrom urlparse import urlparseclass Scanner(): def __init__(self): alldomains = self.getdomains() print "There are %d website in the same server" % len(alldomains) time.sleep(2) print "Starting The Scanning[*.*]/n==============================" for aim in alldomains: if(self.verifydomain(aim)): for path in paths: url = 'http://'+aim+path headers = { 'User-Agent' : 'Mozilla/5.0 (compatible; Googlebot/2.1; +[url]http://www.google.com/bot.html[/url])' } req = Request(url, None, headers) try: response = urlopen(req) except URLError, e: #if hasattr(e, 'reason'): # print url,'[x] Not Found' #elif hasattr(e,'code'): # print url,'[x]Not Found' if hasattr(e, 'reason'): print url,'[x] Not Found' elif hasattr(e, "code") and e.code == 401: record = "<a href=/"%s/">%s</a>===>FOUND" % (url,url) print url," [OK] Found" self.writeresult(record) elif hasattr(e, "code") and e.code == 403: record = "<a href=/"%s/">%s</a>===>FOUND" % (url,url) print url," [OK] Found" self.writeresult(record) elif hasattr(e, "code") and e.code == 500: record = "<a href=/"%s/">%s</a>===>FOUND" % (url,url) print url," [OK] Found" self.writeresult(record) else: record = "<a href=/"%s/">%s</a>===>FOUND" % (url,url) print url," [OK] Found" self.writeresult(record) def getdomains(self): doreq = Request('http://domains.yougetsignal.com/domains.php?remoteAddress='+ domain) response = urlopen(doreq) html = response.read() response.close() #domains = re.findall(r'(/[/".*?/",/s+/".*?/"/])',html) domains = re.findall(r'/[/"(.*?)/"',html) #print domains #for val in domains: # print val # print self.verifydomain(domains[1]) return domains def verifydomain(self,domains): try: Originalhost = socket.getaddrinfo(domain,None)[0][4][0] #print Originalhost domainip = socket.getaddrinfo(domains,None)[0][4][0] #print domainip if(domainip==Originalhost): return True else: return False except: print domains+' connect issue!' def writeresult(self,record): fp = open(domain+'.html','a+') fp.writelines(record+'') fp.close() def usage(self): print "Usage: WebGrabs.py domain dict /n" print "/nExamples:WebGrabs.py [url]www.google.com[/url] dict.txt" #domain = raw_input('Url Path>>')#dic = raw_input("Wordlist Path>>") domain = raw_input('Url Path>>')dic = raw_input('Wordlist Path>>')paths = [line.rstrip() for line in open(dic)] def main(): print(''' ########################### # # # WebGrabs Scanner # # # ###########################/n>>> ''') Scanner()if __name__ == '__main__': main()
>更多相关文章
首页推荐
佛山市东联科技有限公司一直秉承“一切以用户价值为依归
- 01-11全球最受赞誉公司揭晓:苹果连续九年第一
- 12-09罗伯特·莫里斯:让黑客真正变黑
- 12-09谁闯入了中国网络?揭秘美国绝密黑客小组TA
- 12-09警示:iOS6 惊现“闪退”BUG
- 12-05亚马逊推出新一代基础模型 任意模态生成大模
- 12-05OpenAI拓展欧洲业务 将在苏黎世设立办公室
- 12-05微软质疑美国联邦贸易委员会泄露信息 督促其
- 12-05联交所取消宝宝树上市地位 宝宝树:不会对公
- 12-04企业微信致歉:文档打开异常已完成修复
相关文章
24小时热门资讯
24小时回复排行
热门推荐
最新资讯
操作系统
黑客防御