mirror of
https://github.com/MISP/misp-galaxy.git
synced 2024-11-26 08:47:18 +00:00
[mitre] update sorting algo
will make future ATT&CK updates less noisy in the git diff
This commit is contained in:
parent
ff280a9b44
commit
4a469299fd
6 changed files with 60560 additions and 60551 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -177,7 +177,16 @@ for t in types:
|
||||||
item_2.pop('type', None)
|
item_2.pop('type', None)
|
||||||
file_data['values'].append(item_2)
|
file_data['values'].append(item_2)
|
||||||
|
|
||||||
file_data['values'] = sorted(file_data['values'], key=lambda x: sorted(x['value'])) # FIXME the sort algo needs to be further improved
|
# FIXME the sort algo needs to be further improved, potentially with a recursive deep sort
|
||||||
|
file_data['values'] = sorted(file_data['values'], key=lambda x: sorted(x['value']))
|
||||||
|
for item in file_data['values']:
|
||||||
|
if 'related' in item:
|
||||||
|
item['related'] = sorted(item['related'], key=lambda x: x['dest-uuid'])
|
||||||
|
if 'meta' in item:
|
||||||
|
if 'refs' in item['meta']:
|
||||||
|
item['meta']['refs'] = sorted(item['meta']['refs'])
|
||||||
|
if 'mitre_data_sources' in item['meta']:
|
||||||
|
item['meta']['mitre_data_sources'] = sorted(item['meta']['mitre_data_sources'])
|
||||||
file_data['version'] += 1
|
file_data['version'] += 1
|
||||||
with open(fname, 'w') as f:
|
with open(fname, 'w') as f:
|
||||||
json.dump(file_data, f, indent=2, sort_keys=True, ensure_ascii=False)
|
json.dump(file_data, f, indent=2, sort_keys=True, ensure_ascii=False)
|
||||||
|
|
Loading…
Reference in a new issue