美文网首页
dnspython实现CNAME记录查询

dnspython实现CNAME记录查询

作者: 如来自然 | 来源:发表于2016-01-14 19:57 被阅读159次

[root@bogon dns]# vim CNAME.py

!/usr/bin/env python

import dns.resolver

domain = raw_input('Please input an domain: ')
cname = dns.resolver.query(domain, 'CNAME')
for i in cname.response.answer:
for j in i.items:
print j.to_text()

测试:

[root@bogon dns]# python CNAME.py
Please input an domain: www.baidu.com
www.a.shifen.com.
[root@bogon dns]#

相关文章

网友评论

      本文标题:dnspython实现CNAME记录查询

      本文链接:https://www.haomeiwen.com/subject/jjhhkttx.html