本来是要写个程序用的,没写完不写了,这一部分就贴出来吧
验证域名和IP
class JianKong(): '''查询IDC信息,封ip和过白名单''' def __init__(self): pass @classmethod def ip_verify(cls,str): '验证IP地址规范' pattern=re.compile('(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]"by2\">\.(.*?)\ </td>', re.S) for i in range(1,23): data='domainName=&domainBlur=0&page.pageSize=20&pageNo='+str(i)+'&jumpPageNo='+str(i) header={'Host':'www.miitbeian.gov.cn','Origin':'http://www.miitbeian.gov.cn','User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 UBrowser/5.5.6125.14 Safari/537.36','Referer':'http://www.miitbeian.gov.cn/basecode/query/queryDomain.action;jsessionid=HSTRWpLZbR0cX4vFkDpnpbNBYyRl4GwW1fxpyhdyc0fcfhkvJTBV!1139295987'} url='http://www.miitbeian.gov.cn/basecode/query/queryDomain.action;jsessionid=HSTRWpLZbR0cX4vFkDpnpbNBYyRl4GwW1fxpyhdyc0fcfhkvJTBV!1139295987' request=urllib2.Request(url,data,header) response=urllib2.urlopen(request) recv=response.read() s=p.findall(recv) #print s #去重 s=list(set(s)) for y in s: file.write(y+'\n') file.flush() #print str(i)+' '+y file.close() print '完毕'#弹窗完成