上头要求设置TCP备案检查,给了个WEBSERVICE接口。查了2天,才确认还是python比较好用,我这水平也就写个脚本把数据导出,过滤检索还是用的shell。写此文备忘。WEBSERVICE接口脚本如下:
#! /usr/bin/python
#coding:utf-8
import codecs
import suds
def main(file_name, out_file):
url = ‘http://121.14.4.210:8088/icpautobj/ws/getIcp?wsdl‘
client = suds.client.Client(url)
fp=open(file_name)
ofp=codecs.open(out_file, ‘w‘,"utf-8")
while 1:
line=fp.readline()
if not line or line == ‘\n‘:
break
domain=line.strip(‘\n‘)
ret = client.service.queryBatchIcpInfo(0,domain)
#print ret
ofp.write(ret+‘\n‘)
fp.close()
ofp.close()
fn=‘domain.txt‘
out_file=‘res.log‘
main(fn, out_file)
本文出自 “想飞却飞不高的猪” 博客,转载请与作者联系!