Skip to content

Commit 0d366a8

Browse files
committed
默认启用子域置换功能
1 parent ae6f8d4 commit 0d366a8

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

config/default.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
enable_dns_resolve = True # 使用DNS解析子域(默认True)
2424
enable_http_request = True # 使用HTTP请求子域(默认True)
2525
enable_finder_module = True # 开启finder模块,开启会从响应体和JS中再次发现子域(默认True)
26-
enable_altdns_module = False # 开启altdns模块,开启会利用置换技术重组子域再次发现新子域(默认True)
26+
enable_altdns_module = True # 开启altdns模块,开启会利用置换技术重组子域再次发现新子域(默认True)
2727
enable_enrich_module = True # 开启enrich模块,开启会富化出信息,如ip的cdn,cidr,asn,org,addr和isp等信息
2828
enable_banner_identify = True # 开启WEB指纹识别模块(默认True)
2929
enable_takeover_check = False # 开启子域接管风险检查(默认False)

modules/altdns.py

+18-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from config import settings
99

10+
from modules import wildcard
1011
from common import utils
1112
from common import resolve
1213
from common import request
@@ -75,14 +76,16 @@ def increase_num(self, subname):
7576
# test1.example.com -> test2.example.com, test3.example.com, ...
7677
# test01.example.com -> test02.example.com, test03.example.com, ...
7778

79+
count = 0
7880
digits = re.findall(r'\d{1,3}', subname)
79-
8081
for d in digits:
8182
for m in range(self.num_count):
8283
replacement = str(int(d) + 1 + m).zfill(len(d))
8384
tmp_domain = subname.replace(d, replacement)
8485
new_domain = f'{tmp_domain}.{self.domain}'
8586
self.new_subdomains.add(new_domain)
87+
count += 1
88+
logger.log('DEBUG', f'The increase_num generated {count} subdomains')
8689

8790
def decrease_num(self, subname):
8891
"""
@@ -94,8 +97,8 @@ def decrease_num(self, subname):
9497
# test4.example.com -> test3.example.com, test2.example.com, ...
9598
# test04.example.com -> test03.example.com, test02.example.com, ...
9699

100+
count = 0
97101
digits = re.findall(r'\d{1,3}', subname)
98-
99102
for d in digits:
100103
for m in range(self.num_count):
101104
new_digit = (int(d) - 1 - m)
@@ -106,6 +109,8 @@ def decrease_num(self, subname):
106109
tmp_domain = subname.replace(d, replacement)
107110
new_domain = f'{tmp_domain}.{self.domain}'
108111
self.new_subdomains.add(new_domain)
112+
count += 1
113+
logger.log('DEBUG', f'The decrease_num generated {count} subdomains')
109114

110115
def insert_word(self, parts):
111116
"""
@@ -118,19 +123,23 @@ def insert_word(self, parts):
118123
# test.1.foo.WORD.example.com,
119124
# ...
120125

126+
count = 0
121127
for word in self.words:
122128
for index in range(len(parts)):
123129
tmp_parts = parts.copy()
124130
tmp_parts.insert(index, word)
125131
new_domain = '.'.join(tmp_parts)
126132
self.new_subdomains.add(new_domain)
133+
count += 1
134+
logger.log('DEBUG', f'The insert_word generated {count} subdomains')
127135

128136
def add_word(self, subnames):
129137
"""
130138
On every subdomain level, prepend existing content with WORD-`,
131139
append existing content with `-WORD`
132140
"""
133141

142+
count = 0
134143
for word in self.words:
135144
for index, name in enumerate(subnames):
136145
# Prepend with `-`
@@ -146,6 +155,8 @@ def add_word(self, subnames):
146155
tmp_subnames[index] = f'{name}-{word}'
147156
new_subname = '.'.join(tmp_subnames + [self.domain])
148157
self.new_subdomains.add(new_subname)
158+
count += 1
159+
logger.log('DEBUG', f'The add_word generated {count} subdomains')
149160

150161
def replace_word(self, subname):
151162
"""
@@ -158,6 +169,7 @@ def replace_word(self, subname):
158169
# WORD4.1.foo.example.com,
159170
# ..
160171

172+
count = 0
161173
for word in self.words:
162174
if word not in subname:
163175
continue
@@ -167,6 +179,8 @@ def replace_word(self, subname):
167179
new_subname = subname.replace(word, word_alt)
168180
new_subdomain = f'{new_subname}.{self.domain}'
169181
self.new_subdomains.add(new_subdomain)
182+
count += 1
183+
logger.log('DEBUG', f'The replace_word generated {count} subdomains')
170184

171185
def gen_new_subdomains(self):
172186
for subdomain in self.now_subdomains:
@@ -194,6 +208,5 @@ def run(self, data, port):
194208
self.elapse = round(self.end - self.start, 1)
195209
self.gen_result()
196210
resolved_data = resolve.run_resolve(self.domain, self.results)
197-
request.run_request(self.domain, resolved_data, port)
198-
logger.log('INFOR', f'Saving altdns results')
199-
utils.save_to_db(self.domain, data, 'altdns')
211+
valid_data = wildcard.deal_wildcard(resolved_data) # 强制开启泛解析处理
212+
request.run_request(self.domain, valid_data, port)

0 commit comments

Comments
 (0)