mirror of
https://github.com/MISP/misp-galaxy.git
synced 2025-09-08 02:52:41 +00:00
add uuid to every cluster
This commit is contained in:
parent
2eea951b71
commit
d88a4a44dc
15 changed files with 25083 additions and 23061 deletions
21
tools/add_missing_uuid.py
Normal file
21
tools/add_missing_uuid.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/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="nameof the cluster (without .json)")
|
||||
args = parser.parse_args()
|
||||
|
||||
with open(args.filename+'.json') 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+'.json', 'w') as json_file:
|
||||
json.dump(data, json_file, indent=4)
|
Loading…
Add table
Add a link
Reference in a new issue