Skip to content

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

Fixed bug handling google/bing results.

smicallef4d894af92763
diff --git a/sflib.py b/sflib.py
index 8336cd61..53a66e7e 100644
--- a/sflib.py
+++ b/sflib.py
@@ -752,8 +752,7 @@ class SpiderFoot:
"&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a"
firstPage = self.fetchUrl(seedUrl, timeout=opts['timeout'],
useragent=opts['useragent'])
- if firstPage['code'] == 403 or firstPage['code'] == 503 \
- or "name=\"captcha\"" in firstPage['content']:
+ if firstPage['code'] == 403 or firstPage['code'] == 503:
self.error("Google doesn't like us right now..", False)
return None
@@ -761,6 +760,10 @@ class SpiderFoot:
self.error("Failed to fetch content from Google.", False)
return None
+ if "name=\"captcha\"" in firstPage['content']:
+ self.error("Google returned a CAPTCHA.", False)
+ return None
+
returnResults[seedUrl] = firstPage['content']
matches = re.findall("(\/search\S+start=\d+.[^\'\"]*sa=N)",
firstPage['content'])
@@ -786,8 +789,7 @@ class SpiderFoot:
nextPage = self.fetchUrl('http://www.google.com' + nextUrl,
timeout=opts['timeout'], useragent=opts['useragent'])
- if nextPage['code'] == 403 or nextPage['code'] == 503 \
- or "name=\"captcha\"" in nextPage['content']:
+ if nextPage['code'] == 403 or nextPage['code'] == 503:
self.error("Google doesn't like us right now..", False)
return returnResults
@@ -795,6 +797,10 @@ class SpiderFoot:
self.error("Failed to fetch subsequent content from Google.", False)
return returnResults
+ if "name=\"captcha\"" in nextPage['content']:
+ self.error("Google returned a CAPTCHA.", False)
+ return None
+
returnResults[nextUrl] = nextPage['content']
matches = re.findall("(\/search\S+start=\d+.[^\'\"]*)",
nextPage['content'], re.IGNORECASE)
@@ -822,7 +828,7 @@ class SpiderFoot:
"&pc=MOZI"
firstPage = self.fetchUrl(seedUrl, timeout=opts['timeout'],
useragent=opts['useragent'])
- if firstPage['code'] == 400 or "/challengepic?" in firstPage['content']:
+ if firstPage['code'] == 400:
self.error("Bing doesn't like us right now..", False)
return None
@@ -830,6 +836,10 @@ class SpiderFoot:
self.error("Failed to fetch content from Bing.", False)
return None
+ if "/challengepic?" in firstPage['content']:
+ self.error("Bing returned a CAPTCHA.", False)
+ return None
+
returnResults[seedUrl] = firstPage['content']
matches = re.findall("(\/search\S+first=\d+.[^\'\"]*FORM=\S+)",
@@ -855,7 +865,7 @@ class SpiderFoot:
nextPage = self.fetchUrl('http://www.bing.com' + nextUrl,
timeout=opts['timeout'], useragent=opts['useragent'])
- if nextPage['code'] == 400 or "/challengepic?" in nextPage['content']:
+ if nextPage['code'] == 400:
self.error("Bing doesn't like us any more..", False)
return returnResults
@@ -863,6 +873,10 @@ class SpiderFoot:
self.error("Failed to fetch subsequent content from Bing.", False)
return returnResults
+ if "/challengepic?" in firstPage['content']:
+ self.error("Bing returned a CAPTCHA.", False)
+ return None
+
returnResults[nextUrl] = nextPage['content']
matches = re.findall("(\/search\S+first=\d+.[^\'\"]*)",
nextPage['content'], re.IGNORECASE)