You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
from . module import Module # 引入Module类
from client . subdomain . oneforall . common import utils # 引入utils模块, 包含辅助方法
class Lookup ( Module ) :
"""
DNS查询基类, 用于查询域名的TXT记录并解析子域。
"""
def __init__ ( self ) :
"""
初始化Lookup类, 继承Module类的构造方法。
"""
Module . __init__ ( self ) # 调用父类Module的构造方法
def query ( self ) :
"""
查询指定域名的TXT记录并提取子域。
:return: 返回一个包含子域的集合( set) , 如果查询没有结果返回None。
"""
# 使用utils.dns_query函数查询域名的DNS记录
answer = utils . dns_query ( self . domain , self . type )
# 如果查询没有结果, 返回None
if answer is None :
return None
# 遍历所有查询到的记录
for item in answer :
# 获取TXT记录的文本内容
record = item . to_text ( )
# 使用utils.match_subdomain函数提取子域名
subdomains = utils . match_subdomain ( self . domain , record )
# 将提取的子域添加到子域集合中
self . subdomains = self . subdomains . union ( subdomains )
# 生成记录
self . gen_record ( subdomains , record )
# 返回所有收集到的子域名
return self . subdomains