7
7
8
8
from config import settings
9
9
10
+ from modules import wildcard
10
11
from common import utils
11
12
from common import resolve
12
13
from common import request
@@ -75,14 +76,16 @@ def increase_num(self, subname):
75
76
# test1.example.com -> test2.example.com, test3.example.com, ...
76
77
# test01.example.com -> test02.example.com, test03.example.com, ...
77
78
79
+ count = 0
78
80
digits = re .findall (r'\d{1,3}' , subname )
79
-
80
81
for d in digits :
81
82
for m in range (self .num_count ):
82
83
replacement = str (int (d ) + 1 + m ).zfill (len (d ))
83
84
tmp_domain = subname .replace (d , replacement )
84
85
new_domain = f'{ tmp_domain } .{ self .domain } '
85
86
self .new_subdomains .add (new_domain )
87
+ count += 1
88
+ logger .log ('DEBUG' , f'The increase_num generated { count } subdomains' )
86
89
87
90
def decrease_num (self , subname ):
88
91
"""
@@ -94,8 +97,8 @@ def decrease_num(self, subname):
94
97
# test4.example.com -> test3.example.com, test2.example.com, ...
95
98
# test04.example.com -> test03.example.com, test02.example.com, ...
96
99
100
+ count = 0
97
101
digits = re .findall (r'\d{1,3}' , subname )
98
-
99
102
for d in digits :
100
103
for m in range (self .num_count ):
101
104
new_digit = (int (d ) - 1 - m )
@@ -106,6 +109,8 @@ def decrease_num(self, subname):
106
109
tmp_domain = subname .replace (d , replacement )
107
110
new_domain = f'{ tmp_domain } .{ self .domain } '
108
111
self .new_subdomains .add (new_domain )
112
+ count += 1
113
+ logger .log ('DEBUG' , f'The decrease_num generated { count } subdomains' )
109
114
110
115
def insert_word (self , parts ):
111
116
"""
@@ -118,19 +123,23 @@ def insert_word(self, parts):
118
123
# test.1.foo.WORD.example.com,
119
124
# ...
120
125
126
+ count = 0
121
127
for word in self .words :
122
128
for index in range (len (parts )):
123
129
tmp_parts = parts .copy ()
124
130
tmp_parts .insert (index , word )
125
131
new_domain = '.' .join (tmp_parts )
126
132
self .new_subdomains .add (new_domain )
133
+ count += 1
134
+ logger .log ('DEBUG' , f'The insert_word generated { count } subdomains' )
127
135
128
136
def add_word (self , subnames ):
129
137
"""
130
138
On every subdomain level, prepend existing content with WORD-`,
131
139
append existing content with `-WORD`
132
140
"""
133
141
142
+ count = 0
134
143
for word in self .words :
135
144
for index , name in enumerate (subnames ):
136
145
# Prepend with `-`
@@ -146,6 +155,8 @@ def add_word(self, subnames):
146
155
tmp_subnames [index ] = f'{ name } -{ word } '
147
156
new_subname = '.' .join (tmp_subnames + [self .domain ])
148
157
self .new_subdomains .add (new_subname )
158
+ count += 1
159
+ logger .log ('DEBUG' , f'The add_word generated { count } subdomains' )
149
160
150
161
def replace_word (self , subname ):
151
162
"""
@@ -158,6 +169,7 @@ def replace_word(self, subname):
158
169
# WORD4.1.foo.example.com,
159
170
# ..
160
171
172
+ count = 0
161
173
for word in self .words :
162
174
if word not in subname :
163
175
continue
@@ -167,6 +179,8 @@ def replace_word(self, subname):
167
179
new_subname = subname .replace (word , word_alt )
168
180
new_subdomain = f'{ new_subname } .{ self .domain } '
169
181
self .new_subdomains .add (new_subdomain )
182
+ count += 1
183
+ logger .log ('DEBUG' , f'The replace_word generated { count } subdomains' )
170
184
171
185
def gen_new_subdomains (self ):
172
186
for subdomain in self .now_subdomains :
@@ -194,6 +208,5 @@ def run(self, data, port):
194
208
self .elapse = round (self .end - self .start , 1 )
195
209
self .gen_result ()
196
210
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