mirror of
https://github.com/MISP/misp-galaxy.git
synced 2024-11-26 00:37:18 +00:00
fix: [graph.py] small fix to make it work
This commit is contained in:
parent
1276d834dd
commit
ca1bc24f65
1 changed files with 7 additions and 7 deletions
|
@ -117,7 +117,7 @@ def gen_dot(uuid):
|
||||||
node_params.append('shape=box')
|
node_params.append('shape=box')
|
||||||
node_params.append('style=filled,color=deepskyblue')
|
node_params.append('style=filled,color=deepskyblue')
|
||||||
else:
|
else:
|
||||||
node_params.append('shape=ellipse')
|
node_params.append('shape=ellipse')
|
||||||
dot.append('"{src}" [{params}];'.format(
|
dot.append('"{src}" [{params}];'.format(
|
||||||
src=src_tag,
|
src=src_tag,
|
||||||
params=','.join(node_params)
|
params=','.join(node_params)
|
||||||
|
@ -151,7 +151,7 @@ def gen_dot(uuid):
|
||||||
# print(new_things_to_keep)
|
# print(new_things_to_keep)
|
||||||
things_to_keep = new_things_to_keep.copy()
|
things_to_keep = new_things_to_keep.copy()
|
||||||
|
|
||||||
|
|
||||||
return dot
|
return dot
|
||||||
|
|
||||||
if args.uuid:
|
if args.uuid:
|
||||||
|
@ -162,8 +162,8 @@ if args.uuid:
|
||||||
dot.append('overlap=scale;')
|
dot.append('overlap=scale;')
|
||||||
generated_dot = gen_dot(uuid)
|
generated_dot = gen_dot(uuid)
|
||||||
if len(generated_dot) == 0:
|
if len(generated_dot) == 0:
|
||||||
print("Empty graph for uuid: {}".format(uuid))
|
print("Empty graph for uuid: {}".format(uuid))
|
||||||
exit()
|
exit()
|
||||||
print("Generating graph for uuid: {}".format(uuid))
|
print("Generating graph for uuid: {}".format(uuid))
|
||||||
dot += generated_dot
|
dot += generated_dot
|
||||||
# dot.append('}')
|
# dot.append('}')
|
||||||
|
@ -182,14 +182,14 @@ elif args.all:
|
||||||
if len(generated_dot) == 0:
|
if len(generated_dot) == 0:
|
||||||
print("Empty graph for uuid: {}".format(uuid))
|
print("Empty graph for uuid: {}".format(uuid))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print("Generating graph for uuid: {}".format(uuid))
|
print("Generating graph for uuid: {}".format(uuid))
|
||||||
dot += generated_dot
|
dot += generated_dot
|
||||||
# dot.append('}')
|
# dot.append('}')
|
||||||
# dg.source = '\n'.join(dot)
|
# dg.source = '\n'.join(dot)
|
||||||
|
|
||||||
dg = Digraph(format='png', body=dot)
|
dg = Digraph(format='png', body=dot)
|
||||||
# print(dg.source)
|
#print(dg.source)
|
||||||
dg.render(engine='dot', filename='graphs/{}'.format(uuid), cleanup=False)
|
dg.render(filename='graphs/{}'.format(uuid))
|
||||||
else:
|
else:
|
||||||
exit("No parameters given, use --help for more info.")
|
exit("No parameters given, use --help for more info.")
|
||||||
|
|
Loading…
Reference in a new issue