python之dns

#!/usr/bin/env python
# _*_ coding: utf-8 _*_
# @Time : 2022/3/13 8:34
# @Author : AndyXi
# @Version:V 0.1
# @File : dns.py
# @desc :
import dns.resolver
domain=input('Please in_put a domain:')
print(domain)

A = dns.resolver.query(domain,'A')

for i in A.response.answer:
#print(i)
for j in i.items:
print(j.address)

# domain2=input('Please in_put a domain2:')
# ns=dns.resolver.query('domain2','NS')
# for i in ns.response.answer:
# for j in i.items:
# print(j.to_text())
posted @ 2022-09-08 17:00  青空如璃  阅读(168)  评论(0编辑  收藏  举报