上頭要求設定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'