示例#1
0
 def run(self):
     global lock, count
     domain1 = self.domain1
     while not self.subdomains.empty():
         subdomain = self.subdomains.get()
         # domain=httpOrHttps(domain)+"://" +subdomain+"."+domain
         domain = httpOrHttps(self.protocol) + str("://") + str(
             subdomain) + "." + str(domain1)
         # print(domain)
         #lock.acquire()
         try:
             res = requests.get(domain, timeout=4)
             result = change2standard(res)
             # print(result)
             # if ifExist(res)==True:
             if (re.findall(self.p, result)):
                 title = (re.findall(self.p, result)[0])
             elif re.findall(self.p1, result):
                 title = (re.findall(self.p1, result)[0])
             else:
                 title = ' '
             title = title.replace("\n", "")
             title = title.replace("\r", "")
             title = title.replace("\t", "")
             title = title.replace(" ", '')
             if isVisible(title) == True:
                 if lock.acquire():
                     count = count + 1
                     msg1 = "[+] " + tools.setStr2SameLen(30,
                                                          domain) + title
                     printc.printf(msg1, 'green')
                     lock.release()
             else:
                 pass
         except:
             # msg2="[-] "+domain+"不可访问"
             # printc.printf(msg2,'red')
             pass
示例#2
0
 def run(self):
     global lock, count
     status_code = title = '0'
     # domain1=self.domain1                                 #类似于baidu.com
     while not self.urls.empty():  #对用户输入放入资产进行遍历
         url = self.urls.get()  #类似于baidu.com
         # print(url)
         # domain=httpOrHttps(domain)+"://" +subdomain+"."+domain
         if "http" not in url:
             if "www" not in url:
                 # urls   = "http://www." + urls
                 domain = self.protocol + "://www." + url  #拼接成类似于http://www.baidu.com这样的完整域名
             else:
                 domain = self.protocol + "://" + url  #拼接成类似于http://www.baidu.com这样的完整域名
         else:
             domain = url  #如果原目标中有指定协议则按原协议地址返回
         #domain=httpOrHttps(self.protocol)+str("://") +str(subdomain)
         try:
             res = requests.get(domain, timeout=4, allow_redirects=True)
             status_code = res.status_code
             lock.acquire()
             result = change2standard(res)
             #这里是用用来匹配网站title,后面可以根据自己的需要添加新的规则
             if (re.findall(self.p, result)):
                 title = (re.findall(self.p, result)[0])
             elif re.findall(self.p1, result):
                 title = (re.findall(self.p1, result)[0])
             else:
                 title = ' '
             title = title.replace("\n", "")  #对title进行去杂
             title = title.replace("\r", "")
             title = title.replace("\t", "")
             title = title.replace(" ", '')
             if isVisible(title) == True:
                 count = count + 1
                 msg = "[+] " + tools.setStr2SameLen(30, domain) + title
                 #url status_code title visitable
                 tools.print2sheet(t1_len=25,
                                   t1=str(url),
                                   title1="URL",
                                   t2_len=2,
                                   t2="   " + str(status_code),
                                   title2="Status",
                                   t3_len=1,
                                   t3="   Yes",
                                   title3="Visitable",
                                   t4_len=20,
                                   t4=title,
                                   title4="Title")
                 # printc.printf(msg,'green')
             else:
                 #msg = "[-] " + " Yes "+domain
                 tools.print2sheet(t1_len=25,
                                   t1=str(url),
                                   title1="URL",
                                   t2_len=2,
                                   t2="   " + str(status_code),
                                   title2="Status",
                                   t3_len=1,
                                   t3="   Yes",
                                   title3="Visitable",
                                   t4_len=20,
                                   t4=title,
                                   title4="Title")
                 # printc.printf(msg,'red')
                 pass
             lock.release()
         except:
             lock.acquire()
             # msg = "[-] " + " No "+domain
             # printc.printf(msg,'red')
             tools.print2sheet(t1_len=25,
                               t1=str(url),
                               title1="URL",
                               t2_len=2,
                               t2="   " + str(status_code),
                               title2="Status",
                               t3_len=1,
                               t3="   No",
                               title3="Visitable",
                               t4_len=20,
                               t4=title,
                               title4="Title")
             lock.release()
             pass