Skip to content

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

Unicode-safe resolve.

smicallef30ea0e25080b
diff --git a/modules/sfp_sslcert.py b/modules/sfp_sslcert.py
index e365750b..cac79f48 100644
--- a/modules/sfp_sslcert.py
+++ b/modules/sfp_sslcert.py
@@ -70,16 +70,21 @@ class sfp_sslcert(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