Updating MISP watcher

This commit is contained in:
Félix Aime 2021-06-11 14:46:11 +02:00
parent 436870960d
commit 940d5954a3

View File

@ -125,12 +125,15 @@ def watch_misp():
instances = [i for i in misp.get_instances()] instances = [i for i in misp.get_instances()]
while instances: while instances:
for i, inst in enumerate(instances): for i, ist in enumerate(instances):
if inst["connected"]: status = misp.test_instance(ist["url"],
for ioc in misp.get_iocs(inst["id"]): ist["apikey"],
ist["verifycert"])
if status:
for ioc in misp.get_iocs(ist["id"]):
iocs.add(ioc["type"], ioc["tag"], ioc["tlp"], iocs.add(ioc["type"], ioc["tag"], ioc["tlp"],
ioc["value"], "misp-{}".format(inst["id"])) ioc["value"], "misp-{}".format(ist["id"]))
misp.update_sync(inst["id"]) misp.update_sync(ist["id"])
instances.pop(i) instances.pop(i)
if instances: time.sleep(60) if instances: time.sleep(60)