SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
Search all Internet TLDs for the target keyword.
smicallefccbba3e1da55
diff --git a/modules/sfp_similar.py b/modules/sfp_similar.pyindex b65d28b3..3abe19d4 100644--- a/modules/sfp_similar.py+++ b/modules/sfp_similar.py@@ -10,6 +10,8 @@# Licence: GPL#-------------------------------------------------------------------------------+import dns.resolver+import socketimport sysimport reimport time@@ -38,6 +40,8 @@ whoisUrlN = "http://www.whois.net/domain-keyword-search/{0}/{1}"whoisLastPageIndicator = "Next >"whoisIncrement = 16++# SpiderFoot standard lib (must be initialized in setup)sf = None@@ -48,14 +52,20 @@ class sfp_similar(SpiderFootPlugin):opts = {'source': 'ALL', # domaintools, namedroppers or ALL'method': 'left,right', # left and/or right (doesn't apply to whois.com)- 'activeonly': True # Only report domains that have content (try to fetch the page)+ 'activeonly': True, # Only report domains that have content (try to fetch the page)+ 'checkcommon': True, # For every TLD, try the common domains like com, net, etc. too+ 'commontlds': ['com', 'info', 'net', 'org', 'biz', 'co', 'edu', 'gov', 'mil' ],+ 'tldlist': "http://data.iana.org/TLD/tlds-alpha-by-domain.txt"}# Option descriptionsoptdescs = {'source': "Provider to use: 'domaintools', 'namedroppers' or 'ALL'.",'method': "Pattern search method to use: 'left,right', 'left' or 'right'.",- 'activeonly': "Only report domains that have content (try to fetch the page)?"+ 'activeonly': "Only report domains that have content (try to fetch the page)?",+ 'checkcommon': "For every TLD, also prepend each common sub-TLD (com, net, ...)",+ "commontlds": "Common TLDs to try.",+ "tldlist": "The list of all Internet TLDs."}# Internal results tracking@@ -216,6 +226,42 @@ class sfp_similar(SpiderFootPlugin):#if "whois" in self.opts['source'] or "ALL" in self.opts['source']:# self.scrapeWhois(keyword)+ # Look through all TLDs for the existence of this target keyword+ tldlistContent = sf.fetchUrl(self.opts['tldlist'])+ if tldlistContent['content'] == None:+ sf.error("Unable to obtain TLD list from " + self.opts['tldlist'], False)+ else:+ for tld in tldlistContent['content'].lower().splitlines():+ if tld.startswith("#"):+ continue++ tryDomain = keyword + "." + tld++ if self.checkForStop():+ return None++ # Try to resolve <target>.<TLD>+ try:+ addrs = socket.gethostbyname_ex(tryDomain)+ self.storeResult(None, tryDomain)+ except BaseException as e:+ sf.info("Unable to resolve " + tryDomain + "(" + str(e) + ")")++ # Try to resolve <target>.<subTLD>.<TLD>+ if self.opts['checkcommon']:+ for subtld in self.opts['commontlds']:+ subDomain = keyword + "." + subtld + "." + tld++ if self.checkForStop():+ return None++ try:+ addrs = socket.gethostbyname_ex(subDomain)+ self.storeResult(None, subDomain)+ except BaseException as e:+ sf.info("Unable to resolve " + subDomain + "(" + str(e) + ")")++ # Check popular Internet repositories for domains containing our target keywordif "domtools" in self.opts['source'] or "ALL" in self.opts['source']:if "left" in self.opts['method']:self.scrapeDomaintools(keyword, "LEFT")