Misc: improving output of generate-attack-graphs.py script.

This commit is contained in:
Cas Cremers 2013-06-20 10:32:16 +02:00
parent c11a4268b0
commit 6473aba398

View File

@ -78,7 +78,7 @@ def render_dot(fn,gtype):
base_name = base_name[:i] base_name = base_name[:i]
cmd = ["dot","-T" + gtype,"-o%s.%s" % (base_name,gtype),fn] cmd = ["dot","-T" + gtype,"-o%s.%s" % (base_name,gtype),fn]
print cmd #print cmd
call(cmd) call(cmd)
@ -96,10 +96,11 @@ def render_best_attack(fn,cid):
pref = create_file_prefix(fn,cid) pref = create_file_prefix(fn,cid)
for cl in x.claims: for cl in x.claims:
cln = cl.claimtype
if cln == "Commit":
cln = "Data_agree"
if len(cl.attacks) > 0: if len(cl.attacks) > 0:
cln = cl.claimtype
if cln == "Commit":
cln = "Data_agree"
dotfile = "attack-%s-%s.dot" % (pref,cln) dotfile = "attack-%s-%s.dot" % (pref,cln)
fp = open(dotfile,'w') fp = open(dotfile,'w')
fp.write(cl.attacks[-1].scytherDot) fp.write(cl.attacks[-1].scytherDot)
@ -108,6 +109,8 @@ def render_best_attack(fn,cid):
render_dot(dotfile,"png") render_dot(dotfile,"png")
render_dot(dotfile,"pdf") render_dot(dotfile,"pdf")
print "%s; %s" % (fn,cl)
def main(): def main():
filelist = sys.argv[1:] filelist = sys.argv[1:]
@ -116,7 +119,6 @@ def main():
for fn in set(cl): for fn in set(cl):
for cid in cl[fn]: for cid in cl[fn]:
print fn,cid
render_best_attack(fn,cid) render_best_attack(fn,cid)