Python实用示例:DNS管理、LDAP操作、日志报告与FTP镜像
1. 使用Python管理DNS
1.1 dnspython模块介绍
管理DNS服务器相较于配置Apache文件而言,是一项较为直接的任务。但数据中心和网络托管提供商面临的实际问题是进行大规模的DNS程序化更改。Python的 dnspython 模块在这方面表现出色。
1.2 安装dnspython
由于该包列在Python包索引中,你只需使用 easy_install 进行安装:
ngift@Macintosh-8][H:10048][J:0]# sudo easy_install dnspython
Password:
Searching for dnspython
Reading http://pypi.python.org/simple/dnspython/
[output supressed]
1.3 使用IPython探索模块
以下示例展示了如何获取 oreilly.com 的A和MX记录:
import dns.resolver
ip = dns.resolver.query("oreilly.com","A")
mail = dns.resolver.query("oreilly.com","MX")
for i,p in ip,mail:
print
超级会员免费看
订阅专栏 解锁全文
572

被折叠的 条评论
为什么被折叠?



