Skip to content

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

Simplified search engine modules and reduced false positives.

Stevece8a96c4b841
diff --git a/modules/sfp_bingsearch.py b/modules/sfp_bingsearch.py
index d8883ce3..31fa3d3e 100644
--- a/modules/sfp_bingsearch.py
+++ b/modules/sfp_bingsearch.py
@@ -18,13 +18,11 @@ class sfp_bingsearch(SpiderFootPlugin):
# Default options
opts = {
- 'fetchlinks': True, # Should we fetch links on the base domain?
'pages': 20 # Number of bing results pages to iterate
}
# Option descriptions
optdescs = {
- 'fetchlinks': "Fetch links found on the target domain-name?",
'pages': "Number of Bing results pages to iterate through."
}
@@ -67,39 +65,37 @@ class sfp_bingsearch(SpiderFootPlugin):
return None
for page in pages.keys():
+ found = False
if page in self.results:
continue
else:
self.results.append(page)
- # Check if we've been asked to stop
- if self.checkForStop():
- return None
+ links = self.sf.parseLinks(page, pages[page], eventData)
+ if len(links) == 0:
+ continue
- # Submit the bing results for analysis
- evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", pages[page],
- self.__name__, event)
- self.notifyListeners(evt)
+ for link in links:
+ if self.checkForStop():
+ return None
- # We can optionally fetch links to our domain found in the search
- # results. These may not have been identified through spidering.
- if self.opts['fetchlinks']:
- links = self.sf.parseLinks(page, pages[page], eventData)
- if len(links) == 0:
+ if link in self.results:
continue
+ else:
+ self.results.append(link)
+ if self.sf.urlFQDN(link).endswith(eventData):
+ found = True
+ self.sf.debug("Found a link: " + link)
+
+ evt = SpiderFootEvent("LINKED_URL_INTERNAL", link,
+ self.__name__, event)
+ self.notifyListeners(evt)
+
+ if found:
+ # Submit the bing results for analysis
+ evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", pages[page],
+ self.__name__, event)
+ self.notifyListeners(evt)
- for link in links:
- if link in self.results:
- continue
- else:
- self.results.append(link)
- if self.sf.urlFQDN(link).endswith(eventData):
- self.sf.debug("Found a link: " + link)
- if self.checkForStop():
- return None
-
- evt = SpiderFootEvent("LINKED_URL_INTERNAL", link,
- self.__name__, event)
- self.notifyListeners(evt)
# End of sfp_bingsearch class
diff --git a/modules/sfp_googlesearch.py b/modules/sfp_googlesearch.py
index cb40c1d2..8712a2fc 100644
--- a/modules/sfp_googlesearch.py
+++ b/modules/sfp_googlesearch.py
@@ -18,13 +18,11 @@ class sfp_googlesearch(SpiderFootPlugin):
# Default options
opts = {
- 'fetchlinks': True, # Should we fetch links on the base domain?
'pages': 20 # Number of google results pages to iterate
}
# Option descriptions
optdescs = {
- 'fetchlinks': "Fetch links found on the target domain-name?",
'pages': "Number of Google results pages to iterate through."
}
@@ -68,39 +66,36 @@ class sfp_googlesearch(SpiderFootPlugin):
return None
for page in pages.keys():
+ found = False
if page in self.results:
continue
else:
self.results.append(page)
- # Check if we've been asked to stop
- if self.checkForStop():
- return None
+ links = self.sf.parseLinks(page, pages[page], eventData)
+ if len(links) == 0:
+ continue
- # Submit the google results for analysis
- evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", pages[page],
- self.__name__, event)
- self.notifyListeners(evt)
+ for link in links:
+ if self.checkForStop():
+ return None
- # We can optionally fetch links to our domain found in the search
- # results. These may not have been identified through spidering.
- if self.opts['fetchlinks']:
- links = self.sf.parseLinks(page, pages[page], eventData)
- if len(links) == 0:
+ if link in self.results:
continue
+ else:
+ self.results.append(link)
+ self.sf.debug("Found a link: " + link)
+ if self.sf.urlFQDN(link).endswith(eventData):
+ found = True
+ evt = SpiderFootEvent("LINKED_URL_INTERNAL", link,
+ self.__name__, event)
+ self.notifyListeners(evt)
+
+ if found:
+ # Submit the google results for analysis
+ evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", pages[page],
+ self.__name__, event)
+ self.notifyListeners(evt)
- for link in links:
- if link in self.results:
- continue
- else:
- self.results.append(link)
- self.sf.debug("Found a link: " + link)
- if self.sf.urlFQDN(link).endswith(eventData):
- if self.checkForStop():
- return None
-
- evt = SpiderFootEvent("LINKED_URL_INTERNAL", link,
- self.__name__, event)
- self.notifyListeners(evt)
# End of sfp_googlesearch class
diff --git a/modules/sfp_yahoosearch.py b/modules/sfp_yahoosearch.py
index 8b49c0fd..5d8a1b6d 100644
--- a/modules/sfp_yahoosearch.py
+++ b/modules/sfp_yahoosearch.py
@@ -20,13 +20,11 @@ class sfp_yahoosearch(SpiderFootPlugin):
# Default options
opts = {
- 'fetchlinks': True, # Should we fetch links on the base domain?
'pages': 20 # Number of yahoo results pages to iterate
}
# Option descriptions
optdescs = {
- 'fetchlinks': "Fetch links found on the target domain-name?",
'pages': "Number of Yahoo results pages to iterate through."
}
@@ -72,41 +70,38 @@ class sfp_yahoosearch(SpiderFootPlugin):
return None
for page in pages.keys():
+ found = False
if page in self.results:
continue
else:
self.results.append(page)
- # Check if we've been asked to stop
- if self.checkForStop():
- return None
-
content = re.sub("RU=(.[^\/]+)\/RK=", self.yahooCleaner, pages[page])
+ links = self.sf.parseLinks(page, content, eventData)
+ if len(links) == 0:
+ continue
- # Submit the yahoo results for analysis
- evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", content,
- self.__name__, event)
- self.notifyListeners(evt)
+ for link in links:
+ if self.checkForStop():
+ return None
- # We can optionally fetch links to our domain found in the search
- # results. These may not have been identified through spidering.
- if self.opts['fetchlinks']:
- links = self.sf.parseLinks(page, content, eventData)
- if len(links) == 0:
+ if link in self.results:
continue
-
- for link in links:
- if link in self.results:
- continue
- else:
- self.results.append(link)
- if self.sf.urlFQDN(link).endswith(eventData):
- self.sf.debug("Found a link: " + link)
- if self.checkForStop():
- return None
-
- evt = SpiderFootEvent("LINKED_URL_INTERNAL", link,
- self.__name__, event)
- self.notifyListeners(evt)
+ else:
+ self.results.append(link)
+ if self.sf.urlFQDN(link).endswith(eventData):
+ found = True
+ self.sf.debug("Found a link: " + link)
+
+ evt = SpiderFootEvent("LINKED_URL_INTERNAL", link,
+ self.__name__, event)
+ self.notifyListeners(evt)
+
+ if found:
+ # Submit the yahoo results for analysis
+ evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", content,
+ self.__name__, event)
+ self.notifyListeners(evt)
+
# End of sfp_yahoosearch class