From 080cfc6042d5d67b33bb84721131e6226ab7043d Mon Sep 17 00:00:00 2001 From: Joshua Hiller Date: Tue, 7 Feb 2023 15:02:02 -0500 Subject: [PATCH] Fix bad related adversary id lookup. Closes #98. --- cs_misp_import/reports.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cs_misp_import/reports.py b/cs_misp_import/reports.py index 66e9359..3c71f44 100644 --- a/cs_misp_import/reports.py +++ b/cs_misp_import/reports.py @@ -331,7 +331,11 @@ def add_actor_detail(self, report: dict, event: MISPEvent) -> MISPEvent: if actor.get('name'): actor_detail = self.intel_api_client.falcon.get_actor_entities(ids=actor.get("id")) if actor_detail["status_code"] == 200: - actor_detail = actor_detail["body"]["resources"][0] + try: + actor_detail = actor_detail["body"]["resources"][0] + except TypeError: + # Bad actor id lookup + actor_detail = {} actor_name = actor.get('name').split(" ") first = actor_detail.get("first_activity_date", 0) last = actor_detail.get("last_activity_date", 0)