From 13dbf70d77cdbaaf196281403cf2199bff791d28 Mon Sep 17 00:00:00 2001 From: Andras Iklody Date: Mon, 28 Nov 2022 12:25:25 +0100 Subject: [PATCH] fix: [att&ck converter] allow multiple external IDs - There are in some cases external ID references to CAPEC in addition to ATT&CK in techniques - convert external ID to a list rather than a single string - as reported by @SYNchroACK - as hurried along by a disappointed @deresz --- .../create_mitre-enterprise-attack-attack-pattern_galaxy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/mitre-cti/v2.0/create_mitre-enterprise-attack-attack-pattern_galaxy.py b/tools/mitre-cti/v2.0/create_mitre-enterprise-attack-attack-pattern_galaxy.py index 5146f8f..ea0053d 100644 --- a/tools/mitre-cti/v2.0/create_mitre-enterprise-attack-attack-pattern_galaxy.py +++ b/tools/mitre-cti/v2.0/create_mitre-enterprise-attack-attack-pattern_galaxy.py @@ -25,11 +25,12 @@ for element in os.listdir('.'): value['value'] = temp['name'] + ' - ' + temp['external_references'][0]['external_id'] value['meta'] = {} value['meta']['refs'] = [] + value['meta']['external_id'] = [] for reference in temp['external_references']: if 'url' in reference and reference['url'] not in value['meta']['refs']: value['meta']['refs'].append(reference['url']) - if 'external_id' in reference: - value['meta']['external_id'] = reference['external_id'] + if 'external_id' in reference and reference['external_id'] not in value['meta']['external_id]: + value['meta']['external_id'].append(reference['external_id']) value['meta']['kill_chain'] = [] for killchain in temp['kill_chain_phases']: value['meta']['kill_chain'].append(killchain['kill_chain_name'] + ':enterprise-attack:' + killchain['phase_name'])