python通过域名解析双线ip
时间:2011-08-02
来源:互联网
这样的,我有一个服务器,双线的,网通,电信都有ip,我想请问下,如果用python通过域名和其他一些必要的信息,逐个解析出此域名在网通和电信的ip呢?
作者: nothingsss 发布时间: 2011-08-02
这样的功能通过dig可以实现,
直接通过python不能吗?
wt_cmd='dig +retry=%d +time=%d -b %s @%s %s|find /V ";"|find "%s"' %(obj.wt_dns_retry,obj.wt_dns_timeout,obj.wt_int,obj.wt_dns,domain,domain_str)
dx_cmd='dig +retry=%d +time=%d -b %s @%s %s|find /V ";"|find "%s"' %(obj.dx_dns_retry,obj.dx_dns_timeout,obj.dx_int,obj.dx_dns,domain,domain_str)
wt=[re.search('\d+\.\d+\.\d+\.\d+',wtline) for wtline in os.popen(wt_cmd)]
dx=[re.search('\d+\.\d+\.\d+\.\d+',dxline) for dxline in os.popen(dx_cmd)]
希望大仙儿们指点迷津啊
直接通过python不能吗?
wt_cmd='dig +retry=%d +time=%d -b %s @%s %s|find /V ";"|find "%s"' %(obj.wt_dns_retry,obj.wt_dns_timeout,obj.wt_int,obj.wt_dns,domain,domain_str)
dx_cmd='dig +retry=%d +time=%d -b %s @%s %s|find /V ";"|find "%s"' %(obj.dx_dns_retry,obj.dx_dns_timeout,obj.dx_int,obj.dx_dns,domain,domain_str)
wt=[re.search('\d+\.\d+\.\d+\.\d+',wtline) for wtline in os.popen(wt_cmd)]
dx=[re.search('\d+\.\d+\.\d+\.\d+',dxline) for dxline in os.popen(dx_cmd)]
希望大仙儿们指点迷津啊
作者: nothingsss 发布时间: 2011-08-02
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28