- Fixes working towards attack indent output.

This commit is contained in:
ccremers 2007-01-02 15:22:25 +00:00
parent f3f6e56feb
commit 903f9bcbce
5 changed files with 62 additions and 8 deletions

Binary file not shown.

Binary file not shown.

View File

@ -125,6 +125,7 @@ class Scyther(object):
self.errorcount = 0 self.errorcount = 0
self.run = False self.run = False
self.output = None self.output = None
self.cmd = None
# defaults # defaults
self.xml = True # this results in a claim end, otherwise we simply get the output self.xml = True # this results in a claim end, otherwise we simply get the output
@ -150,6 +151,10 @@ class Scyther(object):
self.spdl += l self.spdl += l
fp.close() fp.close()
def addArglist(self,arglist):
for arg in arglist:
self.options += " %s" % (arg)
def doScytherCommand(self, spdl, args): def doScytherCommand(self, spdl, args):
""" """
Run Scyther backend on the input Run Scyther backend on the input
@ -169,12 +174,13 @@ class Scyther(object):
# Sanitize input somewhat # Sanitize input somewhat
if not spdl or spdl == "": if not spdl or spdl == "":
# Scyther hickups on completely empty input # Scyther hickups on completely empty input
spdl = " " spdl = None
# Generate temporary files for the output # Generate temporary files for the output
# Requires Python 2.3 though. # Requires Python 2.3 though.
(fde,fne) = tempfile.mkstemp() # errors (fde,fne) = tempfile.mkstemp() # errors
(fdo,fno) = tempfile.mkstemp() # output (fdo,fno) = tempfile.mkstemp() # output
if spdl:
(fdi,fni) = tempfile.mkstemp() # input (fdi,fni) = tempfile.mkstemp() # input
# Write (input) file # Write (input) file
@ -187,10 +193,12 @@ class Scyther(object):
self.cmd += "\"%s\"" % self.program self.cmd += "\"%s\"" % self.program
self.cmd += " --append-errors=%s" % fne self.cmd += " --append-errors=%s" % fne
self.cmd += " --append-output=%s" % fno self.cmd += " --append-output=%s" % fno
self.cmd += " %s %s" % (self.options, args) self.cmd += " %s" % args
if spdl: if spdl:
self.cmd += " %s" % fni self.cmd += " %s" % fni
print self.cmd
# Start the process # Start the process
os.system(self.cmd) os.system(self.cmd)
@ -205,6 +213,7 @@ class Scyther(object):
fho.close() fho.close()
os.remove(fne) os.remove(fne)
os.remove(fno) os.remove(fno)
if spdl:
os.remove(fni) os.remove(fni)
return (output,errors) return (output,errors)

View File

@ -179,6 +179,22 @@ class XMLReader(object):
action = self.readEvent(eventxml) action = self.readEvent(eventxml)
action.run = run action.run = run
run.eventList.append(action) run.eventList.append(action)
for variable in xml.find('variables'):
# Read the variables one by one
assert(variable.tag == 'variable')
var = self.readTerm(variable.find('name').find('term'))
var.types = self.readTypeList(variable.find('name'))
substxml = variable.find('substitution')
# Read substitution if present
if substxml != None:
subst = self.readTerm(substxml.find('term'))
subst.types = self.readTypeList(substxml)
newvar = Term.TermVariable(var.name,subst)
newvar.types = var.types
var = newvar
run.variables.append(var)
return run return run
# Read protocol description for a certain role # Read protocol description for a certain role

View File

@ -395,6 +395,34 @@ xmlVariable (const System sys, const Term variable, const int run)
} }
} }
//! Show variable instantiations
/**
* Show the instantiations of all variables. Maybe we need to restrict this,
* and scan only for those variables that actually occur in the semitrace.
*/
void
xmlRunVariables (const System sys, const int run)
{
int prev_mode; // buffer for show mode
Termlist varlist;
prev_mode = show_substitution_path;
show_substitution_path = true;
xmlPrint ("<variables>");
xmlindent++;
varlist = sys->runs[run].sigma;
while (varlist != NULL)
{
xmlVariable (sys, varlist->term, run);
varlist = varlist->next;
}
xmlindent--;
xmlPrint ("</variables>");
show_substitution_path = prev_mode;
}
//! Show variable instantiations //! Show variable instantiations
/** /**
* Show the instantiations of all variables. Maybe we need to restrict this, * Show the instantiations of all variables. Maybe we need to restrict this,
@ -813,6 +841,7 @@ xmlRunInfo (const System sys, const int run)
xmlOutTerm ("agent", r->nameterm); xmlOutTerm ("agent", r->nameterm);
} }
xmlAgentsOfRunPrint (sys, run); xmlAgentsOfRunPrint (sys, run);
xmlRunVariables (sys, run);
} }
//! Display runs //! Display runs