- Removed command line option for tuple width. Instead, it is now in the
code. - Added protocol test resume by adding percentage start parameter.
This commit is contained in:
parent
9a86e80c96
commit
e34c6a2cd2
@ -26,6 +26,9 @@
|
|||||||
# PARAMETERS
|
# PARAMETERS
|
||||||
# ***********************
|
# ***********************
|
||||||
|
|
||||||
|
# Tuple width (number of concurrent protocols)
|
||||||
|
TupleWidth = "2"
|
||||||
|
|
||||||
# Temporary files
|
# Temporary files
|
||||||
TempFileList = "scyther-blap.tmp"
|
TempFileList = "scyther-blap.tmp"
|
||||||
TempFileTuples = "scyther-blip.tmp"
|
TempFileTuples = "scyther-blip.tmp"
|
||||||
@ -37,7 +40,7 @@ ScytherProgram = "../src/scyther"
|
|||||||
# Scyther parameters
|
# Scyther parameters
|
||||||
ScytherDefaults = "--summary"
|
ScytherDefaults = "--summary"
|
||||||
ScytherMethods = "--match=1 --arachne"
|
ScytherMethods = "--match=1 --arachne"
|
||||||
ScytherBounds = "--timer=10 --max-runs=5 --max-length=25"
|
ScytherBounds = "--timer=30 --max-runs=5 --max-length=20"
|
||||||
|
|
||||||
# Build a large part of the command line (for Scyther) already
|
# Build a large part of the command line (for Scyther) already
|
||||||
ScytherArgs = ScytherDefaults + " " + ScytherMethods + " " + ScytherBounds
|
ScytherArgs = ScytherDefaults + " " + ScytherMethods + " " + ScytherBounds
|
||||||
@ -48,7 +51,8 @@ IncludeProtocols = 'spdl-defaults.inc'
|
|||||||
|
|
||||||
# Some protocols are causing troubles: this is a hard-coded filter to exclude
|
# Some protocols are causing troubles: this is a hard-coded filter to exclude
|
||||||
# the problem children. Unfair, yes. Practical, yes.
|
# the problem children. Unfair, yes. Practical, yes.
|
||||||
SkipList = [ 'gong-nonce.spdl', 'gong-nonce-b.spdl', 'splice-as-hc.spdl', 'kaochow-palm.spdl' ]
|
#SkipList = [ 'gong-nonce.spdl', 'gong-nonce-b.spdl', 'splice-as-hc.spdl', 'kaochow-palm.spdl' ]
|
||||||
|
SkipList = []
|
||||||
|
|
||||||
ClaimToResultMap = {} # maps protocol claims to correctness in singular tests (0,1)
|
ClaimToResultMap = {} # maps protocol claims to correctness in singular tests (0,1)
|
||||||
ProtocolToFileMap = {} # maps protocol names to file names
|
ProtocolToFileMap = {} # maps protocol names to file names
|
||||||
@ -299,13 +303,20 @@ def DescribeContext (filep, protocols, claim):
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Determines:
|
# Determines:
|
||||||
# TupleWidth
|
|
||||||
# ProtocolCount
|
# ProtocolCount
|
||||||
# Protocol[0..count-1]
|
# Protocol[0..count-1]
|
||||||
#
|
#
|
||||||
# Furthermore, TempFileList is created.
|
# Furthermore, TempFileList is created.
|
||||||
|
|
||||||
TupleWidth = sys.argv[1]
|
# Where should we start (if this is a number)
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
StartPercentage = int (sys.argv[1])
|
||||||
|
if StartPercentage < 0 or StartPercentage > 100:
|
||||||
|
print "Illegal range for starting percentage (0-100):", StartPercentage
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
else:
|
||||||
|
StartPercentage = 0
|
||||||
|
|
||||||
# Read stdin into list and count, send to file
|
# Read stdin into list and count, send to file
|
||||||
loop = 1
|
loop = 1
|
||||||
@ -374,50 +385,61 @@ print "Commencing test for", TupleCount, "protocol combinations."
|
|||||||
inp = open(TempFileTuples, 'r')
|
inp = open(TempFileTuples, 'r')
|
||||||
processed = 0
|
processed = 0
|
||||||
newattacks = 0
|
newattacks = 0
|
||||||
|
StartSkip = 0
|
||||||
|
|
||||||
|
# Possibly skip some
|
||||||
|
if StartPercentage > 0:
|
||||||
|
StartSkip = int ((TupleCount * StartPercentage) / 100)
|
||||||
|
print "Resuming. Skipping the first", StartSkip,"tuples."
|
||||||
|
|
||||||
|
#
|
||||||
|
# Check all these protocols
|
||||||
|
#
|
||||||
for tline in inp:
|
for tline in inp:
|
||||||
#
|
if (processed >= StartSkip):
|
||||||
# Get the next tuple
|
#
|
||||||
#
|
# Get the next tuple
|
||||||
protocols = tline.split()
|
#
|
||||||
ShowProgress (processed, TupleCount, " ".join(protocols) + safetxt)
|
protocols = tline.split()
|
||||||
#
|
ShowProgress (processed, TupleCount, " ".join(protocols) + safetxt)
|
||||||
# Process it
|
#
|
||||||
#
|
# Process it
|
||||||
results = ScytherEval ( protocols )
|
#
|
||||||
#
|
results = ScytherEval ( protocols )
|
||||||
# Now we have the results for this combination.
|
#
|
||||||
# Check whether any of these claims is 'newly false'
|
# Now we have the results for this combination.
|
||||||
#
|
# Check whether any of these claims is 'newly false'
|
||||||
for claim,value in results.items():
|
#
|
||||||
if value == 0:
|
for claim,value in results.items():
|
||||||
# Apparently this claim is false now (there is
|
if value == 0:
|
||||||
# an attack)
|
# Apparently this claim is false now (there is
|
||||||
if ClaimToResultMap[claim] == 1:
|
# an attack)
|
||||||
# Wooh! It was correct before
|
if ClaimToResultMap[claim] == 1:
|
||||||
ClearProgress (TupleCount, safetxt)
|
# Wooh! It was correct before
|
||||||
newattacks = newattacks + 1
|
ClearProgress (TupleCount, safetxt)
|
||||||
print "-" * 40
|
newattacks = newattacks + 1
|
||||||
print "New attack [[", newattacks, "]] at", processed, "/", TupleCount, ":", claim, " using",CommandLine( protocols)
|
print "-" * 40
|
||||||
for helper in GetListKeys (ProtocolToFileMap, protocols):
|
print "New attack [[", newattacks, "]] at", processed, "/", TupleCount, ":", claim, " using",CommandLine( protocols)
|
||||||
clprname = claim.split()[0]
|
for helper in GetListKeys (ProtocolToFileMap, protocols):
|
||||||
if helper <> clprname:
|
clprname = claim.split()[0]
|
||||||
if helper not in ProtocolToEffectsMap.keys():
|
if helper <> clprname:
|
||||||
# new
|
if helper not in ProtocolToEffectsMap.keys():
|
||||||
ProtocolToEffectsMap[helper] = [clprname]
|
# new
|
||||||
print "% Detected a new flaw helper:", helper
|
ProtocolToEffectsMap[helper] = [clprname]
|
||||||
else:
|
print "% Detected a new flaw helper:", helper
|
||||||
# already noted as helper, add destruction now
|
else:
|
||||||
if clprname not in ProtocolToEffectsMap[helper]:
|
# already noted as helper, add destruction now
|
||||||
ProtocolToEffectsMap[helper].append(clprname)
|
if clprname not in ProtocolToEffectsMap[helper]:
|
||||||
#
|
ProtocolToEffectsMap[helper].append(clprname)
|
||||||
# TODO
|
#
|
||||||
#
|
# TODO
|
||||||
# Generate output to recreate/draw the
|
#
|
||||||
# attack, and maybe add this to a big
|
# Generate output to recreate/draw the
|
||||||
# error log thingy. Furthermore,
|
# attack, and maybe add this to a big
|
||||||
# explicitly recreate the commandline
|
# error log thingy. Furthermore,
|
||||||
# and the claim that is newly violated
|
# explicitly recreate the commandline
|
||||||
DescribeContext (sys.stdout, protocols, claim)
|
# and the claim that is newly violated
|
||||||
|
DescribeContext (sys.stdout, protocols, claim)
|
||||||
|
|
||||||
# Next!
|
# Next!
|
||||||
processed = processed + 1
|
processed = processed + 1
|
||||||
@ -425,6 +447,8 @@ inp.close()
|
|||||||
|
|
||||||
ClearProgress (TupleCount, safetxt)
|
ClearProgress (TupleCount, safetxt)
|
||||||
print "Processed", processed,"tuple combinations in total."
|
print "Processed", processed,"tuple combinations in total."
|
||||||
|
if StartSkip > 0:
|
||||||
|
print "In this session, checked the last",(processed - StartSkip),"tuples. "
|
||||||
print "Found", newattacks, "new attacks."
|
print "Found", newattacks, "new attacks."
|
||||||
if newattacks > 0:
|
if newattacks > 0:
|
||||||
print " These were helped by:"
|
print " These were helped by:"
|
||||||
|
Loading…
Reference in New Issue
Block a user