mirror of
https://github.com/MISP/misp-galaxy.git
synced 2024-11-22 23:07:19 +00:00
21 lines
568 B
Python
21 lines
568 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import json
|
|
import argparse
|
|
import uuid
|
|
|
|
parser = argparse.ArgumentParser(description='Add missing uuids in clusters')
|
|
parser.add_argument("-f", "--filename", required=True, help="name of the cluster")
|
|
args = parser.parse_args()
|
|
|
|
with open(args.filename) as json_file:
|
|
data = json.load(json_file)
|
|
json_file.close()
|
|
|
|
for value in data['values']:
|
|
if 'uuid' not in value:
|
|
value['uuid'] = str(uuid.uuid4())
|
|
|
|
with open(args.filename, 'w') as json_file:
|
|
json.dump(data, json_file, indent=4)
|