SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
feat: add bing api key to UI
Amr Awadf38df41c6ad9
diff --git a/modules/sfp_bingsearch.py b/modules/sfp_bingsearch.pyindex b99843ad..ffc058e9 100644--- a/modules/sfp_bingsearch.py+++ b/modules/sfp_bingsearch.py@@ -16,10 +16,13 @@ class sfp_bingsearch(SpiderFootPlugin):"""Bing:Footprint,Investigate,Passive:Search Engines::Some light Bing scraping to identify sub-domains and links."""# Default options- opts = {"pages": 20} # Number of max bing results to request from api+ opts = {"pages": 20, "api_key": ""}# Option descriptions- optdescs = {"pages": "Number of max bing results to request from api."}+ optdescs = {+ "pages": "Number of max bing results to request from api.",+ "api_key": "Bing API Key.",+ }results = list()@@ -58,6 +61,7 @@ class sfp_bingsearch(SpiderFootPlugin):"timeout": self.opts["_fetchtimeout"],"useragent": self.opts["_useragent"],"count": self.opts["pages"],+ "api_key": self.opts["api_key"],},)if results is None:diff --git a/modules/sfp_bingsharedip.py b/modules/sfp_bingsharedip.pyindex f3679764..7baa6bcb 100644--- a/modules/sfp_bingsharedip.py+++ b/modules/sfp_bingsharedip.py@@ -20,7 +20,13 @@ class sfp_bingsharedip(SpiderFootPlugin):"""Bing (Shared IPs):Footprint,Investigate,Passive:Search Engines::Search Bing for hosts sharing the same IP."""# Default options- opts = {"cohostsamedomain": False, "pages": 20, "verify": True, "maxcohost": 100}+ opts = {+ "cohostsamedomain": False,+ "pages": 20,+ "verify": True,+ "maxcohost": 100,+ "api_key": "",+ }# Option descriptionsoptdescs = {@@ -28,6 +34,7 @@ class sfp_bingsharedip(SpiderFootPlugin):"pages": "Number of max bing results to request from api.","verify": "Verify co-hosts are valid by checking if they still resolve to the shared IP.","maxcohost": "Stop reporting co-hosted sites after this many are found, as it would likely indicate web hosting.",+ "api_key": "Bing API Key.",}results = dict()@@ -114,6 +121,7 @@ class sfp_bingsharedip(SpiderFootPlugin):"timeout": self.opts["_fetchtimeout"],"useragent": self.opts["_useragent"],"count": self.opts["pages"],+ "api_key": self.opts["api_key"],},)if results is None:diff --git a/sflib.py b/sflib.pyindex a093c3f5..175b1d12 100644--- a/sflib.py+++ b/sflib.py@@ -1313,8 +1313,6 @@ class SpiderFoot:# timeout: api call timeoutdef bingIterate(self, searchString, opts=dict()):endpoint = "https://api.cognitive.microsoft.com/bing/v7.0/search?"- # ToDO: figure out how to add credentials in config:- key = ""params = {"q": searchString,"responseFilter": "Webpages",@@ -1324,7 +1322,7 @@ class SpiderFoot:endpoint + urllib.urlencode(params),timeout=opts["timeout"],useragent=opts["useragent"],- headers={"Ocp-Apim-Subscription-Key": key},+ headers={"Ocp-Apim-Subscription-Key": opts["api_key"]},)if response is None: