Skip to content

Commit

Permalink
Fixed broken Netcraft engine
Browse files Browse the repository at this point in the history
  • Loading branch information
aboul3la committed Apr 6, 2020
1 parent 61ebf36 commit 6af1b8c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions sublist3r.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,12 +538,15 @@ def req(self, url, cookies=None):
self.print_(e)
resp = None
return resp

def should_sleep(self):
time.sleep(random.randint(1, 2))
return

def get_next(self, resp):
link_regx = re.compile('<A href="(.*?)"><b>Next page</b></a>')
link_regx = re.compile('<a.*?href="(.*?)">Next Page')
link = link_regx.findall(resp)
link = re.sub('host=.*?%s' % self.domain, 'host=%s' % self.domain, link[0])
url = 'http://searchdns.netcraft.com' + link
url = 'http://searchdns.netcraft.com' + link[0]
return url

def create_cookies(self, cookie):
Expand All @@ -569,14 +572,15 @@ def enumerate(self):
while True:
resp = self.get_response(self.req(url, cookies))
self.extract_domains(resp)
if 'Next page' not in resp:
if 'Next Page' not in resp:
return self.subdomains
break
url = self.get_next(resp)
self.should_sleep()

def extract_domains(self, resp):
links_list = list()
link_regx = re.compile('<a href="http://toolbar.netcraft.com/site_report\?url=(.*)">')
link_regx = re.compile('<a class="results-table__host" href="(.*?)"')
try:
links_list = link_regx.findall(resp)
for link in links_list:
Expand Down

0 comments on commit 6af1b8c

Please sign in to comment.