From 940d5954a3ec5404174ee6cb9f9709878915ec93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Aime?= Date: Fri, 11 Jun 2021 14:46:11 +0200 Subject: [PATCH] Updating MISP watcher --- server/backend/watchers.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/backend/watchers.py b/server/backend/watchers.py index ff3b63b..7299eb8 100644 --- a/server/backend/watchers.py +++ b/server/backend/watchers.py @@ -125,12 +125,15 @@ def watch_misp(): instances = [i for i in misp.get_instances()] while instances: - for i, inst in enumerate(instances): - if inst["connected"]: - for ioc in misp.get_iocs(inst["id"]): + for i, ist in enumerate(instances): + status = misp.test_instance(ist["url"], + ist["apikey"], + ist["verifycert"]) + if status: + for ioc in misp.get_iocs(ist["id"]): iocs.add(ioc["type"], ioc["tag"], ioc["tlp"], - ioc["value"], "misp-{}".format(inst["id"])) - misp.update_sync(inst["id"]) + ioc["value"], "misp-{}".format(ist["id"])) + misp.update_sync(ist["id"]) instances.pop(i) if instances: time.sleep(60)