默认启用子域置换功能

This commit is contained in:
Jing Ling
2020-11-19 02:21:44 +08:00
parent ae6f8d4ec5
commit 0d366a872d
2 changed files with 19 additions and 6 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ enable_brute_module = True # 使用爆破模块(默认True)
enable_dns_resolve = True # 使用DNS解析子域(默认True) enable_dns_resolve = True # 使用DNS解析子域(默认True)
enable_http_request = True # 使用HTTP请求子域(默认True) enable_http_request = True # 使用HTTP请求子域(默认True)
enable_finder_module = True # 开启finder模块,开启会从响应体和JS中再次发现子域(默认True) enable_finder_module = True # 开启finder模块,开启会从响应体和JS中再次发现子域(默认True)
enable_altdns_module = False # 开启altdns模块,开启会利用置换技术重组子域再次发现新子域(默认True) enable_altdns_module = True # 开启altdns模块,开启会利用置换技术重组子域再次发现新子域(默认True)
enable_enrich_module = True # 开启enrich模块,开启会富化出信息,如ip的cdncidrasnorgaddr和isp等信息 enable_enrich_module = True # 开启enrich模块,开启会富化出信息,如ip的cdncidrasnorgaddr和isp等信息
enable_banner_identify = True # 开启WEB指纹识别模块(默认True) enable_banner_identify = True # 开启WEB指纹识别模块(默认True)
enable_takeover_check = False # 开启子域接管风险检查(默认False) enable_takeover_check = False # 开启子域接管风险检查(默认False)
+18 -5
View File
@@ -7,6 +7,7 @@ import itertools
from config import settings from config import settings
from modules import wildcard
from common import utils from common import utils
from common import resolve from common import resolve
from common import request from common import request
@@ -75,14 +76,16 @@ class Altdns(Module):
# test1.example.com -> test2.example.com, test3.example.com, ... # test1.example.com -> test2.example.com, test3.example.com, ...
# test01.example.com -> test02.example.com, test03.example.com, ... # test01.example.com -> test02.example.com, test03.example.com, ...
count = 0
digits = re.findall(r'\d{1,3}', subname) digits = re.findall(r'\d{1,3}', subname)
for d in digits: for d in digits:
for m in range(self.num_count): for m in range(self.num_count):
replacement = str(int(d) + 1 + m).zfill(len(d)) replacement = str(int(d) + 1 + m).zfill(len(d))
tmp_domain = subname.replace(d, replacement) tmp_domain = subname.replace(d, replacement)
new_domain = f'{tmp_domain}.{self.domain}' new_domain = f'{tmp_domain}.{self.domain}'
self.new_subdomains.add(new_domain) self.new_subdomains.add(new_domain)
count += 1
logger.log('DEBUG', f'The increase_num generated {count} subdomains')
def decrease_num(self, subname): def decrease_num(self, subname):
""" """
@@ -94,8 +97,8 @@ class Altdns(Module):
# test4.example.com -> test3.example.com, test2.example.com, ... # test4.example.com -> test3.example.com, test2.example.com, ...
# test04.example.com -> test03.example.com, test02.example.com, ... # test04.example.com -> test03.example.com, test02.example.com, ...
count = 0
digits = re.findall(r'\d{1,3}', subname) digits = re.findall(r'\d{1,3}', subname)
for d in digits: for d in digits:
for m in range(self.num_count): for m in range(self.num_count):
new_digit = (int(d) - 1 - m) new_digit = (int(d) - 1 - m)
@@ -106,6 +109,8 @@ class Altdns(Module):
tmp_domain = subname.replace(d, replacement) tmp_domain = subname.replace(d, replacement)
new_domain = f'{tmp_domain}.{self.domain}' new_domain = f'{tmp_domain}.{self.domain}'
self.new_subdomains.add(new_domain) self.new_subdomains.add(new_domain)
count += 1
logger.log('DEBUG', f'The decrease_num generated {count} subdomains')
def insert_word(self, parts): def insert_word(self, parts):
""" """
@@ -118,12 +123,15 @@ class Altdns(Module):
# test.1.foo.WORD.example.com, # test.1.foo.WORD.example.com,
# ... # ...
count = 0
for word in self.words: for word in self.words:
for index in range(len(parts)): for index in range(len(parts)):
tmp_parts = parts.copy() tmp_parts = parts.copy()
tmp_parts.insert(index, word) tmp_parts.insert(index, word)
new_domain = '.'.join(tmp_parts) new_domain = '.'.join(tmp_parts)
self.new_subdomains.add(new_domain) self.new_subdomains.add(new_domain)
count += 1
logger.log('DEBUG', f'The insert_word generated {count} subdomains')
def add_word(self, subnames): def add_word(self, subnames):
""" """
@@ -131,6 +139,7 @@ class Altdns(Module):
append existing content with `-WORD` append existing content with `-WORD`
""" """
count = 0
for word in self.words: for word in self.words:
for index, name in enumerate(subnames): for index, name in enumerate(subnames):
# Prepend with `-` # Prepend with `-`
@@ -146,6 +155,8 @@ class Altdns(Module):
tmp_subnames[index] = f'{name}-{word}' tmp_subnames[index] = f'{name}-{word}'
new_subname = '.'.join(tmp_subnames + [self.domain]) new_subname = '.'.join(tmp_subnames + [self.domain])
self.new_subdomains.add(new_subname) self.new_subdomains.add(new_subname)
count += 1
logger.log('DEBUG', f'The add_word generated {count} subdomains')
def replace_word(self, subname): def replace_word(self, subname):
""" """
@@ -158,6 +169,7 @@ class Altdns(Module):
# WORD4.1.foo.example.com, # WORD4.1.foo.example.com,
# .. # ..
count = 0
for word in self.words: for word in self.words:
if word not in subname: if word not in subname:
continue continue
@@ -167,6 +179,8 @@ class Altdns(Module):
new_subname = subname.replace(word, word_alt) new_subname = subname.replace(word, word_alt)
new_subdomain = f'{new_subname}.{self.domain}' new_subdomain = f'{new_subname}.{self.domain}'
self.new_subdomains.add(new_subdomain) self.new_subdomains.add(new_subdomain)
count += 1
logger.log('DEBUG', f'The replace_word generated {count} subdomains')
def gen_new_subdomains(self): def gen_new_subdomains(self):
for subdomain in self.now_subdomains: for subdomain in self.now_subdomains:
@@ -194,6 +208,5 @@ class Altdns(Module):
self.elapse = round(self.end - self.start, 1) self.elapse = round(self.end - self.start, 1)
self.gen_result() self.gen_result()
resolved_data = resolve.run_resolve(self.domain, self.results) resolved_data = resolve.run_resolve(self.domain, self.results)
request.run_request(self.domain, resolved_data, port) valid_data = wildcard.deal_wildcard(resolved_data) # 强制开启泛解析处理
logger.log('INFOR', f'Saving altdns results') request.run_request(self.domain, valid_data, port)
utils.save_to_db(self.domain, data, 'altdns')