Relationships added to the documentation export

pull/26/merge
Alexandre Dulaunoy 2017-09-06 07:51:02 +02:00
parent 60f6c15655
commit 0c95f5e3cc
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 14 additions and 0 deletions

14
tools/adoc_objects.py Normal file → Executable file
View File

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