def sendrequestshead(self, url): headers = {'User-Agent': findProxy().randomUA()} targeturl = self.url + url self.count += 1 #cprint("[*] 加载") cprint('#Process: {}\t[{:.2%}]{}\r'.format( targeturl, (self.count / 9739), ' ' * (len(targeturl) - 90)), 'yellow', attrs=['bold'], end='', flush=True) sys.stdout.flush() try: req = requests.head(targeturl, headers=headers, verify=False, timeout=10, allow_redirects=False) if req.status_code != 404 and req.status_code != 400 and req.status_code != 412 and req.status_code != 403: if url in self._403 and req.status_code == 403: pass else: tmpdict = { 'url': targeturl, 'status_code': req.status_code } mylog('webpath', True).log.info(pyfancy().green( '[+]发现web路径: {0}'.format(str(tmpdict)))) self.webpath.append(tmpdict) except: pass gevent.sleep(0)
def sendrequestsget(self, url): headers = {'User-Agent': findProxy().randomUA()} targeturl = self.url + url try: req = requests.get(targeturl, headers=headers, verify=False, timeout=10, allow_redirects=False) if len(req.text) == self.length or len( req.text) - 32 == self.length: pass else: if req.status_code != 404 and req.status_code != 400 and req.status_code != 412 and req.status_code != 403: if url in self._403 and req.status_code == 403: pass else: tmpdict = { 'url': targeturl, 'status_code': req.status_code, 'length': len(req.text) } mylog('webpath', True).log.info(pyfancy().green( '[+]发现web路径: {0}'.format(str(tmpdict)))) self.webpath.append(tmpdict) except: pass gevent.sleep(0)
def get404length(self): headers = {'User-Agent': findProxy().randomUA()} try: notfound = self.url + '/c2adf6ecc220f2711801d6e466340183' req = requests.get(notfound, headers=headers, verify=False, timeout=10) self.length = len(req.text) except: pass
def check404(self): headers = {'User-Agent': findProxy().randomUA()} notfound = self.url + '/c2adf6ecc220f2711801d6e466340183' req = requests.head(notfound, headers=headers, verify=False, timeout=10) if req.status_code == 404: return True else: return False
def __init__(self, url, cookies, threads): self.url = url self.threads = threads self.cookies = cookies self.vulns = list() self.loadProxy = findProxy()