我创建了一个简单的 dns.query 函数,我正在尝试将结果添加到列表或可能的字典中。但是我不知道如何实现它,我尝试过 list.append(subdomain, item),我尝试过使用 join 功能,并且我尝试过使用 update 功能。
任何指针将不胜感激。
原来的
def get_brutes(subdomain):
targets = []
try:
myResolver = dns.resolver.Resolver()
myResolver.nameservers = ['8.8.8.8']
myAnswers = myResolver.query(subdomain)
for item in myAnswers.rrset:
targets.append(subdomain,item)
except Exception as e:
pass
return targets
使固定
def get_brutes(subdomain):
targets = []
try:
myResolver = dns.resolver.Resolver()
myResolver.nameservers = ['8.8.8.8']
myAnswers = myResolver.query(subdomain)
for item in myAnswers.rrset:
targets.append(subdomain + ' ' + str(item))
except Exception as e:
pass
return targets