diff --git a/debian/changelog b/debian/changelog index afeb3f1..b7c900d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,6 @@ +sublist3r (1.1-0kali1) UNRELEASED; urgency=low + -- Kali Janitor Wed, 07 Apr 2021 13:40:28 -0000 + sublist3r (1.0+git20200105-0kali1) kali-dev; urgency=medium * New upstream version 1.0+git20200105 diff --git a/sublist3r.py b/sublist3r.py index 4d716dd..fab7381 100755 --- a/sublist3r.py +++ b/sublist3r.py @@ -152,11 +152,11 @@ self.silent = silent self.verbose = verbose self.headers = { - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', - 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', - 'Accept-Language': 'en-US,en;q=0.8', - 'Accept-Encoding': 'gzip', - } + 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', + 'Accept-Language': 'en-US,en;q=0.8', + 'Accept-Encoding': 'gzip', + } self.print_banner() def print_(self, text): @@ -538,12 +538,15 @@ 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('Next page') + link_regx = re.compile('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): @@ -569,14 +572,15 @@ 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('') + link_regx = re.compile('' in link: + subdomains = link.split('
') + else: + subdomains.append(link) + + for subdomain in subdomains: + if not subdomain.endswith(self.domain) or '*' in subdomain: + continue + + if '@' in subdomain: + subdomain = subdomain[subdomain.find('@')+1:] + + if subdomain not in self.subdomains and subdomain != self.domain: + if self.verbose: + self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) + self.subdomains.append(subdomain.strip()) except Exception as e: + print(e) pass