Some punycode bug fixing
This commit is contained in:
parent
c958d290d2
commit
27efb21c42
1 changed files with 5 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
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."
|
||||
|
|
Loading…
Reference in a new issue