From 0c95f5e3cce02b4fbb44db4b4a03a6ca73484edb Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Wed, 6 Sep 2017 07:51:02 +0200 Subject: [PATCH] Relationships added to the documentation export --- tools/adoc_objects.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) mode change 100644 => 100755 tools/adoc_objects.py diff --git a/tools/adoc_objects.py b/tools/adoc_objects.py old mode 100644 new mode 100755 index 2967c64..a2ee767 --- a/tools/adoc_objects.py +++ b/tools/adoc_objects.py @@ -44,6 +44,7 @@ def header(adoc=False): return False doc = adoc doc = doc + ":toc: right\n" +# doc = doc + ":doctype: book\n" doc = doc + ":toclevels: 1\n" doc = doc + ":toc-title: MISP Objects\n" doc = doc + ":icons: font\n" @@ -105,4 +106,17 @@ for mispobject in objects: adoc = asciidoc(content=c['description'], adoc=adoc, t='info', title=title) adoc = asciidoc(content=c, adoc=adoc, t='attributes', title=title) +with open('../relationships/definition.json') as filerelationships: + rel = json.load(filerelationships) + + output = '== Relationships\n' + output = output + '\n{}\n'.format(rel['description']) + output = output + '\nRelationships are part of MISP object and available in JSON format at https://github.com/MISP/misp-object/blob/master/relationships/definition.json[this location]. The JSON format can be freely reused in your application or automatically enabled in https://www.github.com/MISP/MISP[MISP].\n' + output = output + '|===\n' + output = output + '|Name of relationship | Description | Format\n' + for relationship in rel['values']: + output = output + '\n| {} | {} | {}\n'.format(relationship['name'], relationship['description'], str(relationship['format'])) + output = output + '\n|===\n' + adoc = adoc + output + print (adoc)