Merge branch 'python3-wxpython4'

This commit is contained in:
Cas Cremers 2022-05-23 11:06:30 +02:00
commit 2411493d45
134 changed files with 674 additions and 643 deletions

View File

@ -6,7 +6,7 @@ tool for security protocol analysis. Its intended audience are
interested users and future developers of the Scyther tool, as well as interested users and future developers of the Scyther tool, as well as
protocol modelers. For installation and usage instructions of the protocol modelers. For installation and usage instructions of the
Scyther tool see: Scyther tool see:
<http://www.cs.ox.ac.uk/people/cas.cremers/scyther/index.html>. <https://people.cispa.io/cas.cremers/scyther/>.
Installing from source Installing from source
---------------------- ----------------------
@ -16,7 +16,7 @@ Windows and MAC OS X should be equally feasible. Note that the below
instructions are written from a Linux/Ubuntu perspective, and probably instructions are written from a Linux/Ubuntu perspective, and probably
need modifications for other platforms. need modifications for other platforms.
Scyther is written partly in Python 2 (for the GUI, using wxPython) and Scyther is written partly in Python 3 (for the GUI, using wxPython) and
partly in C (for the backend). partly in C (for the backend).
In order to run the tool from a repository checkout, it is required to In order to run the tool from a repository checkout, it is required to

3
dist/build-arch-tag vendored
View File

@ -106,9 +106,8 @@ then
elif [ $ARCH = "mac" ] elif [ $ARCH = "mac" ]
then then
# Make for ppc and intel, and combine into universal binary # Make for intel
BIN="scyther-mac" BIN="scyther-mac"
cmake $CMFLAGS -D TARGETOS=MacPPC . && make
cmake $CMFLAGS -D TARGETOS=MacIntel . && make cmake $CMFLAGS -D TARGETOS=MacIntel . && make
cmake $CMFLAGS . && make scyther-mac cmake $CMFLAGS . && make scyther-mac
fi fi

View File

@ -1,6 +1,17 @@
Scyther changelog Scyther changelog
=============================== ===============================
Scyther 1.2
-------------------------------
This release mostly serves to modernize the dependencies and simplify install
on modern versions of the three supported platforms.
* Updated python code to use Python 3, dropping the Python 2 requirement.
* [Gui] Updated to support (and require) wxPython 4.0 or later.
* Updated install instructions.
* Updated copyright notices.
Scyther 1.1.2 Scyther 1.1.2
------------------------------- -------------------------------
@ -62,7 +73,7 @@ Major new features:
Additional protocol models: Additional protocol models:
See <http://www.cs.ox.ac.uk/people/cas.cremers/tools/protocols.html> for a See <https://people.cispa.io/cas.cremers/tools/protocols.html> for a
more high-level overview of selected protocol models. more high-level overview of selected protocol models.
* IEEE 802.16e/WIMAX: PKMv2rsa and variants * IEEE 802.16e/WIMAX: PKMv2rsa and variants

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -50,7 +50,7 @@ def setBaseDir(mybasedir):
class AboutScyther(wx.Dialog): class AboutScyther(wx.Dialog):
def __init__(self,parent,mybasedir=None): def __init__(self,parent,mybasedir=None):
from Version import SCYTHER_GUI_VERSION from .Version import SCYTHER_GUI_VERSION
global basedir global basedir
self.text = ''' self.text = '''
@ -65,13 +65,13 @@ class AboutScyther(wx.Dialog):
</p> </p>
<p> <p>
For news and updates visit the Scyther pages at For news and updates visit the Scyther pages at
<a target="_blank" href="http://www.cs.ox.ac.uk/people/cas.cremers/scyther/index.html"> <a target="_blank" href="https://people.cispa.io/cas.cremers/scyther/index.html">
http://www.cs.ox.ac.uk/people/cas.cremers/scyther/index.html</a> https://people.cispa.io/cas.cremers/scyther/index.html</a>
</p> </p>
<h5>License</h5> <h5>License</h5>
<p> <p>
Scyther : An automatic verifier for security protocols.<br> Scyther : An automatic verifier for security protocols.<br>
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
</p> </p>
<p> <p>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or

View File

@ -1,8 +1,8 @@
#!/usr/bin/python #!/usr/bin/python
from __future__ import division # 2.2+-only # 2.2+-only
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,14 +25,14 @@ from __future__ import division # 2.2+-only
""" Import externals """ """ Import externals """
import wx import wx
import os import os
from Misc import * from .Misc import *
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Import scyther-gui components """ """ Import scyther-gui components """
import Icon from . import Icon
import Preference from . import Preference
import Error from . import Error
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
try: try:
@ -54,7 +54,7 @@ class AttackDisplay(wx.ScrolledWindow):
wx.ScrolledWindow.__init__(self,parent,id=-1) wx.ScrolledWindow.__init__(self,parent,id=-1)
self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_SIZE, self.OnSize)
self.Image = wx.StaticBitmap(self, -1, wx.EmptyBitmap(1,1)) self.Image = wx.StaticBitmap(self, -1, wx.Bitmap(1,1))
self.box = wx.BoxSizer(wx.VERTICAL) self.box = wx.BoxSizer(wx.VERTICAL)
self.box.Add(self.Image,1,wx.ALIGN_CENTER) self.box.Add(self.Image,1,wx.ALIGN_CENTER)
self.hbox = wx.BoxSizer(wx.HORIZONTAL) self.hbox = wx.BoxSizer(wx.HORIZONTAL)
@ -74,7 +74,7 @@ class AttackDisplay(wx.ScrolledWindow):
Preference.doNotUsePIL() Preference.doNotUsePIL()
raise Error.PILError raise Error.PILError
else: else:
print "Unknown file type %s." % (self.filetype) print("Unknown file type %s." % (self.filetype))
# TODO self.Bind(wxSizeEvent # TODO self.Bind(wxSizeEvent
self.update(True) self.update(True)
@ -93,9 +93,7 @@ class AttackDisplay(wx.ScrolledWindow):
# This is needed, don't ask me why. # This is needed, don't ask me why.
self.SetScrollbars(0,0,0,0,0,0) self.SetScrollbars(0,0,0,0,0,0)
size = self.GetClientSize() (framewidth,frameheight) = self.GetClientSize()
framewidth = size.width
frameheight = size.height
(virtualwidth,virtualheight) = (framewidth,frameheight) (virtualwidth,virtualheight) = (framewidth,frameheight)
def makefit(width,height): def makefit(width,height):
@ -120,14 +118,14 @@ class AttackDisplay(wx.ScrolledWindow):
if self.attack.filetype == "png": if self.attack.filetype == "png":
bmp = self.original bmp = self.original
if not bmp.Ok(): if not bmp.IsOk():
bmp = wx.EmptyImage(1,1) bmp = wx.Image(1,1)
else: else:
(originalwidth,originalheight) = (bmp.GetWidth(), bmp.GetHeight()) (originalwidth,originalheight) = (bmp.GetWidth(), bmp.GetHeight())
if self.win.fit: if self.win.fit:
(factor, virtualwidth, virtualheight) = makefit(originalwidth,originalheight) (factor, virtualwidth, virtualheight) = makefit(originalwidth,originalheight)
bmp = self.original.Scale(virtualwidth,virtualheight) bmp = self.original.Scale(virtualwidth,virtualheight)
self.Image.SetBitmap(wx.BitmapFromImage(bmp)) self.Image.SetBitmap(wx.Bitmap(bmp))
elif self.attack.filetype == "ps": elif self.attack.filetype == "ps":
pil = self.original.copy() pil = self.original.copy()
@ -144,7 +142,7 @@ class AttackDisplay(wx.ScrolledWindow):
self.Image.SetBitmap(image.ConvertToBitmap()) self.Image.SetBitmap(image.ConvertToBitmap())
else: else:
print "Unknown file type %s." % (self.attack.filetype) print("Unknown file type %s." % (self.attack.filetype))
self.SetVirtualSize((virtualwidth,virtualheight)) self.SetVirtualSize((virtualwidth,virtualheight))
@ -200,16 +198,15 @@ class AttackDisplay(wx.ScrolledWindow):
(p,r,l) = self.win.claim.triplet() (p,r,l) = self.win.claim.triplet()
prefix = "pattern-%s_%s_%s-%s" % (p,r,l,self.attack.id) prefix = "pattern-%s_%s_%s-%s" % (p,r,l,self.attack.id)
suggested = "%s.%s" % (prefix,ext) suggested = "%s.%s" % (prefix,ext)
res = self.askUserForFilename(style=wx.SAVE, wildcard="*.%s" % (ext), defaultFile = "%s" % (suggested)) res = self.askUserForFilename(style=wx.FD_SAVE, wildcard="*.%s" % (ext), defaultFile = "%s" % (suggested))
return res return res
def exportImage(self, type,ext=None): def exportImage(self, imgtype, ext=None):
if ext == None: if ext == None:
ext = type ext = imgtype
res = self.saveFileName(ext) res = self.saveFileName(ext)
if res != None: if res != None:
cmd = "dot -T%s" % (type) dotOutputWrite(self.attack.scytherDot,res,["-T" + imgtype])
cmdpushwrite(cmd,self.attack.scytherDot,res)
def OnExportPng(self, event): def OnExportPng(self, event):
self.exportImage("png") self.exportImage("png")

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -176,7 +176,7 @@ class EditorStc(Editor):
line = line - 1 # Start at 0 in stc, but on screen count is 1 line = line - 1 # Start at 0 in stc, but on screen count is 1
pos = self.control.GetLineIndentPosition(line) pos = self.control.GetLineIndentPosition(line)
last = self.control.GetLineEndPosition(line) last = self.control.GetLineEndPosition(line)
self.control.StartStyling(pos,31) self.control.StartStyling(pos)
self.control.SetStyling(last-pos,self.errorstyle) self.control.SetStyling(last-pos,self.errorstyle)
def ClearErrors(self): def ClearErrors(self):

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -29,7 +29,7 @@ import sys
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Import scyther-gui components """ """ Import scyther-gui components """
import Misc from . import Misc
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -28,12 +28,12 @@ import os.path
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Import scyther-gui components """ """ Import scyther-gui components """
import Settingswindow from . import Settingswindow
import Scytherthread from . import Scytherthread
import Icon from . import Icon
import About from . import About
import Editor from . import Editor
import Preference from . import Preference
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -288,7 +288,7 @@ class MainWindow(wx.Frame):
def OnOpen(self, event): def OnOpen(self, event):
if self.ConfirmLoss("Open"): if self.ConfirmLoss("Open"):
if self.askUserForFilename(style=wx.OPEN, if self.askUserForFilename(style=wx.FD_OPEN,
**self.defaultFileDialogOptions()): **self.defaultFileDialogOptions()):
textfile = open(os.path.join(self.dirname, self.filename), 'r') textfile = open(os.path.join(self.dirname, self.filename), 'r')
self.editor.SetText(textfile.read()) self.editor.SetText(textfile.read())
@ -298,7 +298,7 @@ class MainWindow(wx.Frame):
return False return False
def OnSaveAs(self, event): def OnSaveAs(self, event):
if self.askUserForFilename(defaultFile=self.filename, style=wx.SAVE, if self.askUserForFilename(defaultFile=self.filename, style=wx.FD_SAVE,
**self.defaultFileDialogOptions()): **self.defaultFileDialogOptions()):
self.OnSave(event) self.OnSave(event)
os.chdir(self.dirname) os.chdir(self.dirname)

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -34,8 +34,8 @@ from Scyther import Misc as MiscScyther
from Scyther import FindDot from Scyther import FindDot
""" Import scyther-gui components """ """ Import scyther-gui components """
import Temporary from . import Temporary
import Preference from . import Preference
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
try: try:
@ -118,42 +118,32 @@ def makeImageDot(dotdata,attackthread=None):
if Preference.usePIL(): if Preference.usePIL():
# If we have the PIL library, we can do postscript! great # If we have the PIL library, we can do postscript! great
# stuff. # stuff.
type = "ps" imgtype = "ps"
ext = ".ps" ext = ".ps"
else: else:
# Ye olde pnge file # Ye olde pnge file
type = "png" imgtype = "png"
ext = ".png" ext = ".png"
# Retrieve dot command path # Write dot source file into temporary file to simplify dealing with graphviz invocation across platforms
dotcommand = FindDot.findDot() (fd_in,fpname_in) = Temporary.tempcleaned(ext)
f_in = os.fdopen(fd_in,'w')
# command to write to temporary file if attackthread:
(fd2,fpname2) = Temporary.tempcleaned(ext) writeGraph(attackthread,dotdata,f_in)
f = os.fdopen(fd2,'w') else:
f_in.write(dotdata)
f_in.close()
# Set up command # Set up command
cmd = "%s -T%s" % (dotcommand,type) dotcommand = FindDot.findDot()
cmd = [dotcommand, "-T" + imgtype, fpname_in]
# execute command # execute command
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE) (fd_out,fpname_out) = Temporary.tempcleaned(ext)
p = Popen(cmd, stdout=fd_out)
p.wait()
return (fpname_out, imgtype)
if attackthread:
writeGraph(attackthread,dotdata,p.stdin)
else:
p.stdin.write(dotdata)
p.stdin.close()
for l in p.stdout.read():
f.write(l)
p.stdout.close()
f.flush()
f.close()
return (fpname2, type)
def makeImage(attack,attackthread=None): def makeImage(attack,attackthread=None):
@ -161,10 +151,10 @@ def makeImage(attack,attackthread=None):
""" This should clearly be a method of 'attack' """ """ This should clearly be a method of 'attack' """
(name,type) = makeImageDot(attack.scytherDot,attackthread) (name,imgtype) = makeImageDot(attack.scytherDot,attackthread)
# if this is done, store and report # if this is done, store and report
attack.file = name attack.file = name
attack.filetype = type attack.filetype = imgtype
def testImage(): def testImage():

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,22 +25,29 @@
""" Import externals """ """ Import externals """
import os.path import os.path
from subprocess import Popen,PIPE from subprocess import Popen,PIPE,run
from shlex import quote
""" Import scyther components """
from Scyther import FindDot
""" Import scyther-gui components """
from . import Temporary
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def confirm(question): def confirm(question):
answer = '' answer = ''
while answer not in ('y','n'): while answer not in ('y','n'):
print question, print(question, end=' ')
answer = raw_input().lower() answer = input().lower()
return answer == 'y' return answer == 'y'
def exists(func,list): def exists(func,list):
return len(filter(func,list)) > 0 return len(list(filter(func,list))) > 0
def forall(func,list): def forall(func,list):
return len(filter(func,list)) == len(list) return len(list(filter(func,list))) == len(list)
def uniq(li): def uniq(li):
result = [] result = []
@ -67,24 +74,36 @@ def mypath(file):
basedir = os.path.split(cmd_file)[0] basedir = os.path.split(cmd_file)[0]
return os.path.join(basedir,file) return os.path.join(basedir,file)
# commands: push data in, get fp.write out # Write string to tempfile, return (filedescriptor,name)
def cmdpushwrite(cmd,data,fname): def stringToTempfile(data,ext="tmp"):
""" """
Feed stdin data to cmd, write the output to a freshly created file Take data (a string) and write it to a safe temporary file.
'fname'. The file is flushed and closed at the end. Return the resulting filedescriptor and name as a pair.
""" """
fp = open(fname,'w') (fd,fpname) = Temporary.tempcleaned(ext)
# execute command f = os.fdopen(fd,'w')
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE) f.write(data)
(cin,cout) = (p.stdin, p.stdout) f.close()
cin.write(data) return (fd, fpname)
cin.close()
for l in cout.read():
fp.write(l) # commands: push data in as file named argument to dot, get fp.write out
cout.close() def dotOutputWrite(data,fname,cmd=[]):
fp.flush() """
fp.close() Feed stdin data to cmd array, write the output to a freshly
created file 'fname'. The file is flushed and closed at the end.
TODO: In reality, this particular dot data was already written to another temp file when rendering the attack graph. We should be reusing that file instead of writing a new one.
"""
(fd_in,fpname_in) = stringToTempfile(data,ext="dot")
dotcommand = FindDot.findDot()
execcmd = [dotcommand] + cmd + ["-o" + quote(fname), quote(fpname_in)]
print (execcmd)
# execute command
run(execcmd)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# vim: set ts=4 sw=4 et list lcs=tab\:>-: # vim: set ts=4 sw=4 et list lcs=tab\:>-:

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -49,7 +49,7 @@ from time import localtime,strftime
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Import scyther-gui components """ """ Import scyther-gui components """
import Makeimage from . import Makeimage
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -127,7 +127,7 @@ class Preferences(dict):
""" """
Copy dict into self. Copy dict into self.
""" """
for x in d.keys(): for x in list(d.keys()):
self[x] = d[x] self[x] = d[x]
def parse(self,line): def parse(self,line):
@ -164,13 +164,13 @@ class Preferences(dict):
fp.close() fp.close()
def show(self): def show(self):
print "Preferences:" print("Preferences:")
for k in self.keys(): for k in list(self.keys()):
print "%s=%s" % (k, self[k]) print("%s=%s" % (k, self[k]))
def save(self): def save(self):
print "Saving preferences" print("Saving preferences")
prefpath = preflocs[-1] prefpath = preflocs[-1]
if not os.access(prefpath,os.W_OK): if not os.access(prefpath,os.W_OK):
os.makedirs(prefpath) os.makedirs(prefpath)
@ -215,7 +215,7 @@ def init():
def get(key,alt=None): def get(key,alt=None):
global prefs global prefs
if key in prefs.keys(): if key in list(prefs.keys()):
return prefs[key] return prefs[key]
else: else:
return alt return alt
@ -223,7 +223,7 @@ def get(key,alt=None):
def getkeys(): def getkeys():
global prefs global prefs
return prefs.keys() return list(prefs.keys())
def set(key,value): def set(key,value):
global prefs global prefs

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -33,11 +33,11 @@ import Scyther.Error
from Scyther.Misc import * from Scyther.Misc import *
""" Import scyther-gui components """ """ Import scyther-gui components """
import Preference from . import Preference
import Attackwindow from . import Attackwindow
import Icon from . import Icon
import Error from . import Error
import Makeimage from . import Makeimage
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
if Preference.havePIL: if Preference.havePIL:
@ -114,7 +114,7 @@ class ScytherThread(threading.Thread):
# verification start # verification start
try: try:
claims = scyther.verify(storePopen=self.storePopen) claims = scyther.verify(storePopen=self.storePopen)
except Scyther.Error.ScytherError, el: except Scyther.Error.ScytherError as el:
claims = None claims = None
pass pass
@ -185,7 +185,7 @@ class VerificationWindow(wx.Dialog):
sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5) sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL)
sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) sizer.Add(line, 0, wx.GROW|wx.RIGHT|wx.TOP, 5)
btnsizer = wx.StdDialogButtonSizer() btnsizer = wx.StdDialogButtonSizer()
@ -217,7 +217,7 @@ class ErrorWindow(wx.Dialog):
sizer.Add(label, 0, wx.ALIGN_LEFT|wx.ALL, 5) sizer.Add(label, 0, wx.ALIGN_LEFT|wx.ALL, 5)
line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL)
sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) sizer.Add(line, 0, wx.GROW|wx.RIGHT|wx.TOP, 5)
etxt = "" etxt = ""
prefix = "error: " prefix = "error: "
@ -230,7 +230,7 @@ class ErrorWindow(wx.Dialog):
sizer.Add(label, 0, wx.ALIGN_LEFT|wx.ALL, 5) sizer.Add(label, 0, wx.ALIGN_LEFT|wx.ALL, 5)
line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL)
sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) sizer.Add(line, 0, wx.GROW|wx.RIGHT|wx.TOP, 5)
btnsizer = wx.StdDialogButtonSizer() btnsizer = wx.StdDialogButtonSizer()
@ -464,13 +464,13 @@ class ScytherRun(object):
# which makes error reporting somewhat easier # which makes error reporting somewhat easier
try: try:
Scyther.Scyther.Check() Scyther.Scyther.Check()
except Scyther.Error.BinaryError, e: except Scyther.Error.BinaryError as e:
# e.file is the supposed location of the binary # e.file is the supposed location of the binary
text = "Could not find Scyther binary at\n%s" % (e.file) text = "Could not find Scyther binary at\n%s" % (e.file)
Error.ShowAndExit(text) Error.ShowAndExit(text)
# start the thread # start the thread
self.verifywin.SetCursor(wx.StockCursor(wx.CURSOR_WAIT)) self.verifywin.SetCursor(wx.Cursor(wx.CURSOR_WAIT))
self.verifywin.Bind(wx.EVT_CLOSE, self.closer) self.verifywin.Bind(wx.EVT_CLOSE, self.closer)
self.verifywin.Bind(wx.EVT_WINDOW_DESTROY, self.closer) self.verifywin.Bind(wx.EVT_WINDOW_DESTROY, self.closer)
self.verifywin.Bind(wx.EVT_BUTTON, self.closer, id=wx.ID_CANCEL) self.verifywin.Bind(wx.EVT_BUTTON, self.closer, id=wx.ID_CANCEL)
@ -520,12 +520,12 @@ class ScytherRun(object):
def allDone(): def allDone():
if resultwin: if resultwin:
resultwin.SetCursor(wx.StockCursor(wx.CURSOR_ARROW)) resultwin.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
resultwin.SetStatusText("Done.") resultwin.SetStatusText("Done.")
resultwin.Center() resultwin.Center()
resultwin.Show(True) resultwin.Show(True)
resultwin.SetCursor(wx.StockCursor(wx.CURSOR_ARROWWAIT)) resultwin.SetCursor(wx.Cursor(wx.CURSOR_ARROWWAIT))
wx.Yield() wx.Yield()

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -28,7 +28,7 @@ import sys
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Import scyther-gui components """ """ Import scyther-gui components """
import Preference from . import Preference
import Scyther.Claim as Claim import Scyther.Claim as Claim
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -24,8 +24,7 @@ from the command line) then you need only the first.
http://www.python.org/download/ http://www.python.org/download/
Scyther does not support Python 3. You are therefore recommended to Scyther requires **Python 3** now, and no longer supports Python 2.
choose the latest production release of Python 2, e.g., Python 2.7.
* **Mac OS X** * **Mac OS X**
@ -41,35 +40,20 @@ from the command line) then you need only the first.
3. ### wxPython libraries ### 3. ### wxPython libraries ###
The GUI user interface uses the wxPython libraries. The GUI user interface uses the wxPython libraries.
The recommended way of installing is through `pip` and described this page:
http://www.wxpython.org/download.php https://www.wxpython.org/download.php
There are many different wxPython packages. You should choose a 32-bit This version of Scyther requires at least **wxPython 4.0**. Note that older versions of Scyther did not work with wxPython 4.
package that matches your Python version (e.g., 2.7). It is
recommended to select the unicode version from the stable releases.
As of writing (May 2013) the following links lead to the appropriate For Ubuntu users, it is important to add an additional parameter, e.g., for Ubuntu 20.04, the recommended pip install is:
wxPython packages for Python 2.7:
* **Windows**
http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.12.1-py27.exe
* **Mac OS X**
http://downloads.sourceforge.net/wxpython/wxPython2.8-osx-unicode-2.8.12.1-universal-py2.7.dmg
Note that this package is in an old format and you will probably
get a warning "Package is damaged". This can be resolved by:
```
$ sudo installer -pkg /Volume/.../wxPython2.8-osx-unicode-universal-py2.7.pkg/ -target /
```
* **Ubuntu/Debian Linux**
http://wiki.wxpython.org/InstallingOnUbuntuOrDebian
```
$ sudo apt install python-pip
$ pip install -U \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 \
wxPython
```
Running Scyther Running Scyther
--------------- ---------------
@ -78,13 +62,13 @@ Extract the Scyther archive and navigate to the extracted directory.
Start Scyther by executing the file Start Scyther by executing the file
scyther-gui.py `scyther-gui.py`
in the main directory of the extracted archive. in the main directory of the extracted archive.
* **Mac OS X** * **Mac OS X**
Right-click the file 'scyther-gui.py' and select "Open with" and Right-click the file `scyther-gui.py` and select "Open with" and
then "Python Launcher". then "Python Launcher".

View File

@ -19,7 +19,7 @@ def scanThis(fn,f,rewritelist,cnt):
mapping.append((lhs,rhs)) mapping.append((lhs,rhs))
fp = open(fn,"r") fp = open(fn,"r")
for rl in fp.xreadlines(): for rl in fp:
l = rl l = rl
if f != None: if f != None:
l = f(l) l = f(l)
@ -34,7 +34,7 @@ def convertEm(f=None,path=".",rewritelist=[],newdir=".",oldext="",newext=None):
cnt = 1 cnt = 1
for fn in fl: for fn in fl:
ffn = os.path.join(path,fn) ffn = os.path.join(path,fn)
print "Processing",ffn print("Processing",ffn)
s = scanThis(ffn,f,rewritelist,cnt) s = scanThis(ffn,f,rewritelist,cnt)
if newext == None: if newext == None:
fn2 = fn fn2 = fn
@ -44,7 +44,7 @@ def convertEm(f=None,path=".",rewritelist=[],newdir=".",oldext="",newext=None):
fp = open(ffn2,"w") fp = open(ffn2,"w")
fp.write(s) fp.write(s)
fp.close() fp.close()
print "Produced",ffn2 print("Produced",ffn2)
cnt = cnt+1 cnt = cnt+1
def preprocess(s): def preprocess(s):
@ -55,7 +55,7 @@ def preprocess(s):
def main(): def main():
convertEm(f=preprocess,rewritelist=["@OracleA","@executability","@OracleB"],path=".",newdir="mpa",oldext=".spdl") convertEm(f=preprocess,rewritelist=["@OracleA","@executability","@OracleB"],path=".",newdir="mpa",oldext=".spdl")
print "Done." print("Done.")
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -34,8 +34,8 @@ def stripRowEnd(l):
# Assume ends with \\, split by dtl # Assume ends with \\, split by dtl
endstr = "\\\\" endstr = "\\\\"
if not l.endswith(endstr): if not l.endswith(endstr):
print "Error: some line does not end with \\\\" print("Error: some line does not end with \\\\")
print ">>%s<<" % (l) print(">>%s<<" % (l))
sys.exit(-1) sys.exit(-1)
return l[:-len(endstr)] return l[:-len(endstr)]
@ -63,7 +63,7 @@ def scanAttackFile(fn):
prot = None prot = None
role = None role = None
claim = None claim = None
for rawline in fp.xreadlines(): for rawline in fp:
l = rawline.strip() l = rawline.strip()
@ -94,7 +94,7 @@ def scanAttackFile(fn):
attl[i] = x[1:-1] attl[i] = x[1:-1]
ak = (prot,role,claim) ak = (prot,role,claim)
if ak not in attackmap.keys(): if ak not in list(attackmap.keys()):
attackmap[ak] = set() attackmap[ak] = set()
attackmap[ak].add(tuple(attl)) attackmap[ak].add(tuple(attl))
@ -136,7 +136,7 @@ def mpaTable(attackmap):
s += "\\begin{longtable}{|l|lll|l|}\n" s += "\\begin{longtable}{|l|lll|l|}\n"
s += "\\hline\n" s += "\\hline\n"
for kk in sorted(ALLCLAIMS): for kk in sorted(ALLCLAIMS):
if kk not in attackmap.keys(): if kk not in list(attackmap.keys()):
continue continue
(prot,role,claim) = kk (prot,role,claim) = kk
@ -174,7 +174,7 @@ def mpaTable2(attackmap,tabtype="tabular",options=""):
# To find the number of columns, we first need to find all protocols involved in two-protocol attacks # To find the number of columns, we first need to find all protocols involved in two-protocol attacks
involved = set() involved = set()
for kk in attackmap.keys(): for kk in list(attackmap.keys()):
for atl in attackmap[kk]: for atl in attackmap[kk]:
# convert tuple back to list # convert tuple back to list
att = list(atl) att = list(atl)
@ -210,7 +210,7 @@ def mpaTable2(attackmap,tabtype="tabular",options=""):
s += "\\hline\n" s += "\\hline\n"
last = None last = None
for kk in sorted(ALLCLAIMS): for kk in sorted(ALLCLAIMS):
if kk not in attackmap.keys(): if kk not in list(attackmap.keys()):
continue continue
(prot,role,claim) = kk (prot,role,claim) = kk
@ -256,7 +256,7 @@ def mpaTable3(attackmaps,tabtype="tabular",options=""):
involved = set() involved = set()
allkeys = set() allkeys = set()
for (attackmap,symbs) in attackmaps: for (attackmap,symbs) in attackmaps:
for kk in attackmap.keys(): for kk in list(attackmap.keys()):
allkeys.add(kk) allkeys.add(kk)
for atl in attackmap[kk]: for atl in attackmap[kk]:
# convert tuple back to list # convert tuple back to list
@ -298,7 +298,7 @@ def mpaTable3(attackmaps,tabtype="tabular",options=""):
s += "\\hline\n" s += "\\hline\n"
last = None last = None
for kk in sorted(ALLCLAIMS): for kk in sorted(ALLCLAIMS):
if kk not in attackmap.keys(): if kk not in list(attackmap.keys()):
continue continue
(prot,role,claim) = kk (prot,role,claim) = kk
@ -313,7 +313,7 @@ def mpaTable3(attackmaps,tabtype="tabular",options=""):
se = tuple([ch]) se = tuple([ch])
sl += "& " sl += "& "
for (attackmap,symb) in attackmaps: for (attackmap,symb) in attackmaps:
if kk in attackmap.keys(): if kk in list(attackmap.keys()):
if se in attackmap[kk]: if se in attackmap[kk]:
sl += symb sl += symb
break break
@ -341,7 +341,7 @@ def scanClaimList(fn):
fp = open("gen-%s-claims.txt" % (fn),"r") fp = open("gen-%s-claims.txt" % (fn),"r")
claimmap = {} claimmap = {}
for rawline in fp.xreadlines(): for rawline in fp:
l = rawline.strip() l = rawline.strip()
@ -380,7 +380,7 @@ def scanClaimFile(fn):
fp = open("gen-%s-correctclaims.tex" % (fn),"r") fp = open("gen-%s-correctclaims.tex" % (fn),"r")
claimmap = {} claimmap = {}
for rawline in fp.xreadlines(): for rawline in fp:
l = rawline.strip() l = rawline.strip()
@ -396,7 +396,7 @@ def scanClaimFile(fn):
if not FFUNC(prot): if not FFUNC(prot):
continue continue
if prot not in claimmap.keys(): if prot not in list(claimmap.keys()):
claimmap[prot] = {} claimmap[prot] = {}
cll = splitStrip(dtl[1],";") cll = splitStrip(dtl[1],";")
@ -404,7 +404,7 @@ def scanClaimFile(fn):
for dt in cll: for dt in cll:
(role,claim) = roleClaim(dt) (role,claim) = roleClaim(dt)
if role not in claimmap[prot].keys(): if role not in list(claimmap[prot].keys()):
claimmap[prot][role] = set() claimmap[prot][role] = set()
claimmap[prot][role].add(claim) claimmap[prot][role].add(claim)
@ -420,7 +420,7 @@ def scanClaimFile(fn):
def getRoleClaims(rcmap): def getRoleClaims(rcmap):
rc = set() rc = set()
for role in rcmap.keys(): for role in list(rcmap.keys()):
for claim in rcmap[role]: for claim in rcmap[role]:
rc.add((role,claim)) rc.add((role,claim))
@ -459,8 +459,8 @@ def typeScanMatrix(cml,onlyChanged = False):
alltrue = True alltrue = True
for (txt,cm) in cml: for (txt,cm) in cml:
verdict = badverdict verdict = badverdict
if prot in cm.keys(): if prot in list(cm.keys()):
if role in cm[prot].keys(): if role in list(cm[prot].keys()):
if claim in cm[prot][role]: if claim in cm[prot][role]:
verdict = goodverdict verdict = goodverdict
if verdict == badverdict: if verdict == badverdict:
@ -518,8 +518,8 @@ def typeScanMatrix2(cml,onlyChanged = False,additive = False):
res = "" res = ""
for (txt,cm) in cml: for (txt,cm) in cml:
verdict = badverdict verdict = badverdict
if prot in cm.keys(): if prot in list(cm.keys()):
if role in cm[prot].keys(): if role in list(cm[prot].keys()):
if claim in cm[prot][role]: if claim in cm[prot][role]:
verdict = goodverdict verdict = goodverdict
if verdict == badverdict: if verdict == badverdict:
@ -582,8 +582,8 @@ def typeScanMatrix3(hd1,hd2,cml,f,onlyChanged = False,tabletype="longtable"):
resl = [] resl = []
for cm in cml: for cm in cml:
verdict = badverdict verdict = badverdict
if prot in cm.keys(): if prot in list(cm.keys()):
if role in cm[prot].keys(): if role in list(cm[prot].keys()):
if claim in cm[prot][role]: if claim in cm[prot][role]:
verdict = goodverdict verdict = goodverdict
if verdict == badverdict: if verdict == badverdict:
@ -660,11 +660,11 @@ def docWrite(fn,tex,author=None,title=None):
def docMake(fn,tex,author=None,title=None): def docMake(fn,tex,author=None,title=None):
import commands import subprocess
docWrite(fn,tex,author,title) docWrite(fn,tex,author,title)
cmd = "pdflatex %s" % (fn) cmd = "pdflatex %s" % (fn)
commands.getoutput(cmd) subprocess.getoutput(cmd)
def f1(resl): def f1(resl):
txtl = [] txtl = []

View File

@ -32,7 +32,7 @@ def parseArgs():
parser.print_help() parser.print_help()
sys.exit(0) sys.exit(0)
if opts.protocol not in ["nsl","bke","nsl-priv-noprop","nsl-pub-nap","bke-nap"]: if opts.protocol not in ["nsl","bke","nsl-priv-noprop","nsl-pub-nap","bke-nap"]:
print "I don't know the %s protocol." % (opts.protocol) print("I don't know the %s protocol." % (opts.protocol))
sys.exit(0) sys.exit(0)
return (opts,args) return (opts,args)
@ -158,7 +158,7 @@ def message1 (label,inrole):
return msg return msg
else: else:
print "Hmm, I don't know how to create the first message for protocol %s" % (opts.protocol) print("Hmm, I don't know how to create the first message for protocol %s" % (opts.protocol))
def message2 (label,inrole): def message2 (label,inrole):
global P,variant,opts global P,variant,opts
@ -205,7 +205,7 @@ def message2 (label,inrole):
return msg return msg
else: else:
print "Hmm, I don't know how to create the final message for protocol %s" % (opts.protocol) print("Hmm, I don't know how to create the final message for protocol %s" % (opts.protocol))
def message (label,inrole): def message (label,inrole):
global P,opts global P,opts
@ -338,7 +338,7 @@ def main():
global opts global opts
(opts,args) = parseArgs() (opts,args) = parseArgs()
print protocol(args) print(protocol(args))
# Only if main stuff # Only if main stuff
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -7,11 +7,11 @@
# and sincerely hope on gives a complete proof. # and sincerely hope on gives a complete proof.
# we slowly refine the tests. # we slowly refine the tests.
# #
import commands import subprocess
def startset(): def startset():
mainlist = [11, 15] mainlist = [11, 15]
print "Starting with", mainlist print("Starting with", mainlist)
return mainlist return mainlist
def tuplingchoice(heur,variant,P,runs,latupling): def tuplingchoice(heur,variant,P,runs,latupling):
@ -37,15 +37,15 @@ def tuplingchoice(heur,variant,P,runs,latupling):
#s += " | scyther -a -r%i --summary" % runs #s += " | scyther -a -r%i --summary" % runs
# Show what we're doing # Show what we're doing
print s print(s)
#s += " | grep \"complete\"" #s += " | grep \"complete\""
out = commands.getoutput(s) out = subprocess.getoutput(s)
if out == "": if out == "":
#print "Okay" #print "Okay"
return False return False
else: else:
print out print(out)
return True return True
def testvariant(h,v,p,r): def testvariant(h,v,p,r):
@ -55,11 +55,11 @@ def testvariant(h,v,p,r):
return tuplingchoice (h,v,p,r, True) return tuplingchoice (h,v,p,r, True)
def scan(testlist, P, runs): def scan(testlist, P, runs):
print "Testing using P %i and %i runs." % (P,runs) print("Testing using P %i and %i runs." % (P,runs))
for i in testlist: for i in testlist:
print "Testing protocol %i." % (i) print("Testing protocol %i." % (i))
for h in range (0,32): for h in range (0,32):
print "Heuristic %i:" % (h) print("Heuristic %i:" % (h))
testvariant (h,i,P,runs) testvariant (h,i,P,runs)
def main(): def main():

View File

@ -6,13 +6,13 @@
# We test all variants [0..31] until we are sure they work. Thus, # We test all variants [0..31] until we are sure they work. Thus,
# we slowly refine the tests. # we slowly refine the tests.
# #
import commands import subprocess
def startset(): def startset():
return range(0,32) return list(range(0,32))
mainlist = [11, 15] mainlist = [11, 15]
print "Starting with", mainlist print("Starting with", mainlist)
return mainlist return mainlist
def tuplingchoice(variant,P,runs,latupling): def tuplingchoice(variant,P,runs,latupling):
@ -30,7 +30,7 @@ def tuplingchoice(variant,P,runs,latupling):
#s += " | scyther -a -r%i --summary" % runs #s += " | scyther -a -r%i --summary" % runs
#print s #print s
s += " | grep \"Fail\"" s += " | grep \"Fail\""
out = commands.getoutput(s) out = subprocess.getoutput(s)
if out == "": if out == "":
#print "Okay" #print "Okay"
return True return True
@ -53,15 +53,15 @@ def removeattacks (testlist, P, runs):
return okaylist return okaylist
def scan(testlist, P, runs): def scan(testlist, P, runs):
print "Testing using P %i and %i runs." % (P,runs) print("Testing using P %i and %i runs." % (P,runs))
results = removeattacks (testlist, P, runs) results = removeattacks (testlist, P, runs)
if len(results) < len(testlist): if len(results) < len(testlist):
attacked = [] attacked = []
for i in range(0,len(testlist)): for i in range(0,len(testlist)):
if testlist[i] not in results: if testlist[i] not in results:
attacked.append(testlist[i]) attacked.append(testlist[i])
print "Using P %i and %i runs, we find attacks on %s" % (P,runs, str(attacked)) print("Using P %i and %i runs, we find attacks on %s" % (P,runs, str(attacked)))
print "Therefore, we are left with %i candidates: " % (len(results)), results print("Therefore, we are left with %i candidates: " % (len(results)), results)
return results return results
@ -71,9 +71,9 @@ def main():
for rundiff in range(0,5): for rundiff in range(0,5):
candidates = scan(candidates,P,P+rundiff) candidates = scan(candidates,P,P+rundiff)
print print()
print "Good variants:" print("Good variants:")
print candidates print(candidates)
main() main()

View File

@ -3,7 +3,7 @@ The Scyther tool
Scyther is a tool for the symbolic analysis of security protocols. It is Scyther is a tool for the symbolic analysis of security protocols. It is
developed by Cas Cremers, and is available from developed by Cas Cremers, and is available from
<http://www.cs.ox.ac.uk/people/cas.cremers/scyther/index.html>. <https://people.cispa.io/cas.cremers/scyther/index.html>.
The below instructions apply only to the *distribution version* of The below instructions apply only to the *distribution version* of
the Scyther tool. If you are working from the source files, some paths may be the Scyther tool. If you are working from the source files, some paths may be
@ -45,11 +45,15 @@ availabe from
Manual Manual
------ ------
We are currently rewriting the manual. The current (incomplete) The manual is lagging behind. The current (incomplete)
distribution version of the manual can be found here: distribution version of the manual can be found here:
* [./scyther-manual.pdf](scyther-manual.pdf) * [./scyther-manual.pdf](scyther-manual.pdf)
However, have a look at the book if you are interested:
* [https://doi.org/10.1007/978-3-540-70545-1_38](Our book on security protocols and the theory behind Scyther)
Protocol Models Protocol Models
--------------- ---------------

View File

@ -2,7 +2,7 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -52,7 +52,7 @@ def evaluate(fn,prefix=""):
fstderr.seek(0) fstderr.seek(0)
res = "" res = ""
for l in fstdout.xreadlines(): for l in fstdout:
res += prefix + l.strip() + "\n" res += prefix + l.strip() + "\n"
#for l in fstderr.xreadlines(): #for l in fstderr.xreadlines():
# print l # print l
@ -72,7 +72,7 @@ def main():
cnt = 1 cnt = 1
tres = "" tres = ""
for (prefix,fn) in sorted(fl): for (prefix,fn) in sorted(fl):
print "Evaluating %s (%i/%i)" % (fn,cnt,len(fl)) print("Evaluating %s (%i/%i)" % (fn,cnt,len(fl)))
res = evaluate(prefix+fn, "%s\t" % (fn)) res = evaluate(prefix+fn, "%s\t" % (fn))
fp.write(res) fp.write(res)
tres += res tres += res
@ -83,7 +83,7 @@ def main():
fp.write(tres) fp.write(tres)
fp.close() fp.close()
print res print(res)

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -30,7 +30,7 @@
# Note 2: this code assumes that both scyther-linux and dot can be found in the # Note 2: this code assumes that both scyther-linux and dot can be found in the
# environment (i.e. PATH variable) # environment (i.e. PATH variable)
# #
import os,sys,commands import os,sys,subprocess
import os.path import os.path
tempcount = 0 tempcount = 0
@ -59,7 +59,7 @@ def scyther_to_dotfile():
tmpdotfile = generateTemp('dot') tmpdotfile = generateTemp('dot')
command = "%s --plain --dot-output %s > %s" % (scythername, args, tmpdotfile) command = "%s --plain --dot-output %s > %s" % (scythername, args, tmpdotfile)
output = commands.getoutput(command) output = subprocess.getoutput(command)
return (output,tmpdotfile) return (output,tmpdotfile)
def dotfile_to_pdffile(dotfile,outfile=None): def dotfile_to_pdffile(dotfile,outfile=None):
@ -72,10 +72,10 @@ def dotfile_to_pdffile(dotfile,outfile=None):
# it fit to a landscape page # it fit to a landscape page
dotdata = open(dotfile, "r") dotdata = open(dotfile, "r")
f = None f = None
for line in dotdata.xreadlines(): for line in dotdata:
if (line.find('digraph') == 0): if (line.find('digraph') == 0):
f = os.popen("dot -Gsize='11.0,8.0' -Gratio=fill -Tps >>%s" % (tmp),'w') f = os.popen("dot -Gsize='11.0,8.0' -Gratio=fill -Tps >>%s" % (tmp),'w')
print >>f, line print(line, file=f)
dotdata.close() dotdata.close()
if not f: if not f:
@ -96,18 +96,18 @@ def dotfile_to_pdffile(dotfile,outfile=None):
def main(): def main():
(output,dotfile) = scyther_to_dotfile() (output,dotfile) = scyther_to_dotfile()
print output print(output)
pdffile = dotfile_to_pdffile(dotfile) pdffile = dotfile_to_pdffile(dotfile)
os.unlink(dotfile) os.unlink(dotfile)
if pdffile: if pdffile:
commands.getoutput("kpdf %s" % pdffile) subprocess.getoutput("kpdf %s" % pdffile)
os.unlink(pdffile) os.unlink(pdffile)
else: else:
print "No graphs generated." print("No graphs generated.")
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) > 1: if len(sys.argv) > 1:
main() main()
else: else:
print "Please provide the name of an input file." print("Please provide the name of an input file.")

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -21,10 +21,10 @@
# Attack # Attack
# #
import Trace from . import Trace
import Term from . import Term
#import Classification #import Classification
from Misc import * from .Misc import *
class Attack(object): class Attack(object):
def __init__(self): def __init__(self):
@ -47,7 +47,7 @@ class Attack(object):
def getInvolvedAgents(self): def getInvolvedAgents(self):
result = [] result = []
for run in self.semiTrace.runs: for run in self.semiTrace.runs:
for agent in run.roleAgents.values(): for agent in list(run.roleAgents.values()):
result.append(agent) result.append(agent)
return uniq(result) return uniq(result)

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -21,7 +21,7 @@
# Claim # Claim
# #
import Term from . import Term
def stateDescription(okay,n=1,caps=False): def stateDescription(okay,n=1,caps=False):
if okay: if okay:

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -29,7 +29,7 @@ import sys
import os import os
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Import internals """ """ Import internals """
import Misc from . import Misc
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
DOTLOCATION = None DOTLOCATION = None
@ -41,8 +41,9 @@ def testDot(fpath):
try: try:
cmd = "%s -V" % (fpath) cmd = "%s -V" % (fpath)
(sts,sout,serr) = Misc.safeCommandOutput(cmd) (sts,sout,serr) = Misc.safeCommandOutput(cmd)
if sts != -1: if sts != -1:
if "version" in sout + serr: if "version" in str(sout) + str(serr):
return True return True
except: except:
pass pass

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -40,15 +40,15 @@ You need at least Python 2.4 to use this program.
def confirm(question): def confirm(question):
answer = '' answer = ''
while answer not in ('y','n'): while answer not in ('y','n'):
print question, print(question, end=' ')
answer = raw_input().lower() answer = input().lower()
return answer == 'y' return answer == 'y'
def exists(func,list): def exists(func,list):
return len(filter(func,list)) > 0 return len(list(filter(func,list))) > 0
def forall(func,list): def forall(func,list):
return len(filter(func,list)) == len(list) return len(list(filter(func,list))) == len(list)
def uniq(li): def uniq(li):
result = [] result = []
@ -93,21 +93,19 @@ def getShell():
""" """
Determine if we want a shell for Popen Determine if we want a shell for Popen
""" """
if sys.platform.startswith("win"): return False
shell=False
else:
# Needed to handle the string input correctly (as opposed to a sequence where the first element is the executable)
# This is not needed on Windows, where it has a different effect altogether.
# See http://docs.python.org/library/subprocess.html?highlight=subprocess#module-subprocess
shell=True
return shell
def safeCommandOutput(cmd, storePopen=None): def safeCommandOutput(cmd, storePopen=None):
""" Execute a command and return (sts,sout,serr). """ Execute a command and return (sts,sout,serr).
Meant for short outputs, as output is stored in memory and Meant for short outputs, as output is stored in memory and
not written to a file. not written to a file.
""" """
p = Popen(cmd, shell=getShell(), stdout=PIPE, stderr=PIPE)
if isinstance(cmd, str):
import shlex
cmd = shlex.split(cmd)
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
if storePopen != None: if storePopen != None:
storePopen(p) storePopen(p)
(sout,serr) = p.communicate() (sout,serr) = p.communicate()
@ -119,16 +117,20 @@ def safeCommand(cmd, storePopen=None):
version, I hope. """ version, I hope. """
try: try:
p = Popen(cmd, shell=getShell()) if isinstance(cmd, str):
import shlex
cmd = shlex.split(cmd)
p = Popen(cmd)
if storePopen != None: if storePopen != None:
storePopen(p) storePopen(p)
sts = p.wait() sts = p.wait()
except KeyboardInterrupt, EnvironmentError: except KeyboardInterrupt as EnvironmentError:
raise raise
except: except:
print "Wile processing [%s] we had an" % (cmd) print("Wile processing [%s] we had an" % (cmd))
print "unexpected error:", sys.exc_info()[0] print("unexpected error:", sys.exc_info()[0])
print print()
sts = -1 sts = -1
raise # For now still raise raise # For now still raise
@ -142,15 +144,15 @@ def panic(text):
""" """
try: try:
import Tkinter import tkinter
except: except:
print text print(text)
sys.exit(-1) sys.exit(-1)
print text print(text)
root = Tkinter.Tk() root = tkinter.Tk()
w = Tkinter.Label(root, justify=Tkinter.LEFT, padx = 10, text=text) w = tkinter.Label(root, justify=tkinter.LEFT, padx = 10, text=text)
w.pack() w.pack()
root.mainloop() root.mainloop()

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -28,7 +28,7 @@
import os import os
import os.path import os.path
import sys import sys
import StringIO import io
import tempfile import tempfile
try: try:
import hashlib import hashlib
@ -40,10 +40,10 @@ except ImportError:
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Import scyther components """ """ Import scyther components """
import XMLReader from . import XMLReader
import Error from . import Error
import Claim from . import Claim
from Misc import * from .Misc import *
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -77,7 +77,7 @@ def getCacheDir():
# Check if user chose the path # Check if user chose the path
cachedirkey = "SCYTHERCACHEDIR" cachedirkey = "SCYTHERCACHEDIR"
if cachedirkey in os.environ.keys(): if cachedirkey in list(os.environ.keys()):
tmpdir = os.environ[cachedirkey] tmpdir = os.environ[cachedirkey]
if tmpdir == "": if tmpdir == "":
# Special value: if the variable is present, but equals the empty string, we disable caching. # Special value: if the variable is present, but equals the empty string, we disable caching.
@ -126,7 +126,7 @@ def CheckSanity(program):
""" """
if not os.path.isfile(program): if not os.path.isfile(program):
raise Error.BinaryError, program raise Error.BinaryError(program)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -149,7 +149,7 @@ def EnsureString(x,sep=" "):
return sep.join(newlist) return sep.join(newlist)
else: else:
raise Error.StringListError, x raise Error.StringListError(x)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -177,7 +177,7 @@ def getScytherBackend():
else: else:
""" Unsupported""" """ Unsupported"""
raise Error.UnknownPlatformError, sys.platform raise Error.UnknownPlatformError(sys.platform)
program = os.path.join(getBinDir(),scythername) program = os.path.join(getBinDir(),scythername)
return program return program
@ -294,14 +294,18 @@ class Scyther(object):
# Apparently we are supporsed to be able to use the cache # Apparently we are supporsed to be able to use the cache
m = hashlib.sha256() m = hashlib.sha256()
def muppet(m, s):
m.update(s.encode('utf-8'))
if spdl == None: if spdl == None:
m.update("[spdl:None]") muppet(m, "[spdl:None]")
else: else:
m.update(spdl) muppet(m, spdl)
if args == None: if args == None:
m.update("[args:None]") muppet(m, "[args:None]")
else: else:
m.update(args) muppet(m, args)
uid = m.hexdigest() uid = m.hexdigest()
@ -392,14 +396,13 @@ class Scyther(object):
self.guessFileNames(spdl=spdl) self.guessFileNames(spdl=spdl)
# Generate temporary files for the output. # Generate temporary files for the output.
# 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: if spdl:
(fdi,fni) = tempfile.mkstemp() # input (fdi,fni) = tempfile.mkstemp() # input
# Write (input) file # Write (input) file
fhi = os.fdopen(fdi,'w+b') fhi = os.fdopen(fdi,'w+')
fhi.write(spdl) fhi.write(spdl)
fhi.close() fhi.close()
@ -495,7 +498,7 @@ class Scyther(object):
# whoohee, xml # whoohee, xml
self.validxml = True self.validxml = True
xmlfile = StringIO.StringIO(output) xmlfile = io.StringIO(output)
reader = XMLReader.XMLReader() reader = XMLReader.XMLReader()
self.claims = reader.readXML(xmlfile) self.claims = reader.readXML(xmlfile)
@ -595,10 +598,10 @@ def FindProtocols(path="",filterProtocol=None):
Note: Unix only! Will not work under windows. Note: Unix only! Will not work under windows.
""" """
import commands import subprocess
cmd = "find %s -iname '*.spdl'" % (path) cmd = "find %s -iname '*.spdl'" % (path)
plist = commands.getoutput(cmd).splitlines() plist = subprocess.getoutput(cmd).splitlines()
nlist = [] nlist = []
for prot in plist: for prot in plist:
if filterProtocol != None: if filterProtocol != None:

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -20,8 +20,8 @@
# #
# Term # Term
# #
import Trace from . import Trace
from Misc import * from .Misc import *
class InvalidTerm(TypeError): class InvalidTerm(TypeError):
"Exception used to indicate that a given term is invalid" "Exception used to indicate that a given term is invalid"

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -20,7 +20,7 @@
# #
# Trace # Trace
# #
from Misc import * from .Misc import *
class InvalidAction(TypeError): class InvalidAction(TypeError):
"Exception used to indicate that a given action is invalid" "Exception used to indicate that a given action is invalid"
@ -79,7 +79,7 @@ class SemiTrace(object):
def getPrecedingEvents(self,event,previous=[]): def getPrecedingEvents(self,event,previous=[]):
# If it is cached return cached version # If it is cached return cached version
if event.preceding != None: if event.preceding != None:
return filter(lambda x: x not in previous,event.preceding) return [x for x in event.preceding if x not in previous]
preceding = [] preceding = []
for prec in event.getBefore(): for prec in event.getBefore():
preceding.append(prec) preceding.append(prec)
@ -90,7 +90,7 @@ class SemiTrace(object):
preceding.extend(self.getPrecedingEvents(fol)) preceding.extend(self.getPrecedingEvents(fol))
preceding = uniq(preceding) preceding = uniq(preceding)
event.preceding = preceding event.preceding = preceding
preceding = filter(lambda x: x not in previous,preceding) preceding = [x for x in preceding if x not in previous]
return preceding return preceding
# Returns -1 if the first event has to be before the second one # Returns -1 if the first event has to be before the second one
@ -175,7 +175,7 @@ class ProtocolDescription(object):
# Find event by label # Find event by label
def findEvent(self,eventlabel,eventType=None): def findEvent(self,eventlabel,eventType=None):
for (role,descr) in self.roledescr.items(): for (role,descr) in list(self.roledescr.items()):
for event in descr: for event in descr:
if event.label == eventlabel: if event.label == eventlabel:
if eventType == None or isinstance(event,eventType): if eventType == None or isinstance(event,eventType):
@ -206,7 +206,7 @@ class ProtocolDescription(object):
# that are in the precedingEvents of a certain event # that are in the precedingEvents of a certain event
def getPrecedingLabelSet(self,eventlabel): def getPrecedingLabelSet(self,eventlabel):
events = self.getPrecedingEvents(eventlabel) events = self.getPrecedingEvents(eventlabel)
events = filter(lambda x: isinstance(x,EventRead),events) events = [x for x in events if isinstance(x,EventRead)]
return [x.label for x in events] return [x.label for x in events]
# Calculate the roles in preceding labelset that is all roles that # Calculate the roles in preceding labelset that is all roles that
@ -219,7 +219,7 @@ class ProtocolDescription(object):
def __str__(self): def __str__(self):
s = '' s = ''
for x in self.roledescr.values(): for x in list(self.roledescr.values()):
for e in x: for e in x:
s += str(e) + "\n" s += str(e) + "\n"
return s return s
@ -318,7 +318,7 @@ class EventClaim(Event):
# agents # agents
def ignore(self): def ignore(self):
for untrusted in self.run.attack.untrusted: for untrusted in self.run.attack.untrusted:
if untrusted in self.run.roleAgents.values(): if untrusted in list(self.run.roleAgents.values()):
return True return True
return False return False

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -20,24 +20,13 @@
# #
# XMLReader # XMLReader
# #
# Note:
# This requires python elementtree to work
# See: http://effbot.org/zone/element-index.htm
#
# On Fedora Core you can install this by installing the python-elementtree rpm
# Things will be a lot faster and consume less memory if you install the
# cElementTree module
#
# In python 2.5 cElementTree is in the core, so you don't need to install
# extra packages
#
import sys import sys
# Check for cElementTree presence. Otherwise use ElementTree. # Check for cElementTree presence. Otherwise use ElementTree.
useiter = True useiter = True
try: try:
# python 2.5 has cElementTree in the core # cElementTree is in Python since version 2.5
import xml.etree.cElementTree as cElementTree import xml.etree.cElementTree as cElementTree
except: except:
# try the old way # try the old way
@ -48,7 +37,7 @@ except:
try: try:
from elementtree import ElementTree from elementtree import ElementTree
except ImportError: except ImportError:
print """ print("""
ERROR: ERROR:
Could not locate either the [elementtree] or the [cElementTree] package. Could not locate either the [elementtree] or the [cElementTree] package.
@ -56,7 +45,7 @@ Please install one of them in order to work with the Scyther python interface.
The [cElementTree] packages can be found at http://effbot.org/zone/celementtree.htm The [cElementTree] packages can be found at http://effbot.org/zone/celementtree.htm
Note that you can still use the Scyther binaries in the 'Bin' directory. Note that you can still use the Scyther binaries in the 'Bin' directory.
""" """)
sys.exit(1) sys.exit(1)
## Simply pick cElementTree ## Simply pick cElementTree
@ -65,11 +54,17 @@ Note that you can still use the Scyther binaries in the 'Bin' directory.
#useiter = False #useiter = False
#from elementtree import ElementTree #from elementtree import ElementTree
import Term from . import Term
import Attack from . import Attack
import Trace from . import Trace
import Claim from . import Claim
def getchildren(xml):
"""
(c)elementree xml objects used to have a getchildren() method, but this has been deprecated. This function provides similar functionality. The only catch is that the list/iter replacements also contain the object itself, so we need to filter this.
"""
return [ x for x in list(xml) if x != xml ]
class XMLReader(object): class XMLReader(object):
def __init__ (self): def __init__ (self):
@ -123,8 +118,8 @@ class XMLReader(object):
# If this is a term variable read it directly # If this is a term variable read it directly
if (xml.tag in ('tuple','const','apply','encrypt','var')): if (xml.tag in ('tuple','const','apply','encrypt','var')):
return self.readSubTerm(xml) return self.readSubTerm(xml)
# Otherwise read from it's first child # Otherwise read from its first child
children = xml.getchildren() children = getchildren(xml)
assert(len(children) == 1) assert(len(children) == 1)
return self.readSubTerm(children[0]) return self.readSubTerm(children[0])
@ -148,7 +143,7 @@ class XMLReader(object):
# value # value
return Term.TermVariable(name,None) return Term.TermVariable(name,None)
else: else:
raise Term.InvalidTerm, "Invalid term type in XML: %s" % tag.tag raise Term.InvalidTerm("Invalid term type in XML: %s" % tag.tag)
def readEvent(self,xml): def readEvent(self,xml):
label = self.readTerm(xml.find('label')) label = self.readTerm(xml.find('label'))
@ -188,7 +183,7 @@ class XMLReader(object):
pass pass
return Trace.EventClaim(index,label,followlist,role,etype,argument) return Trace.EventClaim(index,label,followlist,role,etype,argument)
else: else:
raise Trace.InvalidAction, "Invalid action in XML: %s" % (xml.get('type')) raise Trace.InvalidAction("Invalid action in XML: %s" % (xml.get('type')))
def readRun(self,xml): def readRun(self,xml):
assert(xml.tag == 'run') assert(xml.tag == 'run')
@ -249,7 +244,7 @@ class XMLReader(object):
def readClaim(self, xml): def readClaim(self, xml):
claim = Claim.Claim() claim = Claim.Claim()
for event in xml.getchildren(): for event in getchildren(xml):
if event.tag == 'claimtype': if event.tag == 'claimtype':
claim.claimtype = self.readTerm(event) claim.claimtype = self.readTerm(event)
elif event.tag == 'label': elif event.tag == 'label':
@ -276,7 +271,7 @@ class XMLReader(object):
elif event.tag == 'timebound': elif event.tag == 'timebound':
claim.timebound = True claim.timebound = True
else: else:
print >>sys.stderr,"Warning unknown tag in claim: %s" % claim.tag print("Warning unknown tag in claim: %s" % claim.tag, file=sys.stderr)
claim.analyze() claim.analyze()
return claim return claim
@ -288,7 +283,7 @@ class XMLReader(object):
# A state contains 4 direct child nodes: # A state contains 4 direct child nodes:
# broken, system, variables and semitrace # broken, system, variables and semitrace
# optionally a fifth: dot # optionally a fifth: dot
for event in xml.getchildren(): for event in getchildren(xml):
if event.tag == 'broken': if event.tag == 'broken':
attack.broken.append((self.readTerm(event.find('claim')), attack.broken.append((self.readTerm(event.find('claim')),
self.readTerm(event.find('label')))) self.readTerm(event.find('label'))))
@ -353,6 +348,6 @@ class XMLReader(object):
# this list # this list
self.varlist = attack.variables self.varlist = attack.variables
else: else:
print >>sys.stderr,"Warning unknown tag in attack: %s" % event.tag print("Warning unknown tag in attack: %s" % event.tag, file=sys.stderr)
return attack return attack

View File

@ -1,6 +1,6 @@
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -22,7 +22,7 @@
# #
# Set prefix for __all__ # Set prefix for __all__
# #
import Scyther from . import Scyther
# Provide scope # Provide scope
__all__ = ["Scyther"] __all__ = ["Scyther"]

View File

@ -34,17 +34,17 @@ import sys
try: try:
from constraint import * from constraint import *
except: except:
print "Could not import constraint solver module." print("Could not import constraint solver module.")
print "For more information, visit" print("For more information, visit")
print " http://labix.org/python-constraint" print(" http://labix.org/python-constraint")
sys.exit() sys.exit()
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
def test(): def test():
problem = Problem() problem = Problem()
problem.addVariables(range(0, 16), range(1, 16+1)) problem.addVariables(list(range(0, 16)), list(range(1, 16+1)))
problem.addConstraint(AllDifferentConstraint(), range(0, 16)) problem.addConstraint(AllDifferentConstraint(), list(range(0, 16)))
problem.addConstraint(ExactSumConstraint(34), [0,5,10,15]) problem.addConstraint(ExactSumConstraint(34), [0,5,10,15])
problem.addConstraint(ExactSumConstraint(34), [3,6,9,12]) problem.addConstraint(ExactSumConstraint(34), [3,6,9,12])
for row in range(4): for row in range(4):
@ -54,7 +54,7 @@ def test():
problem.addConstraint(ExactSumConstraint(34), problem.addConstraint(ExactSumConstraint(34),
[col+4*i for i in range(4)]) [col+4*i for i in range(4)])
solutions = problem.getSolutions() solutions = problem.getSolutions()
print solutions print(solutions)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -109,7 +109,7 @@ def render_best_attack(fn,cid):
render_dot(dotfile,"png") render_dot(dotfile,"png")
render_dot(dotfile,"pdf") render_dot(dotfile,"pdf")
print "%s; %s" % (fn,cl) print("%s; %s" % (fn,cl))
def main(): def main():

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -48,9 +48,9 @@ def fileandline(fn,linenos):
ln = 1 ln = 1
done = 0 done = 0
sz = len(linenos) sz = len(linenos)
for l in fp.xreadlines(): for l in fp:
if str(ln) in linenos: if str(ln) in linenos:
print l print(l)
scyther_json(l) scyther_json(l)
done = done + 1 done = done + 1
if done >= sz: if done >= sz:

View File

@ -18,7 +18,7 @@ Arguments:
def countlines(fn): def countlines(fn):
count = 0 count = 0
fh = open(fn,'r') fh = open(fn,'r')
for l in fh.xreadlines(): for l in fh:
count = count + 1 count = count + 1
fh.close() fh.close()
return count return count
@ -26,7 +26,7 @@ def countlines(fn):
def marker(jobcount,todo): def marker(jobcount,todo):
left = todo - jobcount left = todo - jobcount
dperc = int((100 * jobcount) / todo) dperc = int((100 * jobcount) / todo)
print "echo \"Sent %i out of %i jobs, hence %i left. %i%% done.\"" % (jobcount,todo,left,dperc) print("echo \"Sent %i out of %i jobs, hence %i left. %i%% done.\"" % (jobcount,todo,left,dperc))
def main(fn,step,optlist): def main(fn,step,optlist):
@ -39,7 +39,7 @@ def main(fn,step,optlist):
jobcount = 0 jobcount = 0
done = 0 done = 0
for l in fh.xreadlines(): for l in fh:
if buf == 0: if buf == 0:
s = "bsub %s ./json-scyther.py %s" % (" ".join(optlist),fn) s = "bsub %s ./json-scyther.py %s" % (" ".join(optlist),fn)
s += " %i" % (ln) s += " %i" % (ln)

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -36,13 +36,13 @@ class ProgressBar(object):
def start(self): def start(self):
if self.widgets: if self.widgets:
if len(self.widgets) > 0: if len(self.widgets) > 0:
print self.widgets[0], print(self.widgets[0], end=' ')
def update(self,count): def update(self,count):
pass pass
def finish(self): def finish(self):
print " Done." print(" Done.")
def SimpleProgress(): def SimpleProgress():

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -23,7 +23,7 @@
# Try to get wxPython # Try to get wxPython
try: try:
import wx import wx
except ImportError,err: except ImportError as err:
from Scyther import Misc from Scyther import Misc
errmsg = "Problem with importing the required [wxPython] package." errmsg = "Problem with importing the required [wxPython] package."
@ -35,7 +35,7 @@ interface of Scyther.
The [wxPython] packages can be found at http://www.wxpython.org/ The [wxPython] packages can be found at http://www.wxpython.org/
Ubuntu users: the wxPython packages are called 'python-wxgtk' followed by the Ubuntu users: the wxPython packages are called 'python-wxgtk' followed by the
version number.""" version number. This version of Scyther requires at least wxPython version 4.0."""
elif ('32-bit mode' in str(err)) or ('no matching architecture' in str(err)): elif ('32-bit mode' in str(err)) or ('no matching architecture' in str(err)):
import os import os
@ -92,8 +92,26 @@ The exact error was:
""" % (errmsg,err)) """ % (errmsg,err))
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
global WXPYTHON4
global WXPYTHONINFREQ
WXPYTHON4 = False
WXPYTHONINFREQ = wx
try:
import wx.adv
WXPYTHON4 = True
WXPYTHONINFREQ = wx.adv
except ImportError:
Misc.panic("""
ERROR:
Found wxPython libraries, but they seem to be too old (pre-4.0 wxPython). This means you cannot use the graphical user interface. To fix this, please ensure that you have at least wxPython 4.0 installed such that it is loaded by the wx import of python3.
Note that you can currently still use the Scyther binaries in the 'Scyther' directory.
""")
""" import externals """ """ import externals """
import sys import sys
import os import os
@ -139,7 +157,7 @@ def parseArgs():
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
class MySplashScreen(wx.SplashScreen): class MySplashScreen(WXPYTHONINFREQ.SplashScreen):
def __init__(self,basedir): def __init__(self,basedir):
path = os.path.join(basedir,"Images") path = os.path.join(basedir,"Images")
image = os.path.join(path,"scyther-splash.png") image = os.path.join(path,"scyther-splash.png")
@ -193,7 +211,7 @@ class ScytherApp(wx.App):
# License option may abort here # License option may abort here
if opts.license: if opts.license:
print Scyther.GetLicense() print(Scyther.GetLicense())
sys.exit(0) sys.exit(0)
# Load preferences file # Load preferences file
@ -221,8 +239,9 @@ class ScytherApp(wx.App):
return True return True
def OnExit(self): #def OnExit(self):
""" Tear down """ # """ Tear down """
# # Currently unused, but ought to return the same integer as the base class if overridden.
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -50,8 +50,8 @@ def simpleRun(args):
if __name__ == '__main__': if __name__ == '__main__':
pars = sys.argv[1:] pars = sys.argv[1:]
if len(pars) == 0: if len(pars) == 0:
print usage() print(usage())
else: else:
print simpleRun(" ".join(pars)) print(simpleRun(" ".join(pars)))

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -48,7 +48,7 @@ TEST2 = "--max-runs=4"
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
""" Import externals """ """ Import externals """
import commands import subprocess
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -128,7 +128,7 @@ def findProtocols():
""" """
cmd = "find -iname '*.spdl'" cmd = "find -iname '*.spdl'"
plist = commands.getoutput(cmd).splitlines() plist = subprocess.getoutput(cmd).splitlines()
nlist = [] nlist = []
for prot in plist: for prot in plist:
if filterProtocol(prot): if filterProtocol(prot):
@ -143,35 +143,35 @@ def main():
global TEST0,TEST1,TEST2 global TEST0,TEST1,TEST2
list = findProtocols() list = findProtocols()
print "Performing delta analysis" print("Performing delta analysis")
print print()
print "String 0 (used for both): '%s'" % TEST0 print("String 0 (used for both): '%s'" % TEST0)
print "String 1: '%s'" % TEST1 print("String 1: '%s'" % TEST1)
print "String 2: '%s'" % TEST2 print("String 2: '%s'" % TEST2)
print print()
print "After filtering, we are left with the following protocols:", list print("After filtering, we are left with the following protocols:", list)
print print()
maxcount = len(list) maxcount = len(list)
count = 1 count = 1
delta = 0 delta = 0
for prot in list: for prot in list:
perc = (100 * count) / maxcount perc = (100 * count) / maxcount
print "[%i%%] %s: " % (perc,prot), print("[%i%%] %s: " % (perc,prot), end=' ')
res = ScytherDiff(prot) res = ScytherDiff(prot)
if res != None: if res != None:
print print()
print "-" * 72 print("-" * 72)
print prot print(prot)
print "-" * 72 print("-" * 72)
print res print(res)
delta = delta + 1 delta = delta + 1
else: else:
print "No interesting delta found." print("No interesting delta found.")
count = count + 1 count = count + 1
print print()
print "Analysis complete." print("Analysis complete.")
print "%i out of %i protocols differed [%i%%]." % (delta,maxcount,(100 * delta)/maxcount) print("%i out of %i protocols differed [%i%%]." % (delta,maxcount,(100 * delta)/maxcount))
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -44,14 +44,14 @@ try:
except ImportError: except ImportError:
from progressbarDummy import * from progressbarDummy import *
PROGRESSBAR = False PROGRESSBAR = False
print """ print("""
Missing the progressbar library. Missing the progressbar library.
It can be downloaded from: It can be downloaded from:
http://code.google.com/p/python-progressbar/ http://code.google.com/p/python-progressbar/
""" """)
FOUND = [] FOUND = []
ALLMPA = [] ALLMPA = []
@ -227,7 +227,7 @@ def MyScyther(protocollist,filt=None,options=[],checkpickle=True):
# arguments to call # arguments to call
s.options = (" ".join(sorted(uniq(opts)))).strip() s.options = (" ".join(sorted(uniq(opts)))).strip()
if OPTS.debug: if OPTS.debug:
print s.options print(s.options)
for protocol in sorted(protocollist): for protocol in sorted(protocollist):
s.addFile(protocol) s.addFile(protocol)
@ -356,7 +356,7 @@ def verifyMPAlist(mpalist,claimid,options=[]):
global OPTS, ARGS global OPTS, ARGS
if OPTS.debug: if OPTS.debug:
print time.asctime(), mpalist, claimid, options print(time.asctime(), mpalist, claimid, options)
if not verifyMPAattack(mpalist,claimid,options): if not verifyMPAattack(mpalist,claimid,options):
global FOUND global FOUND
@ -367,7 +367,7 @@ def verifyMPAlist(mpalist,claimid,options=[]):
# This is an MPA attack! # This is an MPA attack!
if OPTS.debug: if OPTS.debug:
print "I've found a multi-protocol attack on claim %s in the context %s." % (claimid,str(mpalist)) print("I've found a multi-protocol attack on claim %s in the context %s." % (claimid,str(mpalist)))
att = Attack(claim,mpalist) att = Attack(claim,mpalist)
FOUND.append(att) FOUND.append(att)
@ -442,9 +442,9 @@ def foundToDicts(attacklist = []):
pn = str(att.protocol()) pn = str(att.protocol())
cl = att.claimid() cl = att.claimid()
if pn not in res.keys(): if pn not in list(res.keys()):
res[pn] = {} res[pn] = {}
if cl not in res[pn].keys(): if cl not in list(res[pn].keys()):
res[pn][cl] = set() res[pn][cl] = set()
res[pn][cl].add(att) res[pn][cl].add(att)
return res return res
@ -464,13 +464,13 @@ def findAllMPA(protocolset,options=[],mpaoptions=[]):
# Find all correct claims in each protocol # Find all correct claims in each protocol
(protocolset,correct,cpcount) = getCorrectIsolatedClaims(protocolset,options) (protocolset,correct,cpcount) = getCorrectIsolatedClaims(protocolset,options)
print "Investigating %i correct claims in %i protocols." % (len(correct), cpcount) print("Investigating %i correct claims in %i protocols." % (len(correct), cpcount))
mpaprots = [] mpaprots = []
res = [] res = []
if len(correct) == 0: if len(correct) == 0:
print "Nothing to do." print("Nothing to do.")
return res return res
if OPTS.verbose: if OPTS.verbose:
@ -479,27 +479,27 @@ def findAllMPA(protocolset,options=[],mpaoptions=[]):
""" """
pmapclaims = {} pmapclaims = {}
for (protocol,claimid) in correct: for (protocol,claimid) in correct:
if protocol not in pmapclaims.keys(): if protocol not in list(pmapclaims.keys()):
pmapclaims[protocol] = set() pmapclaims[protocol] = set()
pmapclaims[protocol].add(claimid) pmapclaims[protocol].add(claimid)
print "Protocols with correct claims:" print("Protocols with correct claims:")
if len(pmapclaims.keys()) == 0: if len(list(pmapclaims.keys())) == 0:
print " None." print(" None.")
else: else:
for pk in pmapclaims.keys(): for pk in list(pmapclaims.keys()):
print " %s, %s" % (pk, pmapclaims[pk]) print(" %s, %s" % (pk, pmapclaims[pk]))
print print()
left = set() left = set()
for p in protocolset: for p in protocolset:
if p not in pmapclaims.keys(): if p not in list(pmapclaims.keys()):
left.add(p) left.add(p)
print "Protocols with no correct claims:" print("Protocols with no correct claims:")
if len(left) == 0: if len(left) == 0:
print " None." print(" None.")
else: else:
for p in left: for p in left:
print " %s" % (p) print(" %s" % (p))
print print()
# output of all claims (only if latex required) # output of all claims (only if latex required)
@ -528,7 +528,7 @@ def findAllMPA(protocolset,options=[],mpaoptions=[]):
if OPTS.latex: if OPTS.latex:
pmapclaims = {} pmapclaims = {}
for (protocol,claimid) in correct: for (protocol,claimid) in correct:
if protocol not in pmapclaims.keys(): if protocol not in list(pmapclaims.keys()):
pmapclaims[protocol] = set() pmapclaims[protocol] = set()
pmapclaims[protocol].add(claimid) pmapclaims[protocol].add(claimid)
@ -640,19 +640,19 @@ def findAllMPA(protocolset,options=[],mpaoptions=[]):
fp.write("\\end{tabular}\n") fp.write("\\end{tabular}\n")
fp.close() fp.close()
print "-" * 70 print("-" * 70)
print "Summary:" print("Summary:")
print print()
print "We scanned %i protocols with options [%s]." % (len(protocolset),options) print("We scanned %i protocols with options [%s]." % (len(protocolset),options))
print "We found %i correct claims." % (len(correct)) print("We found %i correct claims." % (len(correct)))
print "We then scanned combinations of at most %i protocols with options [%s]." % (OPTS.maxprotocols,alloptions) print("We then scanned combinations of at most %i protocols with options [%s]." % (OPTS.maxprotocols,alloptions))
if OPTS.pickle: if OPTS.pickle:
print "However, just precomputing now, hence we are not drawing any conclusions." print("However, just precomputing now, hence we are not drawing any conclusions.")
else: else:
print "We found %i MPA attacks." % (len(FOUND)) print("We found %i MPA attacks." % (len(FOUND)))
print "The attacks involve the claims of %i protocols." % (len(mpaprots)) print("The attacks involve the claims of %i protocols." % (len(mpaprots)))
print "-" * 70 print("-" * 70)
print print()
return res return res
@ -674,37 +674,37 @@ def showDiff(reslist):
Show difference between (opts,mpaopts,attacklist) tuples in list Show difference between (opts,mpaopts,attacklist) tuples in list
""" """
if len(reslist) == 0: if len(reslist) == 0:
print "Comparison list is empty" print("Comparison list is empty")
return return
(opt1,mpaopt1,al1) = reslist[0] (opt1,mpaopt1,al1) = reslist[0]
print "-" * 70 print("-" * 70)
print "Base case: attacks for \n [%s]:" % (opt1 + mpaopt1) print("Base case: attacks for \n [%s]:" % (opt1 + mpaopt1))
print print()
print len(al1) print(len(al1))
for a in al1: for a in al1:
print "Base attack: %s" % (a) print("Base attack: %s" % (a))
print "-" * 70 print("-" * 70)
print print()
for i in range(0,len(reslist)-1): for i in range(0,len(reslist)-1):
(opt1,mpaopt1,al1) = reslist[i] (opt1,mpaopt1,al1) = reslist[i]
(opt2,mpaopt2,al2) = reslist[i+1] (opt2,mpaopt2,al2) = reslist[i+1]
print "-" * 70 print("-" * 70)
print "Comparing the attacks for \n [%s] with\n [%s]:" % (opt1 + mpaopt1, opt2 + mpaopt2) print("Comparing the attacks for \n [%s] with\n [%s]:" % (opt1 + mpaopt1, opt2 + mpaopt2))
print print()
print len(al1), len(al2) print(len(al1), len(al2))
for a in al2: for a in al2:
if a not in al1: if a not in al1:
print "Added attack: %s" % (a) print("Added attack: %s" % (a))
for a in al1: for a in al1:
if a not in al2: if a not in al2:
print "Removed attack: %s" % (a) print("Removed attack: %s" % (a))
print "-" * 70 print("-" * 70)
print print()
@ -758,7 +758,7 @@ def exploreTree( i, choices , l, options = [], mpaoptions = []):
res = [] res = []
for (txt,arg) in cl: for (txt,arg) in cl:
print "For choice %i, selecting options %s" % (i,txt) print("For choice %i, selecting options %s" % (i,txt))
if mpaonly: if mpaonly:
o1 = [] o1 = []
o2 = arg o2 = arg
@ -811,23 +811,23 @@ def fullScan(l, options = [], mpaoptions = []):
invprots.add(str(prot)) invprots.add(str(prot))
if not OPTS.pickle: 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("The bottom line: we found %i protocols with multi-protocol attacks from a set of %i protocols." % (len(attprots),len(allprots)))
print print()
print "Multi-protocol attacks were found on:" print("Multi-protocol attacks were found on:")
for prot in sorted(list(allprots & attprots)): for prot in sorted(list(allprots & attprots)):
print " %s" % (prot) print(" %s" % (prot))
print print()
print "No multi-protocol attacks were found on these protocols, but they caused MPA attacks:" print("No multi-protocol attacks were found on these protocols, but they caused MPA attacks:")
for prot in sorted(list((allprots - attprots) & invprots)): for prot in sorted(list((allprots - attprots) & invprots)):
print " %s" % (prot) print(" %s" % (prot))
print print()
print "These protocols were not involved in any MPA attacks:" print("These protocols were not involved in any MPA attacks:")
for prot in sorted(list((allprots - attprots) - invprots)): for prot in sorted(list((allprots - attprots) - invprots)):
print " %s\t[%s]" % (prot,PROTNAMETOFILE[prot]) print(" %s\t[%s]" % (prot,PROTNAMETOFILE[prot]))
print print()
@ -864,7 +864,7 @@ def bigTest():
nl = l nl = l
# Report list # Report list
print "Performing multi-protocol analysis for the following protocols:", nl print("Performing multi-protocol analysis for the following protocols:", nl)
fullScan(l) fullScan(l)

View File

@ -318,8 +318,8 @@ class MessageRule(Rule):
self.after = fact self.after = fact
if self.before == None or self.after == None: if self.before == None or self.after == None:
print "Warning: rule does not have both principal facts." print("Warning: rule does not have both principal facts.")
print self print(self)
def __str__(self): def __str__(self):
return "Message " + Rule.__str__(self) return "Message " + Rule.__str__(self)

View File

@ -275,14 +275,14 @@ def typeSwitch(line):
elif res[3] == "typed": elif res[3] == "typed":
typeversion = True typeversion = True
else: else:
print "Cannot determine whether typed or untyped." print("Cannot determine whether typed or untyped.")
raise ParseException raise ParseException
str = "Detected " str = "Detected "
if not typedversion: if not typedversion:
str += "un" str += "un"
str += "typed version." str += "typed version."
print str print(str)
# Parse a number of lines, including the first line with the type switch # Parse a number of lines, including the first line with the type switch
def linesParse(lines): def linesParse(lines):
@ -303,9 +303,9 @@ def fileParse(filename):
# Main code # Main code
def main(): def main():
print "Testing Ifparser module" print("Testing Ifparser module")
print print()
print fileParse("NSPK_LOWE.if") print(fileParse("NSPK_LOWE.if"))
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -199,7 +199,7 @@ def sanitizeRole(protocol, role):
msgto = knowbefore[i] msgto = knowbefore[i]
if msgfrom != msgto: if msgfrom != msgto:
### TEST ### TEST
print "Substituting %s by %s" % (str(msgfrom), str(msgto)) print("Substituting %s by %s" % (str(msgfrom), str(msgto)))
# In all subsequent terms... TODO or # In all subsequent terms... TODO or
# just the next one? # just the next one?
for j in range(n+1, len(rules)): for j in range(n+1, len(rules)):
@ -237,7 +237,7 @@ def sanitizeRole(protocol, role):
replacelist.append( (t,msg) ) replacelist.append( (t,msg) )
role.constants.append(msg) role.constants.append(msg)
### TEST ### TEST
print "Substituting %s by %s" % (str(t), str(msg)) print("Substituting %s by %s" % (str(t), str(msg)))
# Apply replacelist # Apply replacelist
if len(replacelist) > 0: if len(replacelist) > 0:
for ev in role.events: for ev in role.events:
@ -280,7 +280,7 @@ def extractRoles(protocol):
# hrule has been picked. Work back from here # hrule has been picked. Work back from here
# first make up a name # first make up a name
if len(hrule.getActors()) != 1: if len(hrule.getActors()) != 1:
print "Warning: weird actor list for hrule:", hrule.getActors() print("Warning: weird actor list for hrule:", hrule.getActors())
name = "X" name = "X"
actor = None actor = None
else: else:
@ -316,7 +316,7 @@ def extractRoles(protocol):
# Loop detection # Loop detection
if rule in role.rules: if rule in role.rules:
# This is a loop TODO # This is a loop TODO
print "Warning: loop detected for role", role.name print("Warning: loop detected for role", role.name)
scan = False # Current setting: stop scan scan = False # Current setting: stop scan
else: else:
# No loop, prepend # No loop, prepend

View File

@ -60,7 +60,7 @@ class SemiTrace(object):
def getPrecedingEvents(self,event,previous=[]): def getPrecedingEvents(self,event,previous=[]):
# If it is cached return cached version # If it is cached return cached version
if event.preceding != None: if event.preceding != None:
return filter(lambda x: x not in previous,event.preceding) return [x for x in event.preceding if x not in previous]
preceding = [] preceding = []
for prec in event.getBefore(): for prec in event.getBefore():
preceding.append(prec) preceding.append(prec)
@ -71,7 +71,7 @@ class SemiTrace(object):
preceding.extend(self.getPrecedingEvents(fol)) preceding.extend(self.getPrecedingEvents(fol))
preceding = uniq(preceding) preceding = uniq(preceding)
event.preceding = preceding event.preceding = preceding
preceding = filter(lambda x: x not in previous,preceding) preceding = [x for x in preceding if x not in previous]
return preceding return preceding
# Returns -1 if the first event has to be before the second one # Returns -1 if the first event has to be before the second one
@ -150,7 +150,7 @@ class ProtocolDescription(object):
# Find event by label # Find event by label
def findEvent(self,eventlabel,eventType=None): def findEvent(self,eventlabel,eventType=None):
for (role,descr) in self.roledescr.items(): for (role,descr) in list(self.roledescr.items()):
for event in descr: for event in descr:
if event.label == eventlabel: if event.label == eventlabel:
if eventType == None or isinstance(event,eventType): if eventType == None or isinstance(event,eventType):
@ -181,7 +181,7 @@ class ProtocolDescription(object):
# that are in the precedingEvents of a certain event # that are in the precedingEvents of a certain event
def getPrecedingLabelSet(self,eventlabel): def getPrecedingLabelSet(self,eventlabel):
events = self.getPrecedingEvents(eventlabel) events = self.getPrecedingEvents(eventlabel)
events = filter(lambda x: isinstance(x,EventRead),events) events = [x for x in events if isinstance(x,EventRead)]
return [x.label for x in events] return [x.label for x in events]
# Calculate the roles in preceding labelset that is all roles that # Calculate the roles in preceding labelset that is all roles that
@ -194,7 +194,7 @@ class ProtocolDescription(object):
def __str__(self): def __str__(self):
s = '' s = ''
for x in self.roledescr.values(): for x in list(self.roledescr.values()):
for e in x: for e in x:
s += str(e) + "\n" s += str(e) + "\n"
return s return s
@ -279,7 +279,7 @@ class EventClaim(Event):
# agents # agents
def ignore(self): def ignore(self):
for untrusted in self.run.attack.untrusted: for untrusted in self.run.attack.untrusted:
if untrusted in self.run.roleAgents.values(): if untrusted in list(self.run.roleAgents.values()):
return True return True
return False return False

View File

@ -6,7 +6,7 @@ import Spdl
def main(): def main():
protocol = Ifparser.fileParse("NSPK_LOWE.if") protocol = Ifparser.fileParse("NSPK_LOWE.if")
print Spdl.generator(protocol) print(Spdl.generator(protocol))
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@ -5,15 +5,15 @@
def confirm(question): def confirm(question):
answer = '' answer = ''
while answer not in ('y','n'): while answer not in ('y','n'):
print question, print(question, end=' ')
answer = raw_input().lower() answer = input().lower()
return answer == 'y' return answer == 'y'
def exists(func,list): def exists(func,list):
return len(filter(func,list)) > 0 return len(list(filter(func,list))) > 0
def forall(func,list): def forall(func,list):
return len(filter(func,list)) == len(list) return len(list(filter(func,list))) == len(list)
def uniq(li): def uniq(li):
result = [] result = []

View File

@ -205,13 +205,13 @@ def ifParser():
def labeledruleAction(s,l,t): def labeledruleAction(s,l,t):
if t[0][3] == "Protocol_Rules": if t[0][3] == "Protocol_Rules":
print "-----------------" print("-----------------")
print "- Detected rule -" print("- Detected rule -")
print "-----------------" print("-----------------")
print t[0] print(t[0])
print t[1] print(t[1])
print print()
labeledrule.setParseAction(labeledruleAction) labeledrule.setParseAction(labeledruleAction)
@ -233,17 +233,17 @@ def typeSwitch(line):
elif res[3] == "typed": elif res[3] == "typed":
typeversion = True typeversion = True
else: else:
print "Cannot determine whether typed or untyped." print("Cannot determine whether typed or untyped.")
raise ParseException raise ParseException
except: except:
print "Unexpected error while determining (un)typedness of the line", line print("Unexpected error while determining (un)typedness of the line", line)
str = "Detected " str = "Detected "
if not typedversion: if not typedversion:
str += "un" str += "un"
str += "typed version." str += "typed version."
print str print(str)
# Parse an entire file, including the first one # Parse an entire file, including the first one
def linesParse(lines): def linesParse(lines):

View File

@ -24,7 +24,7 @@
# Todo: # Todo:
# - add pprint() - pretty-print output of defined BNF # - add pprint() - pretty-print output of defined BNF
# #
from __future__ import generators
__doc__ = \ __doc__ = \
""" """
@ -79,13 +79,13 @@ def _ustr(obj):
# it won't break any existing code. # it won't break any existing code.
return str(obj) return str(obj)
except UnicodeEncodeError, e: except UnicodeEncodeError as e:
# The Python docs (http://docs.python.org/ref/customization.html#l2h-182) # The Python docs (http://docs.python.org/ref/customization.html#l2h-182)
# state that "The return value must be a string object". However, does a # state that "The return value must be a string object". However, does a
# unicode object (being a subclass of basestring) count as a "string # unicode object (being a subclass of basestring) count as a "string
# object"? # object"?
# If so, then return a unicode object: # If so, then return a unicode object:
return unicode(obj) return str(obj)
# Else encode it... but how? There are many choices... :) # Else encode it... but how? There are many choices... :)
# Replace unprintables with escape codes? # Replace unprintables with escape codes?
#return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors') #return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors')
@ -125,7 +125,7 @@ class ParseBaseException(Exception):
elif( aname == "line" ): elif( aname == "line" ):
return line( self.loc, self.pstr ) return line( self.loc, self.pstr )
else: else:
raise AttributeError, aname raise AttributeError(aname)
def __str__( self ): def __str__( self ):
return "%s (at char %d), (line:%d, col:%d)" % ( self.msg, self.loc, self.lineno, self.column ) return "%s (at char %d), (line:%d, col:%d)" % ( self.msg, self.loc, self.lineno, self.column )
@ -198,7 +198,7 @@ class ParseResults(object):
name = _ustr(name) # will always return a str, but use _ustr for consistency name = _ustr(name) # will always return a str, but use _ustr for consistency
self.__name = name self.__name = name
if toklist: if toklist:
if isinstance(toklist,basestring): if isinstance(toklist,str):
toklist = [ toklist ] toklist = [ toklist ]
if asList: if asList:
if isinstance(toklist,ParseResults): if isinstance(toklist,ParseResults):
@ -235,25 +235,25 @@ class ParseResults(object):
del self.__toklist[i] del self.__toklist[i]
def __contains__( self, k ): def __contains__( self, k ):
return self.__tokdict.has_key(k) return k in self.__tokdict
def __len__( self ): return len( self.__toklist ) def __len__( self ): return len( self.__toklist )
def __iter__( self ): return iter( self.__toklist ) def __iter__( self ): return iter( self.__toklist )
def keys( self ): def keys( self ):
"""Returns all named result keys.""" """Returns all named result keys."""
return self.__tokdict.keys() return list(self.__tokdict.keys())
def items( self ): def items( self ):
"""Returns all named result keys and values as a list of tuples.""" """Returns all named result keys and values as a list of tuples."""
return [(k,v[-1][0]) for k,v in self.__tokdict.items()] return [(k,v[-1][0]) for k,v in list(self.__tokdict.items())]
def values( self ): def values( self ):
"""Returns all named result values.""" """Returns all named result values."""
return [ v[-1][0] for v in self.__tokdict.values() ] return [ v[-1][0] for v in list(self.__tokdict.values()) ]
def __getattr__( self, name ): def __getattr__( self, name ):
if name not in self.__slots__: if name not in self.__slots__:
if self.__tokdict.has_key( name ): if name in self.__tokdict:
if self.__modal: if self.__modal:
return self.__tokdict[name][-1][0] return self.__tokdict[name][-1][0]
else: else:
@ -266,7 +266,7 @@ class ParseResults(object):
if other.__tokdict: if other.__tokdict:
offset = len(self.__toklist) offset = len(self.__toklist)
addoffset = ( lambda a: (a<0 and offset) or (a+offset) ) addoffset = ( lambda a: (a<0 and offset) or (a+offset) )
otherdictitems = [(k,(v[0],addoffset(v[1])) ) for (k,vlist) in other.__tokdict.items() for v in vlist] otherdictitems = [(k,(v[0],addoffset(v[1])) ) for (k,vlist) in list(other.__tokdict.items()) for v in vlist]
for k,v in otherdictitems: for k,v in otherdictitems:
self[k] = v self[k] = v
if isinstance(v[0],ParseResults): if isinstance(v[0],ParseResults):
@ -313,7 +313,7 @@ class ParseResults(object):
def asDict( self ): def asDict( self ):
"""Returns the named parse results as dictionary.""" """Returns the named parse results as dictionary."""
return dict( self.items() ) return dict( list(self.items()) )
def copy( self ): def copy( self ):
"""Returns a new copy of a ParseResults object.""" """Returns a new copy of a ParseResults object."""
@ -328,7 +328,7 @@ class ParseResults(object):
"""Returns the parse results as XML. Tags are created for tokens and lists that have defined results names.""" """Returns the parse results as XML. Tags are created for tokens and lists that have defined results names."""
nl = "\n" nl = "\n"
out = [] out = []
namedItems = dict( [ (v[1],k) for (k,vlist) in self.__tokdict.items() for v in vlist ] ) namedItems = dict( [ (v[1],k) for (k,vlist) in list(self.__tokdict.items()) for v in vlist ] )
nextLevelIndent = indent + " " nextLevelIndent = indent + " "
# collapse out indents if formatting is not desired # collapse out indents if formatting is not desired
@ -376,7 +376,7 @@ class ParseResults(object):
def __lookup(self,sub): def __lookup(self,sub):
for k,vlist in self.__tokdict.items(): for k,vlist in list(self.__tokdict.items()):
for v,loc in vlist: for v,loc in vlist:
if sub is v: if sub is v:
return k return k
@ -394,8 +394,8 @@ class ParseResults(object):
return None return None
elif (len(self) == 1 and elif (len(self) == 1 and
len(self.__tokdict) == 1 and len(self.__tokdict) == 1 and
self.__tokdict.values()[0][0][1] in (0,-1)): list(self.__tokdict.values())[0][0][1] in (0,-1)):
return self.__tokdict.keys()[0] return list(self.__tokdict.keys())[0]
else: else:
return None return None
@ -423,13 +423,13 @@ def line( loc, strg ):
return strg[lastCR+1:] return strg[lastCR+1:]
def _defaultStartDebugAction( instring, loc, expr ): def _defaultStartDebugAction( instring, loc, expr ):
print "Match",expr,"at loc",loc,"(%d,%d)" % ( lineno(loc,instring), col(loc,instring) ) print("Match",expr,"at loc",loc,"(%d,%d)" % ( lineno(loc,instring), col(loc,instring) ))
def _defaultSuccessDebugAction( instring, startloc, endloc, expr, toks ): def _defaultSuccessDebugAction( instring, startloc, endloc, expr, toks ):
print "Matched",expr,"->",toks.asList() print("Matched",expr,"->",toks.asList())
def _defaultExceptionDebugAction( instring, loc, expr, exc ): def _defaultExceptionDebugAction( instring, loc, expr, exc ):
print "Exception raised:", exc print("Exception raised:", exc)
def nullDebugAction(*args): def nullDebugAction(*args):
"""'Do-nothing' debug action, to suppress debugging output during parsing.""" """'Do-nothing' debug action, to suppress debugging output during parsing."""
@ -547,8 +547,8 @@ class ParserElement(object):
try: try:
loc,tokens = self.parseImpl( instring, loc, doActions ) loc,tokens = self.parseImpl( instring, loc, doActions )
except IndexError: except IndexError:
raise ParseException, ( instring, len(instring), self.errmsg, self ) raise ParseException( instring, len(instring), self.errmsg, self)
except ParseException, err: except ParseException as err:
#~ print "Exception raised:", err #~ print "Exception raised:", err
if (self.debugActions[2] ): if (self.debugActions[2] ):
self.debugActions[2]( instring, tokensStart, self, err ) self.debugActions[2]( instring, tokensStart, self, err )
@ -561,7 +561,7 @@ class ParserElement(object):
try: try:
loc,tokens = self.parseImpl( instring, loc, doActions ) loc,tokens = self.parseImpl( instring, loc, doActions )
except IndexError: except IndexError:
raise ParseException, ( instring, len(instring), self.errmsg, self ) raise ParseException( instring, len(instring), self.errmsg, self)
else: else:
loc,tokens = self.parseImpl( instring, loc, doActions ) loc,tokens = self.parseImpl( instring, loc, doActions )
@ -579,7 +579,7 @@ class ParserElement(object):
self.resultsName, self.resultsName,
asList=self.saveAsList and isinstance(tokens,(ParseResults,list)), asList=self.saveAsList and isinstance(tokens,(ParseResults,list)),
modal=self.modalResults ) modal=self.modalResults )
except ParseException, err: except ParseException as err:
#~ print "Exception raised in user parse action:", err #~ print "Exception raised in user parse action:", err
if (self.debugActions[2] ): if (self.debugActions[2] ):
self.debugActions[2]( instring, tokensStart, self, err ) self.debugActions[2]( instring, tokensStart, self, err )
@ -670,49 +670,49 @@ class ParserElement(object):
def __add__(self, other ): def __add__(self, other ):
"""Implementation of + operator - returns And""" """Implementation of + operator - returns And"""
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return And( [ self, other ] ) return And( [ self, other ] )
def __radd__(self, other ): def __radd__(self, other ):
"""Implementation of += operator""" """Implementation of += operator"""
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return other + self return other + self
def __or__(self, other ): def __or__(self, other ):
"""Implementation of | operator - returns MatchFirst""" """Implementation of | operator - returns MatchFirst"""
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return MatchFirst( [ self, other ] ) return MatchFirst( [ self, other ] )
def __ror__(self, other ): def __ror__(self, other ):
"""Implementation of |= operator""" """Implementation of |= operator"""
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return other | self return other | self
def __xor__(self, other ): def __xor__(self, other ):
"""Implementation of ^ operator - returns Or""" """Implementation of ^ operator - returns Or"""
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return Or( [ self, other ] ) return Or( [ self, other ] )
def __rxor__(self, other ): def __rxor__(self, other ):
"""Implementation of ^= operator""" """Implementation of ^= operator"""
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return other ^ self return other ^ self
def __and__(self, other ): def __and__(self, other ):
"""Implementation of & operator - returns Each""" """Implementation of & operator - returns Each"""
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return Each( [ self, other ] ) return Each( [ self, other ] )
def __rand__(self, other ): def __rand__(self, other ):
"""Implementation of right-& operator""" """Implementation of right-& operator"""
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return other & self return other & self
@ -985,7 +985,7 @@ class Word(Token):
if max > 0: if max > 0:
self.maxLen = max self.maxLen = max
else: else:
self.maxLen = sys.maxint self.maxLen = sys.maxsize
if exact > 0: if exact > 0:
self.maxLen = exact self.maxLen = exact
@ -1064,7 +1064,7 @@ class CharsNotIn(Token):
if max > 0: if max > 0:
self.maxLen = max self.maxLen = max
else: else:
self.maxLen = sys.maxint self.maxLen = sys.maxsize
if exact > 0: if exact > 0:
self.maxLen = exact self.maxLen = exact
@ -1143,7 +1143,7 @@ class White(Token):
if max > 0: if max > 0:
self.maxLen = max self.maxLen = max
else: else:
self.maxLen = sys.maxint self.maxLen = sys.maxsize
if exact > 0: if exact > 0:
self.maxLen = exact self.maxLen = exact
@ -1197,7 +1197,7 @@ class GoToColumn(PositionToken):
def parseImpl( self, instring, loc, doActions=True ): def parseImpl( self, instring, loc, doActions=True ):
thiscol = col( loc, instring ) thiscol = col( loc, instring )
if thiscol > self.col: if thiscol > self.col:
raise ParseException, ( instring, loc, "Text not in expected column", self ) raise ParseException( instring, loc, "Text not in expected column", self)
newloc = loc + self.col - thiscol newloc = loc + self.col - thiscol
ret = instring[ loc: newloc ] ret = instring[ loc: newloc ]
return newloc, ret return newloc, ret
@ -1287,7 +1287,7 @@ class ParseExpression(ParserElement):
super(ParseExpression,self).__init__(savelist) super(ParseExpression,self).__init__(savelist)
if isinstance( exprs, list ): if isinstance( exprs, list ):
self.exprs = exprs self.exprs = exprs
elif isinstance( exprs, basestring ): elif isinstance( exprs, str ):
self.exprs = [ Literal( exprs ) ] self.exprs = [ Literal( exprs ) ]
else: else:
self.exprs = [ exprs ] self.exprs = [ exprs ]
@ -1390,12 +1390,12 @@ class And(ParseExpression):
loc, resultlist = self.exprs[0].parse( instring, loc, doActions ) loc, resultlist = self.exprs[0].parse( instring, loc, doActions )
for e in self.exprs[1:]: for e in self.exprs[1:]:
loc, exprtokens = e.parse( instring, loc, doActions ) loc, exprtokens = e.parse( instring, loc, doActions )
if exprtokens or exprtokens.keys(): if exprtokens or list(exprtokens.keys()):
resultlist += exprtokens resultlist += exprtokens
return loc, resultlist return loc, resultlist
def __iadd__(self, other ): def __iadd__(self, other ):
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return self.append( other ) #And( [ self, other ] ) return self.append( other ) #And( [ self, other ] )
@ -1435,11 +1435,11 @@ class Or(ParseExpression):
for e in self.exprs: for e in self.exprs:
try: try:
loc2 = e.tryParse( instring, loc ) loc2 = e.tryParse( instring, loc )
except ParseException, err: except ParseException as err:
if err.loc > maxExcLoc: if err.loc > maxExcLoc:
maxException = err maxException = err
maxExcLoc = err.loc maxExcLoc = err.loc
except IndexError, err: except IndexError as err:
if len(instring) > maxExcLoc: if len(instring) > maxExcLoc:
maxException = ParseException(instring,len(instring),e.errmsg,self) maxException = ParseException(instring,len(instring),e.errmsg,self)
maxExcLoc = len(instring) maxExcLoc = len(instring)
@ -1454,7 +1454,7 @@ class Or(ParseExpression):
return maxMatchExp.parse( instring, loc, doActions ) return maxMatchExp.parse( instring, loc, doActions )
def __ixor__(self, other ): def __ixor__(self, other ):
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return self.append( other ) #Or( [ self, other ] ) return self.append( other ) #Or( [ self, other ] )
@ -1492,11 +1492,11 @@ class MatchFirst(ParseExpression):
try: try:
ret = e.parse( instring, loc, doActions ) ret = e.parse( instring, loc, doActions )
return ret return ret
except ParseException, err: except ParseException as err:
if err.loc > maxExcLoc: if err.loc > maxExcLoc:
maxException = err maxException = err
maxExcLoc = err.loc maxExcLoc = err.loc
except IndexError, err: except IndexError as err:
if len(instring) > maxExcLoc: if len(instring) > maxExcLoc:
maxException = ParseException(instring,len(instring),e.errmsg,self) maxException = ParseException(instring,len(instring),e.errmsg,self)
maxExcLoc = len(instring) maxExcLoc = len(instring)
@ -1506,7 +1506,7 @@ class MatchFirst(ParseExpression):
raise maxException raise maxException
def __ior__(self, other ): def __ior__(self, other ):
if isinstance( other, basestring ): if isinstance( other, str ):
other = Literal( other ) other = Literal( other )
return self.append( other ) #MatchFirst( [ self, other ] ) return self.append( other ) #MatchFirst( [ self, other ] )
@ -1580,13 +1580,13 @@ class Each(ParseExpression):
finalResults = ParseResults([]) finalResults = ParseResults([])
for r in resultlist: for r in resultlist:
dups = {} dups = {}
for k in r.keys(): for k in list(r.keys()):
if k in finalResults.keys(): if k in list(finalResults.keys()):
tmp = ParseResults(finalResults[k]) tmp = ParseResults(finalResults[k])
tmp += ParseResults(r[k]) tmp += ParseResults(r[k])
dups[k] = tmp dups[k] = tmp
finalResults += ParseResults(r) finalResults += ParseResults(r)
for k,v in dups.items(): for k,v in list(dups.items()):
finalResults[k] = v finalResults[k] = v
return loc, finalResults return loc, finalResults
@ -1609,7 +1609,7 @@ class ParseElementEnhance(ParserElement):
"""Abstract subclass of ParserElement, for combining and post-processing parsed tokens.""" """Abstract subclass of ParserElement, for combining and post-processing parsed tokens."""
def __init__( self, expr, savelist=False ): def __init__( self, expr, savelist=False ):
super(ParseElementEnhance,self).__init__(savelist) super(ParseElementEnhance,self).__init__(savelist)
if isinstance( expr, basestring ): if isinstance( expr, str ):
expr = Literal(expr) expr = Literal(expr)
self.expr = expr self.expr = expr
self.strRepr = None self.strRepr = None
@ -1739,7 +1739,7 @@ class ZeroOrMore(ParseElementEnhance):
if hasIgnoreExprs: if hasIgnoreExprs:
loc = self.skipIgnorables( instring, loc ) loc = self.skipIgnorables( instring, loc )
loc, tmptokens = self.expr.parse( instring, loc, doActions ) loc, tmptokens = self.expr.parse( instring, loc, doActions )
if tmptokens or tmptokens.keys(): if tmptokens or list(tmptokens.keys()):
tokens += tmptokens tokens += tmptokens
except (ParseException,IndexError): except (ParseException,IndexError):
pass pass
@ -1772,7 +1772,7 @@ class OneOrMore(ParseElementEnhance):
if hasIgnoreExprs: if hasIgnoreExprs:
loc = self.skipIgnorables( instring, loc ) loc = self.skipIgnorables( instring, loc )
loc, tmptokens = self.expr.parse( instring, loc, doActions ) loc, tmptokens = self.expr.parse( instring, loc, doActions )
if tmptokens or tmptokens.keys(): if tmptokens or list(tmptokens.keys()):
tokens += tmptokens tokens += tmptokens
except (ParseException,IndexError): except (ParseException,IndexError):
pass pass
@ -1928,7 +1928,7 @@ class Upcase(TokenConverter):
DeprecationWarning,stacklevel=2) DeprecationWarning,stacklevel=2)
def postParse( self, instring, loc, tokenlist ): def postParse( self, instring, loc, tokenlist ):
return map( string.upper, tokenlist ) return list(map( string.upper, tokenlist ))
class Combine(TokenConverter): class Combine(TokenConverter):
@ -1957,7 +1957,7 @@ class Combine(TokenConverter):
del retToks[:] del retToks[:]
retToks += ParseResults([ "".join(tokenlist._asStringList(self.joinString)) ], modal=self.modalResults) retToks += ParseResults([ "".join(tokenlist._asStringList(self.joinString)) ], modal=self.modalResults)
if self.resultsName and len(retToks.keys())>0: if self.resultsName and len(list(retToks.keys()))>0:
return [ retToks ] return [ retToks ]
else: else:
return retToks return retToks
@ -1991,7 +1991,7 @@ class Dict(TokenConverter):
else: else:
dictvalue = tok.copy() #ParseResults(i) dictvalue = tok.copy() #ParseResults(i)
del dictvalue[0] del dictvalue[0]
if len(dictvalue)!= 1 or (isinstance(dictvalue,ParseResults) and dictvalue.keys()): if len(dictvalue)!= 1 or (isinstance(dictvalue,ParseResults) and list(dictvalue.keys())):
tokenlist[ikey] = (dictvalue,i) tokenlist[ikey] = (dictvalue,i)
else: else:
tokenlist[ikey] = (dictvalue[0],i) tokenlist[ikey] = (dictvalue[0],i)
@ -2074,13 +2074,13 @@ empty = Empty().setName("empty")
_escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1]) _escapedPunc = Word( _bslash, r"\[]-*.$+^?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1])
_printables_less_backslash = "".join([ c for c in printables if c not in r"\]" ]) _printables_less_backslash = "".join([ c for c in printables if c not in r"\]" ])
_escapedHexChar = Combine( Suppress(_bslash + "0x") + Word(hexnums) ).setParseAction(lambda s,l,t:unichr(int(t[0],16))) _escapedHexChar = Combine( Suppress(_bslash + "0x") + Word(hexnums) ).setParseAction(lambda s,l,t:chr(int(t[0],16)))
_escapedOctChar = Combine( Suppress(_bslash) + Word("0","01234567") ).setParseAction(lambda s,l,t:unichr(int(t[0],8))) _escapedOctChar = Combine( Suppress(_bslash) + Word("0","01234567") ).setParseAction(lambda s,l,t:chr(int(t[0],8)))
_singleChar = _escapedPunc | _escapedHexChar | _escapedOctChar | Word(_printables_less_backslash,exact=1) _singleChar = _escapedPunc | _escapedHexChar | _escapedOctChar | Word(_printables_less_backslash,exact=1)
_charRange = Group(_singleChar + Suppress("-") + _singleChar) _charRange = Group(_singleChar + Suppress("-") + _singleChar)
_reBracketExpr = "[" + Optional("^").setResultsName("negate") + Group( OneOrMore( _charRange | _singleChar ) ).setResultsName("body") + "]" _reBracketExpr = "[" + Optional("^").setResultsName("negate") + Group( OneOrMore( _charRange | _singleChar ) ).setResultsName("body") + "]"
_expanded = lambda p: (isinstance(p,ParseResults) and ''.join([ unichr(c) for c in range(ord(p[0]),ord(p[1])+1) ]) or p) _expanded = lambda p: (isinstance(p,ParseResults) and ''.join([ chr(c) for c in range(ord(p[0]),ord(p[1])+1) ]) or p)
def srange(s): def srange(s):
r"""Helper to easily define string ranges for use in Word construction. Borrows r"""Helper to easily define string ranges for use in Word construction. Borrows
@ -2120,11 +2120,11 @@ def removeQuotes(s,l,t):
def upcaseTokens(s,l,t): def upcaseTokens(s,l,t):
"""Helper parse action to convert tokens to upper case.""" """Helper parse action to convert tokens to upper case."""
return map( str.upper, t ) return list(map( str.upper, t ))
def downcaseTokens(s,l,t): def downcaseTokens(s,l,t):
"""Helper parse action to convert tokens to lower case.""" """Helper parse action to convert tokens to lower case."""
return map( str.lower, t ) return list(map( str.lower, t ))
def _makeTags(tagStr, xml): def _makeTags(tagStr, xml):
"""Internal helper to construct opening and closing tag expressions, given a tag name""" """Internal helper to construct opening and closing tag expressions, given a tag name"""
@ -2185,20 +2185,20 @@ commaSeparatedList = delimitedList( Optional( quotedString | _commasepitem, defa
if __name__ == "__main__": if __name__ == "__main__":
def test( teststring ): def test( teststring ):
print teststring,"->", print(teststring,"->", end=' ')
try: try:
tokens = simpleSQL.parseString( teststring ) tokens = simpleSQL.parseString( teststring )
tokenlist = tokens.asList() tokenlist = tokens.asList()
print tokenlist print(tokenlist)
print "tokens = ", tokens print("tokens = ", tokens)
print "tokens.columns =", tokens.columns print("tokens.columns =", tokens.columns)
print "tokens.tables =", tokens.tables print("tokens.tables =", tokens.tables)
print tokens.asXML("SQL",True) print(tokens.asXML("SQL",True))
except ParseException, err: except ParseException as err:
print err.line print(err.line)
print " "*(err.column-1) + "^" print(" "*(err.column-1) + "^")
print err print(err)
print print()
selectToken = CaselessLiteral( "select" ) selectToken = CaselessLiteral( "select" )
fromToken = CaselessLiteral( "from" ) fromToken = CaselessLiteral( "from" )

View File

@ -8,7 +8,6 @@
# #
# Win32 # Win32
# Unix # Unix
# MacPPC
# MacIntel # MacIntel
# First we find out the current operating system # First we find out the current operating system
@ -20,7 +19,7 @@ else (WIN32)
# Not windows, is it a mac? # Not windows, is it a mac?
if (APPLE) if (APPLE)
# TODO: A mac, but what architecture? # TODO: A mac, but what architecture?
# For now we assume intel (Christoph Sprenger's machine) # For now we assume intel
set (Source_OS "MacIntel") set (Source_OS "MacIntel")
else (APPLE) else (APPLE)
# Not a mac, not windows # Not a mac, not windows

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python3
""" """
Scyther : An automatic verifier for security protocols. Scyther : An automatic verifier for security protocols.
Copyright (C) 2007-2013 Cas Cremers Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -48,6 +48,6 @@ def getDescription():
if __name__ == '__main__': if __name__ == '__main__':
tag = getDescription() tag = getDescription()
writeTag(tag) writeTag(tag)
print tag print(tag)

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
import commands import subprocess
import sys import sys
@ -33,26 +33,26 @@ def main():
""" Force indent """ """ Force indent """
cmd = "indent *.c *.h" cmd = "indent *.c *.h"
output = commands.getoutput(cmd) output = subprocess.getoutput(cmd)
""" Force ctags """ """ Force ctags """
cmd = "ctags *.c *.h" cmd = "ctags *.c *.h"
output = commands.getoutput(cmd) output = subprocess.getoutput(cmd)
excludes = ['scanner.c','scanner.h','parser.c','parser.h'] excludes = ['scanner.c','scanner.h','parser.c','parser.h']
fnames = findfunctions(excludes) fnames = findfunctions(excludes)
for fname in fnames.keys(): for fname in list(fnames.keys()):
""" """
The ..* construct makes sure that function definitions are The ..* construct makes sure that function definitions are
skipped (based on the indent settings skipped (based on the indent settings
""" """
cmd = "grep '..*%s' *.c" % (fname) cmd = "grep '..*%s' *.c" % (fname)
#print cmd #print cmd
output = commands.getoutput(cmd).splitlines() output = subprocess.getoutput(cmd).splitlines()
if len(output) <= mincount: if len(output) <= mincount:
print "%s\t%s" % (fnames[fname],fname) print("%s\t%s" % (fnames[fname],fname))
if len(output) > 0: if len(output) > 0:
print output print(output)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/* /*
* Scyther : An automatic verifier for security protocols. * Scyther : An automatic verifier for security protocols.
* Copyright (C) 2007-2013 Cas Cremers * Copyright (C) 2007-2020 Cas Cremers
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
results: results:
./regression-test.py python3 ./regression-test.py
.PHONY: results .PHONY: results

Some files were not shown because too many files have changed in this diff Show More