我创建了一个简单的dns.query函数,我试图将结果添加到列表或潜在的字典中。但是我无法弄清楚如何实现它,我已经尝试过list.append(子域,项目),我尝试过使用join函数,我试图使用更新函数。
任何指针都会受到赞赏。
ORIGINAL
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
FIX
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