Skip to content

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

Use sflib.resolveHost in sflib.checkDnsWildcard function

bcoles571a9f79b1ca
diff --git a/sflib.py b/sflib.py
index fe98ffdd..a793f7c0 100644
--- a/sflib.py
+++ b/sflib.py
@@ -1516,18 +1516,16 @@ class SpiderFoot:
self.info("Fetched data: " + str(len(result['content'] or '')) + " (" + url + "), took " + t + "s")
return result
- # Check if wildcard DNS is enabled by looking up two random hostnames
+ # Check if wildcard DNS is enabled by looking up a random hostname
def checkDnsWildcard(self, target):
randpool = 'bcdfghjklmnpqrstvwxyz3456789'
randhost = ''.join([random.SystemRandom().choice(randpool) for x in range(10)])
- # An exception will be raised if the resolution fails
- try:
- addrs = socket.gethostbyname_ex(randhost + "." + target)
- return True
- except BaseException as e:
+ if self.resolveHost(randhost + "." + target) is None:
return False
+ return True
+
# Request search results from the Google API. Will return a dict:
# {
# "urls": a list of urls that match the query string,