Skip to content

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

Moved wildchard checking into the standard library.

smicallef37c153276de7
diff --git a/modules/sfp_dns.py b/modules/sfp_dns.py
index ffcbf526..744aa5be 100644
--- a/modules/sfp_dns.py
+++ b/modules/sfp_dns.py
@@ -215,7 +215,7 @@ class sfp_dns(SpiderFootPlugin):
sf.debug("Iterating through possible sub-domains [" + str(self.opts['commonsubs']) + "]")
count = 0
- wildcard = self.checkWildcard(self.baseDomain)
+ wildcard = sf.checkDnsWildcard(self.baseDomain)
# Try resolving common names
for sub in self.opts['commonsubs']:
if wildcard and self.opts['skipcommononwildcard'] and count > 0:
@@ -242,16 +242,4 @@ class sfp_dns(SpiderFootPlugin):
else:
self.processHost(addr)
- # Check if wildcard DNS is enabled by looking up two random hostnames
- def checkWildcard(self, target):
- randhost = ''.join([random.choice('bcdfghjklmnpqrstvwxyz3456789') for x in range(8)])
-
- try:
- addrs = socket.gethostbyname_ex(randhost + "." + target)
- sf.debug(target + " has wildcard DNS.")
- return True
- except BaseException as e:
- sf.debug(target + " does not have wildcard DNS.")
- return False
-
# End of sfp_dns class
diff --git a/sflib.py b/sflib.py
index 004226a7..ef195484 100644
--- a/sflib.py
+++ b/sflib.py
@@ -15,6 +15,7 @@ import hashlib
import re
import os
import random
+import socket
import sys
import time
import urllib2
@@ -476,6 +477,22 @@ class SpiderFoot:
return result
+ # Check if wildcard DNS is enabled by looking up two random hostnames
+ def checkDnsWildcard(self, target):
+ randpool = 'bcdfghjklmnpqrstvwxyz3456789'
+ randhost1 = ''.join([random.choice(randpool) for x in range(6)])
+ randhost2 = ''.join([random.choice(randpool) for x in range(10)])
+
+ # An exception will be raised if either of the resolutions fail
+ try:
+ addrs = socket.gethostbyname_ex(randhost1 + "." + target)
+ addrs = socket.gethostbyname_ex(randhost2 + "." + target)
+ self.debug(target + " has wildcard DNS.")
+ return True
+ except BaseException as e:
+ self.debug(target + " does not have wildcard DNS.")
+ return False
+
#
# SpiderFoot plug-in module base class
#