SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.
Python attacksurfacecticybersecurityfootprintinghackinginformation-gatheringinformation-securityinfosecintelligence-gatheringosintosint-frameworkosint-reconnaissanceosint-toolpentestingpythonreconsecurity-toolsthreat-intelligencethreatintel
feat: imporve error handling
Amr Awad27e95c0f1c45
diff --git a/modules/sfp_bingsearch.py b/modules/sfp_bingsearch.pyindex 04dd639c..fdaa16cd 100644--- a/modules/sfp_bingsearch.py+++ b/modules/sfp_bingsearch.py@@ -90,10 +90,14 @@ class sfp_bingsearch(SpiderFootPlugin):timeout=self.opts["_fetchtimeout"],useragent=self.opts["_useragent"],)- evt = SpiderFootEvent(- "SEARCH_ENGINE_WEB_CONTENT", response["content"], self.__name__, event- )- self.notifyListeners(evt)+ if response['status'] == 'OK':+ evt = SpiderFootEvent(+ "SEARCH_ENGINE_WEB_CONTENT", response["content"], self.__name__, event+ )+ self.notifyListeners(evt)+ else:+ self.sf.error("Failed to fetch bing web search URL", exception=False)+# End of sfp_bingsearch classdiff --git a/modules/sfp_bingsharedip.py b/modules/sfp_bingsharedip.pyindex 68ba8904..514f18c8 100644--- a/modules/sfp_bingsharedip.py+++ b/modules/sfp_bingsharedip.py@@ -170,13 +170,16 @@ class sfp_bingsharedip(SpiderFootPlugin):timeout=self.opts["_fetchtimeout"],useragent=self.opts["_useragent"],)- evt = SpiderFootEvent(- "SEARCH_ENGINE_WEB_CONTENT",- response["content"],- self.__name__,- event,- )- self.notifyListeners(evt)+ if response['status'] == 'OK':+ evt = SpiderFootEvent(+ "SEARCH_ENGINE_WEB_CONTENT",+ response["content"],+ self.__name__,+ event,+ )+ self.notifyListeners(evt)+ else:+ self.sf.error("Failed to fetch bing web search URL", exception=False)# End of sfp_bingsharedip classdiff --git a/sflib.py b/sflib.pyindex 5bae66be..bd67a27f 100644--- a/sflib.py+++ b/sflib.py@@ -1325,11 +1325,8 @@ class SpiderFoot:headers={"Ocp-Apim-Subscription-Key": opts["api_key"]},)- if response is None:- message = "Failed to talk to Bing API, status code: %s, response: %s".format(- response.status_code, response.text- )- self.error(message)+ if response['status'] != 'OK':+ self.error("Failed to get a valid response from bing API", exception=False)return Noneresponse_json = json.loads(response['content'])