Skip to content

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

Fixed yahoo search handling and other bugs.

Steve651e3d861a6a
diff --git a/modules/sfp_intfiles.py b/modules/sfp_intfiles.py
index 45fe2a05..69343975 100644
--- a/modules/sfp_intfiles.py
+++ b/modules/sfp_intfiles.py
@@ -41,7 +41,6 @@ class sfp_intfiles(SpiderFootPlugin):
def setup(self, sfc, userOpts=dict()):
self.sf = sfc
self.results = list()
- self.__dataSource__ = "Target Website"
for opt in userOpts.keys():
self.opts[opt] = userOpts[opt]
@@ -56,9 +55,6 @@ class sfp_intfiles(SpiderFootPlugin):
def producedEvents(self):
return ["SEARCH_ENGINE_WEB_CONTENT", "INTERESTING_FILE"]
- def yahooCleaner(self, string):
- return " url=\"" + urllib.unquote(string.group(1)) + "\" "
-
# Handle events sent to this module
def handleEvent(self, event):
eventName = event.eventType
@@ -98,18 +94,21 @@ class sfp_intfiles(SpiderFootPlugin):
"%2Bext:" + fileExt, dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'],
timeout=self.opts['_fetchtimeout']))
+ self.__dataSource__ = "Google"
if self.opts['searchengine'].lower() == "bing":
pages = self.sf.bingIterate("site:" + eventData + "+" +
- "%2Bext:" + fileExt, dict(limit=self.opts['pages'],
+ "%2Bfiletype:" + fileExt, dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'],
timeout=self.opts['_fetchtimeout']))
+ self.__dataSource__ = "Bing"
if self.opts['searchengine'].lower() == "yahoo":
pages = self.sf.yahooIterate("site:" + eventData + "+" +
- "%2Bext:" + fileExt, dict(limit=self.opts['pages'],
+ "%2Bfiletype:" + fileExt, dict(limit=self.opts['pages'],
useragent=self.opts['_useragent'],
timeout=self.opts['_fetchtimeout']))
+ self.__dataSource__ = "Yahoo"
if pages is None:
self.sf.info("No results returned from " + self.opts['searchengine'] +
@@ -126,17 +125,12 @@ class sfp_intfiles(SpiderFootPlugin):
if self.checkForStop():
return None
- if self.opts['searchengine'].lower() == "yahoo":
- res = re.sub("RU=(.*?)/RK=", self.yahooCleaner, pages[page])
- else:
- res = pages[page]
-
# Submit the gresults for analysis
- evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", res,
+ evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", pages[page],
self.__name__, event)
self.notifyListeners(evt)
- links = self.sf.parseLinks(page, res, eventData)
+ links = self.sf.parseLinks(page, pages[page], eventData)
if len(links) == 0:
continue
@@ -144,6 +138,9 @@ class sfp_intfiles(SpiderFootPlugin):
if link in self.results:
continue
+ if self.opts['searchengine'] == "yahoo":
+ link = re.sub(r'.*RU=(.*?)/RK=.*', r'\1', link)
+
if self.sf.urlFQDN(link).endswith(eventData):
# This for loop might seem redundant but sometimes search engines return results
# for other file extensions.
diff --git a/modules/sfp_socialprofiles.py b/modules/sfp_socialprofiles.py
index cb370a69..ec7a07ff 100644
--- a/modules/sfp_socialprofiles.py
+++ b/modules/sfp_socialprofiles.py
@@ -19,11 +19,11 @@ from sflib import SpiderFoot, SpiderFootPlugin, SpiderFootEvent
sites = {
# Search string to use, domain name the profile will sit on within
# those search results.
- "Facebook": ['+intitle:%22{0}%22%20+site:facebook.com',
+ "Facebook": ['+title:%22{0}%22%20+site:facebook.com',
'"(https?://[a-z\.]*facebook.[a-z\.]+/[^\"<> ]+)"'],
- "Google+": ['+intitle:%22{0}%22%20+site:plus.google.com',
+ "Google+": ['+title:%22{0}%22%20+site:plus.google.com',
'"(https?://plus.google.[a-z\.]+/\d+[^\"<>\/ ]+)"'],
- "LinkedIn": ['+intitle:%22{0}%22%20+site:linkedin.com',
+ "LinkedIn": ['+title:%22{0}%22%20+site:linkedin.com',
'"(https?://[a-z\.]*linkedin.[a-z\.]+/[^\"<> ]+)"']
}
@@ -66,10 +66,6 @@ class sfp_socialprofiles(SpiderFootPlugin):
def producedEvents(self):
return ["SOCIAL_MEDIA", "SEARCH_ENGINE_WEB_CONTENT"]
- def yahooCleaner(self, string):
- ret = "\"" + urllib.unquote(string.group(1)) + "\""
- return ret
-
# Handle events sent to this module
def handleEvent(self, event):
eventName = event.eventType
@@ -126,14 +122,8 @@ class sfp_socialprofiles(SpiderFootPlugin):
for key in results.keys():
instances = list()
- # Yahoo requires some additional parsing
- if self.opts['method'].lower() == "yahoo":
- res = re.sub("RU=(.[^\/]+)\/RK=", self.yahooCleaner,
- results[key], 0)
- else:
- res = results[key]
- matches = re.findall(searchDom, res, re.IGNORECASE)
+ matches = re.findall(searchDom, results[key], re.IGNORECASE)
if matches is not None:
for match in matches:
@@ -142,6 +132,9 @@ class sfp_socialprofiles(SpiderFootPlugin):
else:
instances.append(match)
+ if self.opts['method'] == "yahoo":
+ match = re.sub(r'.*RU=(.*?)/RK=.*', r'\1', match)
+
if self.checkForStop():
return None
@@ -156,7 +149,8 @@ class sfp_socialprofiles(SpiderFootPlugin):
else:
found = False
for kw in self.keywords:
- if re.search("[^a-zA-Z\-\_]" + kw + "[^a-zA-Z\-\_]", pres['content'], re.IGNORECASE):
+ if re.search("[^a-zA-Z\-\_]" + kw + "[^a-zA-Z\-\_]",
+ pres['content'], re.IGNORECASE):
found = True
if not found:
continue
@@ -166,8 +160,8 @@ class sfp_socialprofiles(SpiderFootPlugin):
self.__name__, event)
self.notifyListeners(evt)
- # Submit the bing results for analysis
- evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", res,
+ # Submit the results for analysis
+ evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", results[key],
self.__name__, event)
self.notifyListeners(evt)
diff --git a/modules/sfp_yahoosearch.py b/modules/sfp_yahoosearch.py
index b219ee1e..d888d730 100644
--- a/modules/sfp_yahoosearch.py
+++ b/modules/sfp_yahoosearch.py
@@ -48,9 +48,6 @@ class sfp_yahoosearch(SpiderFootPlugin):
def producedEvents(self):
return ["LINKED_URL_INTERNAL", "SEARCH_ENGINE_WEB_CONTENT"]
- def yahooCleaner(self, string):
- return " url=\"" + urllib.unquote(string.group(1)) + "\" "
-
def handleEvent(self, event):
eventName = event.eventType
srcModuleName = event.module
@@ -64,8 +61,8 @@ class sfp_yahoosearch(SpiderFootPlugin):
# Sites hosted on the domain
pages = self.sf.yahooIterate("site:" + eventData, dict(limit=self.opts['pages'],
- useragent=self.opts['_useragent'],
- timeout=self.opts['_fetchtimeout']))
+ useragent=self.opts['_useragent'],
+ timeout=self.opts['_fetchtimeout']))
if pages is None:
self.sf.info("No results returned from Yahoo.")
return None
@@ -77,12 +74,12 @@ class sfp_yahoosearch(SpiderFootPlugin):
else:
self.results.append(page)
- content = re.sub("RU=(.[^\/]+)\/RK=", self.yahooCleaner, pages[page])
- links = self.sf.parseLinks(page, content, eventData)
+ links = self.sf.parseLinks(page, pages[page], eventData)
if len(links) == 0:
continue
- for link in links:
+ for _link in links:
+ link = re.sub(r'.*RU=(.*?)/RK=.*', r'\1', _link)
if self.checkForStop():
return None
@@ -100,7 +97,7 @@ class sfp_yahoosearch(SpiderFootPlugin):
if found:
# Submit the yahoo results for analysis
- evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", content,
+ evt = SpiderFootEvent("SEARCH_ENGINE_WEB_CONTENT", pages[page],
self.__name__, event)
self.notifyListeners(evt)