Skip to content

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

Remove Yahoo scraping.

smicallef49416e6bcabf
diff --git a/sflib.py b/sflib.py
index 57a4ae2a..3042ce53 100644
--- a/sflib.py
+++ b/sflib.py
@@ -1352,104 +1352,6 @@ class SpiderFoot:
return returnResults
- # Scrape Yahoo for content, starting at startUrl and iterating through
- # results based on options supplied. Will return a dictionary of all pages
- # fetched and their contents {page => content}.
- # Options accepted:
- # limit: number of search result pages before returning, default is 10
- # nopause: don't randomly pause between fetches
- # useragent: User-Agent string to use
- # timeout: Fetch timeout
- def yahooIterate(self, searchString, opts=dict()):
- limit = 10
- fetches = 0
- returnResults = dict()
-
- if 'limit' in opts:
- limit = opts['limit']
-
- # We attempt to make the URL look as authentically human as possible
- seedUrl = u"https://search.yahoo.com/search?p={0}".format(searchString) + \
- u"&toggle=1&cop=mss&ei=UTF-8"
-
- attempts = 0
- failed = False
- while attempts < 3:
- firstPage = self.fetchUrl(seedUrl, timeout=opts['timeout'],
- useragent=opts['useragent'])
- if firstPage['code'] == "403":
- self.error("Yahoo doesn't like us right now..", False)
- failed = True
-
- if firstPage['content'] is None:
- self.error("Failed to fetch content from Yahoo.", False)
- failed = True
-
- if failed:
- self.refreshTorIdent()
- attempts += 1
- failed = False
- else:
- break
-
- if attempts == 3:
- return None
-
- returnResults[seedUrl] = firstPage['content']
- pat = re.compile("(\/search;\S+b=\d+.[^\'\"]*)", re.IGNORECASE)
- matches = re.findall(pat, firstPage['content'])
-
- while matches > 0 and fetches < limit:
- nextUrl = None
- fetches += 1
- for match in matches:
- # Yahoo moves in increments of 10
- if "b=" + str((fetches * 10) + 1) in match:
- nextUrl = u"https://search.yahoo.com" + match
-
- if nextUrl is None:
- self.debug("Nothing left to scan for in Yahoo results.")
- return returnResults
- self.info("Next Yahoo URL: " + nextUrl)
-
- # Wait for a random number of seconds between fetches
- if 'nopause' not in opts:
- pauseSecs = random.randint(4, 15)
- self.info("Pausing for " + str(pauseSecs))
- time.sleep(pauseSecs)
-
- attempts = 0
- failed = False
- while attempts < 3:
- nextPage = self.fetchUrl(nextUrl, timeout=opts['timeout'],
- useragent=opts['useragent'])
- if nextPage['code'] == "403":
- self.error("Yahoo doesn't like us any more..", False)
- failed = True
-
- if nextPage['content'] is None:
- self.error("Failed to fetch subsequent content from Yahoo.",
- False)
- failed = True
-
- if failed:
- self.refreshTorIdent()
- attempts += 1
- failed = False
- else:
- break
-
- if attempts == 3:
- return returnResults
-
- returnResults[nextUrl] = nextPage['content']
- pat = re.compile("(\/search;\S+b=\d+.[^\'\"]*)", re.IGNORECASE)
- matches = re.findall(pat, nextPage['content'])
-
- return returnResults
-
-
-#
# SpiderFoot plug-in module base class
#
class SpiderFootPlugin(object):