def is_SOAP(ip, port, timeout):
try:
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
output = urllib2.urlopen('https://'+ip+":"+str(port), context=ctx, timeout=timeout).read()
if "rO0AB" in output:return (1, True)
except urllib2.HTTPError, e:
if ((e.getcode() == 500) and ("rO0AB" in e.read())):return (1, True)
except:pass
try:
output = urllib2.urlopen('http://'+ip+":"+str(port), timeout=timeout).read()
if "rO0AB" in output:return (0, True)
except urllib2.HTTPError, e:
if ((e.getcode() == 500) and ("rO0AB" in e.read())):return (0, True)
except:pass
return (2, False)
评论列表
文章目录