Skip to content

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

Support Google CSE IDs.

smicallef835611a4cdef
diff --git a/sflib.py b/sflib.py
index 0a8becd0..cd9db86a 100644
--- a/sflib.py
+++ b/sflib.py
@@ -742,7 +742,8 @@ class SpiderFoot:
# nopause: don't randomly pause between fetches
# useragent: User-Agent string to use
# timeout: Fetch timeout
- def googleIterate(self, searchString, opts=dict()):
+ # cx: Custom Search Engine ID
+ def googleIterate(self, searchString, opts=dict(), cx=None):
limit = 10
fetches = 0
returnResults = dict()
@@ -753,6 +754,10 @@ class SpiderFoot:
# We attempt to make the URL look as authentically human as possible
seedUrl = "http://www.google.com/search?q={0}".format(searchString) + \
"&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a"
+
+ if cx != None:
+ seedUrl = seedUrl + "cx=" + cx
+
firstPage = self.fetchUrl(seedUrl, timeout=opts['timeout'],
useragent=opts['useragent'])
if firstPage['code'] == 403 or firstPage['code'] == 503: