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
pull/804/head
Andras Iklody 2022-11-28 12:25:25 +01:00 committed by GitHub
parent fda4160bed
commit 13dbf70d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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'])