- 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.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,28 +174,31 @@ 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
|
||||||
(fdi,fni) = tempfile.mkstemp() # input
|
if spdl:
|
||||||
|
(fdi,fni) = tempfile.mkstemp() # input
|
||||||
|
|
||||||
# Write (input) file
|
# Write (input) file
|
||||||
fhi = os.fdopen(fdi,'w+b')
|
fhi = os.fdopen(fdi,'w+b')
|
||||||
fhi.write(spdl)
|
fhi.write(spdl)
|
||||||
fhi.close()
|
fhi.close()
|
||||||
|
|
||||||
# Generate command line for the Scyther process
|
# Generate command line for the Scyther process
|
||||||
self.cmd = ""
|
self.cmd = ""
|
||||||
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,7 +213,8 @@ class Scyther(object):
|
|||||||
fho.close()
|
fho.close()
|
||||||
os.remove(fne)
|
os.remove(fne)
|
||||||
os.remove(fno)
|
os.remove(fno)
|
||||||
os.remove(fni)
|
if spdl:
|
||||||
|
os.remove(fni)
|
||||||
|
|
||||||
return (output,errors)
|
return (output,errors)
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
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 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
|
||||||
|
Loading…
Reference in New Issue
Block a user