Commit 27efb21c authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Some punycode bug fixing

parent c958d290
import datetime, encodings, os, setuptools, socketserver, ssltools, sys, syslog, threading
import datetime, encodings.idna, os, setuptools, socketserver, ssltools, sys, syslog, threading
SYSLOG = 0
STDOUT = 1
......@@ -35,7 +35,7 @@ def logger(message, prio=syslog.LOG_INFO, sink=logging):
def listIncluded(host, section):
for i in setuptools.getListSetting("SSL" if section == 0 else "Ports", "hosts"):
if i[0].lower() == host.lower():
if encodings.idna.ToASCII(i[0].lower()).decode("UTF-8") == encodings.idna.ToASCII(host.lower()).decode("UTF-8"):
return True
return False
......@@ -61,7 +61,7 @@ class TCPHandler(socketserver.StreamRequestHandler):
return "UA: Not currently implemented."
elif command in ("ssl", "tls"):
try:
host = encodings.idna.ToASCII(str(content[1]))
host = encodings.idna.ToASCII(str(content[1])).decode("UTF-8")
try:
port = int(content[2])
except IndexError:
......@@ -81,7 +81,8 @@ class TCPHandler(socketserver.StreamRequestHandler):
return "AL: %s certificate has expired on: %s" % (content[1], expiry)
else:
return "NM: %s is not being monitored!" % content[1]
except:
except Exception as e:
print(e)
return "ER: Could not verify SSL certificate on %s:%i. Is the server down?" % (content[1], int(content[2]))
elif command == "port":
return "UA: Not currently implemented."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment