@@ -157,7 +157,7 @@ def gen_subdomains(expression, path):
157
157
"""
158
158
Generate subdomains
159
159
160
- :param str expression: generate subdomains's expression
160
+ :param str expression: generate subdomains expression
161
161
:param str path: path of wordlist
162
162
:return set subdomains: list of subdomains
163
163
"""
@@ -188,7 +188,7 @@ def gen_fuzz_subdomains(expression, rule, fuzzlist):
188
188
"""
189
189
Generate subdomains based on fuzz mode
190
190
191
- :param str expression: generate subdomains's expression
191
+ :param str expression: generate subdomains expression
192
192
:param str rule: regexp rule
193
193
:param str fuzzlist: fuzz dictionary
194
194
:return set subdomains: list of subdomains
@@ -217,7 +217,7 @@ def gen_word_subdomains(expression, path):
217
217
"""
218
218
Generate subdomains based on word mode
219
219
220
- :param str expression: generate subdomains's expression
220
+ :param str expression: generate subdomains expression
221
221
:param str path: path of wordlist
222
222
:return set subdomains: list of subdomains
223
223
"""
@@ -375,14 +375,14 @@ def check_dict():
375
375
exit (0 )
376
376
377
377
378
- def gen_result_infos (items , infos , subdomains , ip_times , wc_ips , wc_ttl , bk_cname ):
378
+ def gen_result_infos (items , infos , subdomains , ip_times , wc_ips , wc_ttl ):
379
379
qname = items .get ('name' )[:- 1 ] # 去除最右边的`.`点号
380
380
reason = items .get ('status' )
381
381
resolver = items .get ('resolver' )
382
382
data = items .get ('data' )
383
383
answers = data .get ('answers' )
384
384
info = dict ()
385
- cname = list ()
385
+ cnames = list ()
386
386
ips = list ()
387
387
public = list ()
388
388
times = list ()
@@ -397,13 +397,14 @@ def gen_result_infos(items, infos, subdomains, ip_times, wc_ips, wc_ttl, bk_cnam
397
397
have_a_record = True
398
398
ttl = answer .get ('ttl' )
399
399
ttls .append (ttl )
400
- cname .append (answer .get ('name' )[:- 1 ]) # 去除最右边的`.`点号
400
+ cname = answer .get ('name' )[:- 1 ]
401
+ cnames .append (cname ) # 去除最右边的`.`点号
401
402
ip = answer .get ('data' )
402
403
ips .append (ip )
403
404
public .append (utils .ip_is_public (ip ))
404
405
num = ip_times .get (ip )
405
406
times .append (num )
406
- isvalid , reason = is_valid_subdomain (ip , ttl , num , wc_ips , wc_ttl , cname , bk_cname )
407
+ isvalid , reason = is_valid_subdomain (ip , ttl , num , wc_ips , wc_ttl , cname )
407
408
logger .log ('TRACE' , f'{ ip } effective: { isvalid } reason: { reason } ' )
408
409
is_valid_flags .append (isvalid )
409
410
if not have_a_record :
@@ -413,7 +414,7 @@ def gen_result_infos(items, infos, subdomains, ip_times, wc_ips, wc_ttl, bk_cnam
413
414
info ['resolve' ] = 1
414
415
info ['reason' ] = reason
415
416
info ['ttl' ] = ttls
416
- info ['cname' ] = cname
417
+ info ['cname' ] = cnames
417
418
info ['ip' ] = ips
418
419
info ['public' ] = public
419
420
info ['times' ] = times
@@ -454,7 +455,7 @@ def stat_ip_times(result_paths):
454
455
return times
455
456
456
457
457
- def deal_output (output_paths , ip_times , wildcard_ips , wildcard_ttl , bk_cname ):
458
+ def deal_output (output_paths , ip_times , wildcard_ips , wildcard_ttl ):
458
459
logger .log ('INFOR' , f'Processing result' )
459
460
infos = dict () # 用来记录所有域名有关信息
460
461
subdomains = list () # 用来保存所有通过有效性检查的子域
@@ -480,8 +481,7 @@ def deal_output(output_paths, ip_times, wildcard_ips, wildcard_ttl, bk_cname):
480
481
logger .log ('TRACE' , f'Processing { line } , { qname } no response' )
481
482
continue
482
483
infos , subdomains = gen_result_infos (items , infos , subdomains ,
483
- ip_times , wildcard_ips ,
484
- wildcard_ttl , bk_cname )
484
+ ip_times , wildcard_ips , wildcard_ttl )
485
485
return infos , subdomains
486
486
487
487
@@ -515,10 +515,11 @@ def check_ip_times(times):
515
515
return False
516
516
517
517
518
- def is_valid_subdomain (ip , ttl , times , wc_ips , wc_ttl , cname , bk_cname ):
518
+ def is_valid_subdomain (ip , ttl , times , wc_ips , wc_ttl , cname ):
519
519
ip_blacklist = settings .brute_ip_blacklist
520
- if cname in bk_cname :
521
- return 0 , 'cname blacklist' # 有些泛解析会统一解析到一个cname上
520
+ cname_blacklist = settings .brute_cname_blacklist
521
+ if cname in cname_blacklist :
522
+ return 0 , 'cname blacklist' # 有些泛解析会统一解析到一个cname上
522
523
if ip in ip_blacklist : # 解析ip在黑名单ip则为非法子域
523
524
return 0 , 'IP blacklist'
524
525
if all ([wc_ips , wc_ttl ]): # 有泛解析记录才进行对比
@@ -583,11 +584,10 @@ class Brute(Module):
583
584
def __init__ (self , target = None , targets = None , process = None , concurrent = None ,
584
585
word = False , wordlist = None , recursive = False , depth = None , nextlist = None ,
585
586
fuzz = False , place = None , rule = None , fuzzlist = None , export = True ,
586
- alive = True , format = 'csv' , path = None , bk_cname = [] ):
587
+ alive = True , format = 'csv' , path = None ):
587
588
Module .__init__ (self )
588
589
self .module = 'Brute'
589
590
self .source = 'Brute'
590
- self .bk_cname = bk_cname
591
591
self .target = target
592
592
self .targets = targets
593
593
self .process_num = process or utils .get_process_num ()
@@ -716,7 +716,7 @@ def main(self, domain):
716
716
output_paths .append (output_path )
717
717
ip_times = stat_ip_times (output_paths )
718
718
self .infos , self .subdomains = deal_output (output_paths , ip_times ,
719
- wildcard_ips , wildcard_ttl , self . bk_cname )
719
+ wildcard_ips , wildcard_ttl )
720
720
delete_file (dict_path , output_paths )
721
721
end = time .time ()
722
722
self .elapse = round (end - start , 1 )
0 commit comments