您的当前位置:首页正文

Python - DNS查询

2024-11-09 来源:个人技术集锦
import dns.resolver

result = dns.resolver.query('baidu.com', 'A')
for ipval in result:
    print('IP', ipval.to_text())
   
IP 123.125.115.110
IP 220.181.57.216
import dns.resolver
result = dns.resolver.query('news.baidu.com', 'CNAME')
for cnameval in result:
    print(' cname target address:', cnameval.target)


cname target address: news.n.shifen.com.
显示全文