Updating mpa test scripts.
This commit is contained in:
parent
985397c8b6
commit
be6f7b481d
@ -455,7 +455,9 @@ def findAllMPA(protocolset,options=[],mpaoptions=[]):
|
||||
"""
|
||||
|
||||
global FOUND
|
||||
global OPTS
|
||||
global OPTS, ARGS
|
||||
global PROTNAMETOFILE
|
||||
global ALLCLAIMS
|
||||
|
||||
FOUND = []
|
||||
|
||||
@ -490,6 +492,29 @@ def findAllMPA(protocolset,options=[],mpaoptions=[]):
|
||||
print " %s" % (p)
|
||||
print
|
||||
|
||||
# output of all claims (only if latex required)
|
||||
|
||||
if OPTS.latex:
|
||||
clset = set()
|
||||
for claim in ALLCLAIMS:
|
||||
prot = str(claim.protocol)
|
||||
file = PROTNAMETOFILE[prot]
|
||||
clid = claim.id
|
||||
descr = claim.roledescribe()
|
||||
|
||||
tup = (file,prot,clid,descr)
|
||||
clset.add(tup)
|
||||
|
||||
fp = open("gen-%s-claims.txt" % (OPTS.latex),"w")
|
||||
|
||||
fp.write("%% OPTS: %s\n" % OPTS)
|
||||
fp.write("%% ARGS: %s\n" % ARGS)
|
||||
|
||||
for (file,prot,clid,descr) in sorted(clset):
|
||||
fp.write("%s; %s; %s; %s\n" % (file,prot,clid,descr))
|
||||
|
||||
fp.close()
|
||||
|
||||
# Latex output of protocols with correct claims
|
||||
if OPTS.latex:
|
||||
pmapclaims = {}
|
||||
@ -499,6 +524,10 @@ def findAllMPA(protocolset,options=[],mpaoptions=[]):
|
||||
pmapclaims[protocol].add(claimid)
|
||||
|
||||
fp = open("gen-%s-correctclaims.tex" % (OPTS.latex),"w")
|
||||
|
||||
fp.write("%% OPTS: %s\n" % OPTS)
|
||||
fp.write("%% ARGS: %s\n" % ARGS)
|
||||
|
||||
fp.write("\\begin{tabular}{ll}\n")
|
||||
fp.write("Protocol & Claims \\\\\n")
|
||||
for protocol in sorted(pmapclaims.keys()):
|
||||
@ -559,8 +588,12 @@ def findAllMPA(protocolset,options=[],mpaoptions=[]):
|
||||
TODO : Check whether current tests stop after finding *one* MPA attack or whether they find *all*.
|
||||
|
||||
"""
|
||||
if OPTS.latex:
|
||||
if OPTS.latex and not OPTS.pickle:
|
||||
fp = open("gen-%s-mpaattacks.tex" % (OPTS.latex),"w")
|
||||
|
||||
fp.write("%% OPTS: %s\n" % OPTS)
|
||||
fp.write("%% ARGS: %s\n" % ARGS)
|
||||
|
||||
fp.write("\\begin{tabular}{lll}\n")
|
||||
fp.write("Protocol & Claim & MPA attacks \\\\ \n")
|
||||
|
||||
@ -606,6 +639,9 @@ def findAllMPA(protocolset,options=[],mpaoptions=[]):
|
||||
print "We scanned %i protocols with options [%s]." % (len(protocolset),options)
|
||||
print "We found %i correct claims." % (len(correct))
|
||||
print "We then scanned combinations of at most %i protocols with options [%s]." % (OPTS.maxprotocols,alloptions)
|
||||
if OPTS.pickle:
|
||||
print "However, just precomputing now, hence we are not drawing any conclusions."
|
||||
else:
|
||||
print "We found %i MPA attacks." % (len(FOUND))
|
||||
print "The attacks involve the claims of %i protocols." % (len(mpaprots))
|
||||
print "-" * 70
|
||||
@ -754,6 +790,7 @@ def fullScan(l, options = [], mpaoptions = []):
|
||||
else:
|
||||
lres = exploreTree(0, choices, l, options = options, mpaoptions = mpaoptions)
|
||||
if len(lres) > 1:
|
||||
if not OPTS.pickle:
|
||||
showDiff(lres)
|
||||
|
||||
allprots = set()
|
||||
@ -766,6 +803,7 @@ def fullScan(l, options = [], mpaoptions = []):
|
||||
for prot in INVOLVED:
|
||||
invprots.add(str(prot))
|
||||
|
||||
if not OPTS.pickle:
|
||||
print "The bottom line: we found %i protocols with multi-protocol attacks from a set of %i protocols." % (len(attprots),len(allprots))
|
||||
print
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user