Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

IDNA-encode hostname in case it contains unicode

bcoles2a1468157edf
diff --git a/modules/sfp_ssltools.py b/modules/sfp_ssltools.py
index 68ede359..7a9574ab 100644
--- a/modules/sfp_ssltools.py
+++ b/modules/sfp_ssltools.py
@@ -105,16 +105,21 @@ class sfp_ssltools(SpiderFootPlugin):
# Resolve a host
def resolveHost(self, host):
try:
+ # IDNA-encode the hostname in case it contains unicode
+ if type(host) != unicode:
+ host = unicode(host, "utf-8", errors='replace').encode("idna")
+ else:
+ host = host.encode("idna")
+
addrs = socket.gethostbyname_ex(host)
+ if not addrs:
+ return False
+
+ return True
except BaseException as e:
self.sf.debug("Unable to resolve " + host + ": " + str(e))
return False
- if not addrs:
- return False
-
- return True
-
# Handle events sent to this module
def handleEvent(self, event):
eventName = event.eventType