PYTHON自动化WEB旁注目录扫描器

浏览:
字体:
发布时间:2013-12-20 16:18:22
来源:
 
#!/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()  

 

>更多相关文章
24小时热门资讯
24小时回复排行
资讯 | QQ | 安全 | 编程 | 数据库 | 系统 | 网络 | 考试 | 站长 | 关于东联 | 安全雇佣 | 搞笑视频大全 | 微信学院 | 视频课程 |
关于我们 | 联系我们 | 广告服务 | 免责申明 | 作品发布 | 网站地图 | 官方微博 | 技术培训
Copyright © 2007 - 2024 Vm888.Com. All Rights Reserved
粤公网安备 44060402001498号 粤ICP备19097316号 请遵循相关法律法规
');})();