- Fixes working towards attack indent output.
This commit is contained in:
parent
f3f6e56feb
commit
903f9bcbce
Binary file not shown.
Binary file not shown.
@ -125,6 +125,7 @@ class Scyther(object):
|
||||
self.errorcount = 0
|
||||
self.run = False
|
||||
self.output = None
|
||||
self.cmd = None
|
||||
|
||||
# defaults
|
||||
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
|
||||
fp.close()
|
||||
|
||||
def addArglist(self,arglist):
|
||||
for arg in arglist:
|
||||
self.options += " %s" % (arg)
|
||||
|
||||
def doScytherCommand(self, spdl, args):
|
||||
"""
|
||||
Run Scyther backend on the input
|
||||
@ -169,12 +174,13 @@ class Scyther(object):
|
||||
# Sanitize input somewhat
|
||||
if not spdl or spdl == "":
|
||||
# Scyther hickups on completely empty input
|
||||
spdl = " "
|
||||
spdl = None
|
||||
|
||||
# Generate temporary files for the output
|
||||
# Requires Python 2.3 though.
|
||||
(fde,fne) = tempfile.mkstemp() # errors
|
||||
(fdo,fno) = tempfile.mkstemp() # output
|
||||
if spdl:
|
||||
(fdi,fni) = tempfile.mkstemp() # input
|
||||
|
||||
# Write (input) file
|
||||
@ -187,10 +193,12 @@ class Scyther(object):
|
||||
self.cmd += "\"%s\"" % self.program
|
||||
self.cmd += " --append-errors=%s" % fne
|
||||
self.cmd += " --append-output=%s" % fno
|
||||
self.cmd += " %s %s" % (self.options, args)
|
||||
self.cmd += " %s" % args
|
||||
if spdl:
|
||||
self.cmd += " %s" % fni
|
||||
|
||||
print self.cmd
|
||||
|
||||
# Start the process
|
||||
os.system(self.cmd)
|
||||
|
||||
@ -205,6 +213,7 @@ class Scyther(object):
|
||||
fho.close()
|
||||
os.remove(fne)
|
||||
os.remove(fno)
|
||||
if spdl:
|
||||
os.remove(fni)
|
||||
|
||||
return (output,errors)
|
||||
|
@ -179,6 +179,22 @@ class XMLReader(object):
|
||||
action = self.readEvent(eventxml)
|
||||
action.run = run
|
||||
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
|
||||
|
||||
# Read protocol description for a certain role
|
||||
|
29
src/xmlout.c
29
src/xmlout.c
@ -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 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);
|
||||
}
|
||||
xmlAgentsOfRunPrint (sys, run);
|
||||
xmlRunVariables (sys, run);
|
||||
}
|
||||
|
||||
//! Display runs
|
||||
|
Loading…
Reference in New Issue
Block a user