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
protocol modelers. For installation and usage instructions of the
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
----------------------
@ -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
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).
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" ]
then
# Make for ppc and intel, and combine into universal binary
# Make for intel
BIN="scyther-mac"
cmake $CMFLAGS -D TARGETOS=MacPPC . && make
cmake $CMFLAGS -D TARGETOS=MacIntel . && make
cmake $CMFLAGS . && make scyther-mac
fi

View File

@ -1,6 +1,17 @@
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
-------------------------------
@ -62,7 +73,7 @@ Major new features:
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.
* IEEE 802.16e/WIMAX: PKMv2rsa and variants

View File

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

View File

@ -1,8 +1,8 @@
#!/usr/bin/python
from __future__ import division # 2.2+-only
# 2.2+-only
"""
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
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 wx
import os
from Misc import *
from .Misc import *
#---------------------------------------------------------------------------
""" Import scyther-gui components """
import Icon
import Preference
import Error
from . import Icon
from . import Preference
from . import Error
#---------------------------------------------------------------------------
try:
@ -54,7 +54,7 @@ class AttackDisplay(wx.ScrolledWindow):
wx.ScrolledWindow.__init__(self,parent,id=-1)
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.Add(self.Image,1,wx.ALIGN_CENTER)
self.hbox = wx.BoxSizer(wx.HORIZONTAL)
@ -74,7 +74,7 @@ class AttackDisplay(wx.ScrolledWindow):
Preference.doNotUsePIL()
raise Error.PILError
else:
print "Unknown file type %s." % (self.filetype)
print("Unknown file type %s." % (self.filetype))
# TODO self.Bind(wxSizeEvent
self.update(True)
@ -93,9 +93,7 @@ class AttackDisplay(wx.ScrolledWindow):
# This is needed, don't ask me why.
self.SetScrollbars(0,0,0,0,0,0)
size = self.GetClientSize()
framewidth = size.width
frameheight = size.height
(framewidth,frameheight) = self.GetClientSize()
(virtualwidth,virtualheight) = (framewidth,frameheight)
def makefit(width,height):
@ -120,14 +118,14 @@ class AttackDisplay(wx.ScrolledWindow):
if self.attack.filetype == "png":
bmp = self.original
if not bmp.Ok():
bmp = wx.EmptyImage(1,1)
if not bmp.IsOk():
bmp = wx.Image(1,1)
else:
(originalwidth,originalheight) = (bmp.GetWidth(), bmp.GetHeight())
if self.win.fit:
(factor, virtualwidth, virtualheight) = makefit(originalwidth,originalheight)
bmp = self.original.Scale(virtualwidth,virtualheight)
self.Image.SetBitmap(wx.BitmapFromImage(bmp))
self.Image.SetBitmap(wx.Bitmap(bmp))
elif self.attack.filetype == "ps":
pil = self.original.copy()
@ -144,7 +142,7 @@ class AttackDisplay(wx.ScrolledWindow):
self.Image.SetBitmap(image.ConvertToBitmap())
else:
print "Unknown file type %s." % (self.attack.filetype)
print("Unknown file type %s." % (self.attack.filetype))
self.SetVirtualSize((virtualwidth,virtualheight))
@ -200,16 +198,15 @@ class AttackDisplay(wx.ScrolledWindow):
(p,r,l) = self.win.claim.triplet()
prefix = "pattern-%s_%s_%s-%s" % (p,r,l,self.attack.id)
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
def exportImage(self, type,ext=None):
def exportImage(self, imgtype, ext=None):
if ext == None:
ext = type
ext = imgtype
res = self.saveFileName(ext)
if res != None:
cmd = "dot -T%s" % (type)
cmdpushwrite(cmd,self.attack.scytherDot,res)
dotOutputWrite(self.attack.scytherDot,res,["-T" + imgtype])
def OnExportPng(self, event):
self.exportImage("png")

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
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
pos = self.control.GetLineIndentPosition(line)
last = self.control.GetLineEndPosition(line)
self.control.StartStyling(pos,31)
self.control.StartStyling(pos)
self.control.SetStyling(last-pos,self.errorstyle)
def ClearErrors(self):

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
modify it under the terms of the GNU General Public License

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
modify it under the terms of the GNU General Public License
@ -29,7 +29,7 @@ import sys
#---------------------------------------------------------------------------
""" Import scyther-gui components """
import Misc
from . import Misc
#---------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
modify it under the terms of the GNU General Public License
@ -28,12 +28,12 @@ import os.path
#---------------------------------------------------------------------------
""" Import scyther-gui components """
import Settingswindow
import Scytherthread
import Icon
import About
import Editor
import Preference
from . import Settingswindow
from . import Scytherthread
from . import Icon
from . import About
from . import Editor
from . import Preference
#---------------------------------------------------------------------------
@ -288,7 +288,7 @@ class MainWindow(wx.Frame):
def OnOpen(self, event):
if self.ConfirmLoss("Open"):
if self.askUserForFilename(style=wx.OPEN,
if self.askUserForFilename(style=wx.FD_OPEN,
**self.defaultFileDialogOptions()):
textfile = open(os.path.join(self.dirname, self.filename), 'r')
self.editor.SetText(textfile.read())
@ -298,7 +298,7 @@ class MainWindow(wx.Frame):
return False
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.OnSave(event)
os.chdir(self.dirname)

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
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
""" Import scyther-gui components """
import Temporary
import Preference
from . import Temporary
from . import Preference
#---------------------------------------------------------------------------
try:
@ -118,42 +118,32 @@ def makeImageDot(dotdata,attackthread=None):
if Preference.usePIL():
# If we have the PIL library, we can do postscript! great
# stuff.
type = "ps"
imgtype = "ps"
ext = ".ps"
else:
# Ye olde pnge file
type = "png"
imgtype = "png"
ext = ".png"
# Retrieve dot command path
dotcommand = FindDot.findDot()
# command to write to temporary file
(fd2,fpname2) = Temporary.tempcleaned(ext)
f = os.fdopen(fd2,'w')
# Write dot source file into temporary file to simplify dealing with graphviz invocation across platforms
(fd_in,fpname_in) = Temporary.tempcleaned(ext)
f_in = os.fdopen(fd_in,'w')
if attackthread:
writeGraph(attackthread,dotdata,f_in)
else:
f_in.write(dotdata)
f_in.close()
# Set up command
cmd = "%s -T%s" % (dotcommand,type)
dotcommand = FindDot.findDot()
cmd = [dotcommand, "-T" + imgtype, fpname_in]
# 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()
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)
return (fpname_out, imgtype)
def makeImage(attack,attackthread=None):
@ -161,10 +151,10 @@ def makeImage(attack,attackthread=None):
""" 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
attack.file = name
attack.filetype = type
attack.filetype = imgtype
def testImage():

View File

@ -1,6 +1,6 @@
"""
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
modify it under the terms of the GNU General Public License
@ -25,22 +25,29 @@
""" Import externals """
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):
answer = ''
while answer not in ('y','n'):
print question,
answer = raw_input().lower()
print(question, end=' ')
answer = input().lower()
return answer == 'y'
def exists(func,list):
return len(filter(func,list)) > 0
return len(list(filter(func,list))) > 0
def forall(func,list):
return len(filter(func,list)) == len(list)
return len(list(filter(func,list))) == len(list)
def uniq(li):
result = []
@ -67,24 +74,36 @@ def mypath(file):
basedir = os.path.split(cmd_file)[0]
return os.path.join(basedir,file)
# commands: push data in, get fp.write out
def cmdpushwrite(cmd,data,fname):
# Write string to tempfile, return (filedescriptor,name)
def stringToTempfile(data,ext="tmp"):
"""
Feed stdin data to cmd, write the output to a freshly created file
'fname'. The file is flushed and closed at the end.
Take data (a string) and write it to a safe temporary file.
Return the resulting filedescriptor and name as a pair.
"""
fp = open(fname,'w')
# execute command
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE)
(cin,cout) = (p.stdin, p.stdout)
(fd,fpname) = Temporary.tempcleaned(ext)
f = os.fdopen(fd,'w')
f.write(data)
f.close()
cin.write(data)
cin.close()
for l in cout.read():
fp.write(l)
cout.close()
fp.flush()
fp.close()
return (fd, fpname)
# commands: push data in as file named argument to dot, get fp.write out
def dotOutputWrite(data,fname,cmd=[]):
"""
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\:>-:

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
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 Makeimage
from . import Makeimage
#---------------------------------------------------------------------------
@ -127,7 +127,7 @@ class Preferences(dict):
"""
Copy dict into self.
"""
for x in d.keys():
for x in list(d.keys()):
self[x] = d[x]
def parse(self,line):
@ -164,13 +164,13 @@ class Preferences(dict):
fp.close()
def show(self):
print "Preferences:"
for k in self.keys():
print "%s=%s" % (k, self[k])
print("Preferences:")
for k in list(self.keys()):
print("%s=%s" % (k, self[k]))
def save(self):
print "Saving preferences"
print("Saving preferences")
prefpath = preflocs[-1]
if not os.access(prefpath,os.W_OK):
os.makedirs(prefpath)
@ -215,7 +215,7 @@ def init():
def get(key,alt=None):
global prefs
if key in prefs.keys():
if key in list(prefs.keys()):
return prefs[key]
else:
return alt
@ -223,7 +223,7 @@ def get(key,alt=None):
def getkeys():
global prefs
return prefs.keys()
return list(prefs.keys())
def set(key,value):
global prefs

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
modify it under the terms of the GNU General Public License
@ -33,11 +33,11 @@ import Scyther.Error
from Scyther.Misc import *
""" Import scyther-gui components """
import Preference
import Attackwindow
import Icon
import Error
import Makeimage
from . import Preference
from . import Attackwindow
from . import Icon
from . import Error
from . import Makeimage
#---------------------------------------------------------------------------
if Preference.havePIL:
@ -114,7 +114,7 @@ class ScytherThread(threading.Thread):
# verification start
try:
claims = scyther.verify(storePopen=self.storePopen)
except Scyther.Error.ScytherError, el:
except Scyther.Error.ScytherError as el:
claims = None
pass
@ -185,7 +185,7 @@ class VerificationWindow(wx.Dialog):
sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
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()
@ -217,7 +217,7 @@ class ErrorWindow(wx.Dialog):
sizer.Add(label, 0, wx.ALIGN_LEFT|wx.ALL, 5)
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 = ""
prefix = "error: "
@ -230,7 +230,7 @@ class ErrorWindow(wx.Dialog):
sizer.Add(label, 0, wx.ALIGN_LEFT|wx.ALL, 5)
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()
@ -464,13 +464,13 @@ class ScytherRun(object):
# which makes error reporting somewhat easier
try:
Scyther.Scyther.Check()
except Scyther.Error.BinaryError, e:
except Scyther.Error.BinaryError as e:
# e.file is the supposed location of the binary
text = "Could not find Scyther binary at\n%s" % (e.file)
Error.ShowAndExit(text)
# 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_WINDOW_DESTROY, self.closer)
self.verifywin.Bind(wx.EVT_BUTTON, self.closer, id=wx.ID_CANCEL)
@ -520,12 +520,12 @@ class ScytherRun(object):
def allDone():
if resultwin:
resultwin.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
resultwin.SetCursor(wx.Cursor(wx.CURSOR_ARROW))
resultwin.SetStatusText("Done.")
resultwin.Center()
resultwin.Show(True)
resultwin.SetCursor(wx.StockCursor(wx.CURSOR_ARROWWAIT))
resultwin.SetCursor(wx.Cursor(wx.CURSOR_ARROWWAIT))
wx.Yield()

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
modify it under the terms of the GNU General Public License
@ -28,7 +28,7 @@ import sys
#---------------------------------------------------------------------------
""" Import scyther-gui components """
import Preference
from . import Preference
import Scyther.Claim as Claim
#---------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
"""
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
modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
"""
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
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/
Scyther does not support Python 3. You are therefore recommended to
choose the latest production release of Python 2, e.g., Python 2.7.
Scyther requires **Python 3** now, and no longer supports Python 2.
* **Mac OS X**
@ -41,35 +40,20 @@ from the command line) then you need only the first.
3. ### 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
package that matches your Python version (e.g., 2.7). It is
recommended to select the unicode version from the stable releases.
This version of Scyther requires at least **wxPython 4.0**. Note that older versions of Scyther did not work with wxPython 4.
As of writing (May 2013) the following links lead to the appropriate
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
For Ubuntu users, it is important to add an additional parameter, e.g., for Ubuntu 20.04, the recommended pip install is:
```
$ sudo apt install python-pip
$ pip install -U \
-f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 \
wxPython
```
Running Scyther
---------------
@ -78,13 +62,13 @@ Extract the Scyther archive and navigate to the extracted directory.
Start Scyther by executing the file
scyther-gui.py
`scyther-gui.py`
in the main directory of the extracted archive.
* **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".

View File

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

View File

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

View File

@ -32,7 +32,7 @@ def parseArgs():
parser.print_help()
sys.exit(0)
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)
return (opts,args)
@ -158,7 +158,7 @@ def message1 (label,inrole):
return msg
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):
global P,variant,opts
@ -205,7 +205,7 @@ def message2 (label,inrole):
return msg
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):
global P,opts
@ -338,7 +338,7 @@ def main():
global opts
(opts,args) = parseArgs()
print protocol(args)
print(protocol(args))
# Only if main stuff
if __name__ == '__main__':

View File

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

View File

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

View File

@ -3,7 +3,7 @@ The Scyther tool
Scyther is a tool for the symbolic analysis of security protocols. It is
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 Scyther tool. If you are working from the source files, some paths may be
@ -45,11 +45,15 @@ availabe from
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:
* [./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
---------------

View File

@ -2,7 +2,7 @@
"""
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
modify it under the terms of the GNU General Public License
@ -52,7 +52,7 @@ def evaluate(fn,prefix=""):
fstderr.seek(0)
res = ""
for l in fstdout.xreadlines():
for l in fstdout:
res += prefix + l.strip() + "\n"
#for l in fstderr.xreadlines():
# print l
@ -72,7 +72,7 @@ def main():
cnt = 1
tres = ""
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))
fp.write(res)
tres += res
@ -83,7 +83,7 @@ def main():
fp.write(tres)
fp.close()
print res
print(res)

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
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
# environment (i.e. PATH variable)
#
import os,sys,commands
import os,sys,subprocess
import os.path
tempcount = 0
@ -59,7 +59,7 @@ def scyther_to_dotfile():
tmpdotfile = generateTemp('dot')
command = "%s --plain --dot-output %s > %s" % (scythername, args, tmpdotfile)
output = commands.getoutput(command)
output = subprocess.getoutput(command)
return (output,tmpdotfile)
def dotfile_to_pdffile(dotfile,outfile=None):
@ -72,10 +72,10 @@ def dotfile_to_pdffile(dotfile,outfile=None):
# it fit to a landscape page
dotdata = open(dotfile, "r")
f = None
for line in dotdata.xreadlines():
for line in dotdata:
if (line.find('digraph') == 0):
f = os.popen("dot -Gsize='11.0,8.0' -Gratio=fill -Tps >>%s" % (tmp),'w')
print >>f, line
print(line, file=f)
dotdata.close()
if not f:
@ -96,18 +96,18 @@ def dotfile_to_pdffile(dotfile,outfile=None):
def main():
(output,dotfile) = scyther_to_dotfile()
print output
print(output)
pdffile = dotfile_to_pdffile(dotfile)
os.unlink(dotfile)
if pdffile:
commands.getoutput("kpdf %s" % pdffile)
subprocess.getoutput("kpdf %s" % pdffile)
os.unlink(pdffile)
else:
print "No graphs generated."
print("No graphs generated.")
if __name__ == '__main__':
if len(sys.argv) > 1:
main()
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.
Copyright (C) 2007-2013 Cas Cremers
Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -21,10 +21,10 @@
# Attack
#
import Trace
import Term
from . import Trace
from . import Term
#import Classification
from Misc import *
from .Misc import *
class Attack(object):
def __init__(self):
@ -47,7 +47,7 @@ class Attack(object):
def getInvolvedAgents(self):
result = []
for run in self.semiTrace.runs:
for agent in run.roleAgents.values():
for agent in list(run.roleAgents.values()):
result.append(agent)
return uniq(result)

View File

@ -1,6 +1,6 @@
"""
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
modify it under the terms of the GNU General Public License
@ -21,7 +21,7 @@
# Claim
#
import Term
from . import Term
def stateDescription(okay,n=1,caps=False):
if okay:

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
"""
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
modify it under the terms of the GNU General Public License
@ -29,7 +29,7 @@ import sys
import os
#---------------------------------------------------------------------------
""" Import internals """
import Misc
from . import Misc
#---------------------------------------------------------------------------
DOTLOCATION = None
@ -41,8 +41,9 @@ def testDot(fpath):
try:
cmd = "%s -V" % (fpath)
(sts,sout,serr) = Misc.safeCommandOutput(cmd)
if sts != -1:
if "version" in sout + serr:
if "version" in str(sout) + str(serr):
return True
except:
pass

View File

@ -1,6 +1,6 @@
"""
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
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):
answer = ''
while answer not in ('y','n'):
print question,
answer = raw_input().lower()
print(question, end=' ')
answer = input().lower()
return answer == 'y'
def exists(func,list):
return len(filter(func,list)) > 0
return len(list(filter(func,list))) > 0
def forall(func,list):
return len(filter(func,list)) == len(list)
return len(list(filter(func,list))) == len(list)
def uniq(li):
result = []
@ -93,21 +93,19 @@ def getShell():
"""
Determine if we want a shell for Popen
"""
if sys.platform.startswith("win"):
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
return False
def safeCommandOutput(cmd, storePopen=None):
""" Execute a command and return (sts,sout,serr).
Meant for short outputs, as output is stored in memory and
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:
storePopen(p)
(sout,serr) = p.communicate()
@ -119,16 +117,20 @@ def safeCommand(cmd, storePopen=None):
version, I hope. """
try:
p = Popen(cmd, shell=getShell())
if isinstance(cmd, str):
import shlex
cmd = shlex.split(cmd)
p = Popen(cmd)
if storePopen != None:
storePopen(p)
sts = p.wait()
except KeyboardInterrupt, EnvironmentError:
except KeyboardInterrupt as EnvironmentError:
raise
except:
print "Wile processing [%s] we had an" % (cmd)
print "unexpected error:", sys.exc_info()[0]
print
print("Wile processing [%s] we had an" % (cmd))
print("unexpected error:", sys.exc_info()[0])
print()
sts = -1
raise # For now still raise
@ -142,15 +144,15 @@ def panic(text):
"""
try:
import Tkinter
import tkinter
except:
print text
print(text)
sys.exit(-1)
print text
print(text)
root = Tkinter.Tk()
w = Tkinter.Label(root, justify=Tkinter.LEFT, padx = 10, text=text)
root = tkinter.Tk()
w = tkinter.Label(root, justify=tkinter.LEFT, padx = 10, text=text)
w.pack()
root.mainloop()

View File

@ -1,7 +1,7 @@
#!/usr/bin/python
"""
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
modify it under the terms of the GNU General Public License
@ -28,7 +28,7 @@
import os
import os.path
import sys
import StringIO
import io
import tempfile
try:
import hashlib
@ -40,10 +40,10 @@ except ImportError:
#---------------------------------------------------------------------------
""" Import scyther components """
import XMLReader
import Error
import Claim
from Misc import *
from . import XMLReader
from . import Error
from . import Claim
from .Misc import *
#---------------------------------------------------------------------------
@ -77,7 +77,7 @@ def getCacheDir():
# Check if user chose the path
cachedirkey = "SCYTHERCACHEDIR"
if cachedirkey in os.environ.keys():
if cachedirkey in list(os.environ.keys()):
tmpdir = os.environ[cachedirkey]
if tmpdir == "":
# 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):
raise Error.BinaryError, program
raise Error.BinaryError(program)
#---------------------------------------------------------------------------
@ -149,7 +149,7 @@ def EnsureString(x,sep=" "):
return sep.join(newlist)
else:
raise Error.StringListError, x
raise Error.StringListError(x)
#---------------------------------------------------------------------------
@ -177,7 +177,7 @@ def getScytherBackend():
else:
""" Unsupported"""
raise Error.UnknownPlatformError, sys.platform
raise Error.UnknownPlatformError(sys.platform)
program = os.path.join(getBinDir(),scythername)
return program
@ -294,14 +294,18 @@ class Scyther(object):
# Apparently we are supporsed to be able to use the cache
m = hashlib.sha256()
def muppet(m, s):
m.update(s.encode('utf-8'))
if spdl == None:
m.update("[spdl:None]")
muppet(m, "[spdl:None]")
else:
m.update(spdl)
muppet(m, spdl)
if args == None:
m.update("[args:None]")
muppet(m, "[args:None]")
else:
m.update(args)
muppet(m, args)
uid = m.hexdigest()
@ -392,14 +396,13 @@ class Scyther(object):
self.guessFileNames(spdl=spdl)
# Generate temporary files for the output.
# Requires Python 2.3 though.
(fde,fne) = tempfile.mkstemp() # errors
(fdo,fno) = tempfile.mkstemp() # output
if spdl:
(fdi,fni) = tempfile.mkstemp() # input
# Write (input) file
fhi = os.fdopen(fdi,'w+b')
fhi = os.fdopen(fdi,'w+')
fhi.write(spdl)
fhi.close()
@ -495,7 +498,7 @@ class Scyther(object):
# whoohee, xml
self.validxml = True
xmlfile = StringIO.StringIO(output)
xmlfile = io.StringIO(output)
reader = XMLReader.XMLReader()
self.claims = reader.readXML(xmlfile)
@ -595,10 +598,10 @@ def FindProtocols(path="",filterProtocol=None):
Note: Unix only! Will not work under windows.
"""
import commands
import subprocess
cmd = "find %s -iname '*.spdl'" % (path)
plist = commands.getoutput(cmd).splitlines()
plist = subprocess.getoutput(cmd).splitlines()
nlist = []
for prot in plist:
if filterProtocol != None:

View File

@ -1,6 +1,6 @@
"""
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
modify it under the terms of the GNU General Public License
@ -20,8 +20,8 @@
#
# Term
#
import Trace
from Misc import *
from . import Trace
from .Misc import *
class InvalidTerm(TypeError):
"Exception used to indicate that a given term is invalid"

View File

@ -1,6 +1,6 @@
"""
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
modify it under the terms of the GNU General Public License
@ -20,7 +20,7 @@
#
# Trace
#
from Misc import *
from .Misc import *
class InvalidAction(TypeError):
"Exception used to indicate that a given action is invalid"
@ -79,7 +79,7 @@ class SemiTrace(object):
def getPrecedingEvents(self,event,previous=[]):
# If it is cached return cached version
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 = []
for prec in event.getBefore():
preceding.append(prec)
@ -90,7 +90,7 @@ class SemiTrace(object):
preceding.extend(self.getPrecedingEvents(fol))
preceding = uniq(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
# Returns -1 if the first event has to be before the second one
@ -175,7 +175,7 @@ class ProtocolDescription(object):
# Find event by label
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:
if event.label == eventlabel:
if eventType == None or isinstance(event,eventType):
@ -206,7 +206,7 @@ class ProtocolDescription(object):
# that are in the precedingEvents of a certain event
def getPrecedingLabelSet(self,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]
# Calculate the roles in preceding labelset that is all roles that
@ -219,7 +219,7 @@ class ProtocolDescription(object):
def __str__(self):
s = ''
for x in self.roledescr.values():
for x in list(self.roledescr.values()):
for e in x:
s += str(e) + "\n"
return s
@ -318,7 +318,7 @@ class EventClaim(Event):
# agents
def ignore(self):
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 False

View File

@ -1,6 +1,6 @@
"""
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
modify it under the terms of the GNU General Public License
@ -20,24 +20,13 @@
#
# 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
# Check for cElementTree presence. Otherwise use ElementTree.
useiter = True
try:
# python 2.5 has cElementTree in the core
# cElementTree is in Python since version 2.5
import xml.etree.cElementTree as cElementTree
except:
# try the old way
@ -48,7 +37,7 @@ except:
try:
from elementtree import ElementTree
except ImportError:
print """
print("""
ERROR:
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
Note that you can still use the Scyther binaries in the 'Bin' directory.
"""
""")
sys.exit(1)
## Simply pick cElementTree
@ -65,10 +54,16 @@ Note that you can still use the Scyther binaries in the 'Bin' directory.
#useiter = False
#from elementtree import ElementTree
import Term
import Attack
import Trace
import Claim
from . import Term
from . import Attack
from . import Trace
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):
@ -123,8 +118,8 @@ class XMLReader(object):
# If this is a term variable read it directly
if (xml.tag in ('tuple','const','apply','encrypt','var')):
return self.readSubTerm(xml)
# Otherwise read from it's first child
children = xml.getchildren()
# Otherwise read from its first child
children = getchildren(xml)
assert(len(children) == 1)
return self.readSubTerm(children[0])
@ -148,7 +143,7 @@ class XMLReader(object):
# value
return Term.TermVariable(name,None)
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):
label = self.readTerm(xml.find('label'))
@ -188,7 +183,7 @@ class XMLReader(object):
pass
return Trace.EventClaim(index,label,followlist,role,etype,argument)
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):
assert(xml.tag == 'run')
@ -249,7 +244,7 @@ class XMLReader(object):
def readClaim(self, xml):
claim = Claim.Claim()
for event in xml.getchildren():
for event in getchildren(xml):
if event.tag == 'claimtype':
claim.claimtype = self.readTerm(event)
elif event.tag == 'label':
@ -276,7 +271,7 @@ class XMLReader(object):
elif event.tag == 'timebound':
claim.timebound = True
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()
return claim
@ -288,7 +283,7 @@ class XMLReader(object):
# A state contains 4 direct child nodes:
# broken, system, variables and semitrace
# optionally a fifth: dot
for event in xml.getchildren():
for event in getchildren(xml):
if event.tag == 'broken':
attack.broken.append((self.readTerm(event.find('claim')),
self.readTerm(event.find('label'))))
@ -353,6 +348,6 @@ class XMLReader(object):
# this list
self.varlist = attack.variables
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

View File

@ -1,6 +1,6 @@
"""
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
modify it under the terms of the GNU General Public License
@ -22,7 +22,7 @@
#
# Set prefix for __all__
#
import Scyther
from . import Scyther
# Provide scope
__all__ = ["Scyther"]

View File

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

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
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
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,"pdf")
print "%s; %s" % (fn,cl)
print("%s; %s" % (fn,cl))
def main():

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
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
modify it under the terms of the GNU General Public License
@ -48,9 +48,9 @@ def fileandline(fn,linenos):
ln = 1
done = 0
sz = len(linenos)
for l in fp.xreadlines():
for l in fp:
if str(ln) in linenos:
print l
print(l)
scyther_json(l)
done = done + 1
if done >= sz:

View File

@ -18,7 +18,7 @@ Arguments:
def countlines(fn):
count = 0
fh = open(fn,'r')
for l in fh.xreadlines():
for l in fh:
count = count + 1
fh.close()
return count
@ -26,7 +26,7 @@ def countlines(fn):
def marker(jobcount,todo):
left = todo - jobcount
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):
@ -39,7 +39,7 @@ def main(fn,step,optlist):
jobcount = 0
done = 0
for l in fh.xreadlines():
for l in fh:
if buf == 0:
s = "bsub %s ./json-scyther.py %s" % (" ".join(optlist),fn)
s += " %i" % (ln)

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
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
modify it under the terms of the GNU General Public License
@ -36,13 +36,13 @@ class ProgressBar(object):
def start(self):
if self.widgets:
if len(self.widgets) > 0:
print self.widgets[0],
print(self.widgets[0], end=' ')
def update(self,count):
pass
def finish(self):
print " Done."
print(" Done.")
def SimpleProgress():

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""
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
modify it under the terms of the GNU General Public License
@ -23,7 +23,7 @@
# Try to get wxPython
try:
import wx
except ImportError,err:
except ImportError as err:
from Scyther import Misc
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/
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)):
import os
@ -92,8 +92,26 @@ The exact error was:
""" % (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 sys
import os
@ -139,7 +157,7 @@ def parseArgs():
#---------------------------------------------------------------------------
class MySplashScreen(wx.SplashScreen):
class MySplashScreen(WXPYTHONINFREQ.SplashScreen):
def __init__(self,basedir):
path = os.path.join(basedir,"Images")
image = os.path.join(path,"scyther-splash.png")
@ -193,7 +211,7 @@ class ScytherApp(wx.App):
# License option may abort here
if opts.license:
print Scyther.GetLicense()
print(Scyther.GetLicense())
sys.exit(0)
# Load preferences file
@ -221,8 +239,9 @@ class ScytherApp(wx.App):
return True
def OnExit(self):
""" Tear down """
#def OnExit(self):
# """ 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.
Copyright (C) 2007-2013 Cas Cremers
Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -50,8 +50,8 @@ def simpleRun(args):
if __name__ == '__main__':
pars = sys.argv[1:]
if len(pars) == 0:
print usage()
print(usage())
else:
print simpleRun(" ".join(pars))
print(simpleRun(" ".join(pars)))

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
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
modify it under the terms of the GNU General Public License
@ -48,7 +48,7 @@ TEST2 = "--max-runs=4"
#---------------------------------------------------------------------------
""" Import externals """
import commands
import subprocess
#---------------------------------------------------------------------------
@ -128,7 +128,7 @@ def findProtocols():
"""
cmd = "find -iname '*.spdl'"
plist = commands.getoutput(cmd).splitlines()
plist = subprocess.getoutput(cmd).splitlines()
nlist = []
for prot in plist:
if filterProtocol(prot):
@ -143,35 +143,35 @@ def main():
global TEST0,TEST1,TEST2
list = findProtocols()
print "Performing delta analysis"
print
print "String 0 (used for both): '%s'" % TEST0
print "String 1: '%s'" % TEST1
print "String 2: '%s'" % TEST2
print
print "After filtering, we are left with the following protocols:", list
print
print("Performing delta analysis")
print()
print("String 0 (used for both): '%s'" % TEST0)
print("String 1: '%s'" % TEST1)
print("String 2: '%s'" % TEST2)
print()
print("After filtering, we are left with the following protocols:", list)
print()
maxcount = len(list)
count = 1
delta = 0
for prot in list:
perc = (100 * count) / maxcount
print "[%i%%] %s: " % (perc,prot),
print("[%i%%] %s: " % (perc,prot), end=' ')
res = ScytherDiff(prot)
if res != None:
print
print "-" * 72
print prot
print "-" * 72
print res
print()
print("-" * 72)
print(prot)
print("-" * 72)
print(res)
delta = delta + 1
else:
print "No interesting delta found."
print("No interesting delta found.")
count = count + 1
print
print "Analysis complete."
print "%i out of %i protocols differed [%i%%]." % (delta,maxcount,(100 * delta)/maxcount)
print()
print("Analysis complete.")
print("%i out of %i protocols differed [%i%%]." % (delta,maxcount,(100 * delta)/maxcount))
if __name__ == '__main__':

View File

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

View File

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

View File

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

View File

@ -199,7 +199,7 @@ def sanitizeRole(protocol, role):
msgto = knowbefore[i]
if msgfrom != msgto:
### 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
# just the next one?
for j in range(n+1, len(rules)):
@ -237,7 +237,7 @@ def sanitizeRole(protocol, role):
replacelist.append( (t,msg) )
role.constants.append(msg)
### TEST
print "Substituting %s by %s" % (str(t), str(msg))
print("Substituting %s by %s" % (str(t), str(msg)))
# Apply replacelist
if len(replacelist) > 0:
for ev in role.events:
@ -280,7 +280,7 @@ def extractRoles(protocol):
# hrule has been picked. Work back from here
# first make up a name
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"
actor = None
else:
@ -316,7 +316,7 @@ def extractRoles(protocol):
# Loop detection
if rule in role.rules:
# 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
else:
# No loop, prepend

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@
# Todo:
# - add pprint() - pretty-print output of defined BNF
#
from __future__ import generators
__doc__ = \
"""
@ -79,13 +79,13 @@ def _ustr(obj):
# it won't break any existing code.
return str(obj)
except UnicodeEncodeError, e:
except UnicodeEncodeError as e:
# 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
# unicode object (being a subclass of basestring) count as a "string
# object"?
# If so, then return a unicode object:
return unicode(obj)
return str(obj)
# Else encode it... but how? There are many choices... :)
# Replace unprintables with escape codes?
#return unicode(obj).encode(sys.getdefaultencoding(), 'backslashreplace_errors')
@ -125,7 +125,7 @@ class ParseBaseException(Exception):
elif( aname == "line" ):
return line( self.loc, self.pstr )
else:
raise AttributeError, aname
raise AttributeError(aname)
def __str__( self ):
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
self.__name = name
if toklist:
if isinstance(toklist,basestring):
if isinstance(toklist,str):
toklist = [ toklist ]
if asList:
if isinstance(toklist,ParseResults):
@ -235,25 +235,25 @@ class ParseResults(object):
del self.__toklist[i]
def __contains__( self, k ):
return self.__tokdict.has_key(k)
return k in self.__tokdict
def __len__( self ): return len( self.__toklist )
def __iter__( self ): return iter( self.__toklist )
def keys( self ):
"""Returns all named result keys."""
return self.__tokdict.keys()
return list(self.__tokdict.keys())
def items( self ):
"""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 ):
"""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 ):
if name not in self.__slots__:
if self.__tokdict.has_key( name ):
if name in self.__tokdict:
if self.__modal:
return self.__tokdict[name][-1][0]
else:
@ -266,7 +266,7 @@ class ParseResults(object):
if other.__tokdict:
offset = len(self.__toklist)
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:
self[k] = v
if isinstance(v[0],ParseResults):
@ -313,7 +313,7 @@ class ParseResults(object):
def asDict( self ):
"""Returns the named parse results as dictionary."""
return dict( self.items() )
return dict( list(self.items()) )
def copy( self ):
"""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."""
nl = "\n"
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 + " "
# collapse out indents if formatting is not desired
@ -376,7 +376,7 @@ class ParseResults(object):
def __lookup(self,sub):
for k,vlist in self.__tokdict.items():
for k,vlist in list(self.__tokdict.items()):
for v,loc in vlist:
if sub is v:
return k
@ -394,8 +394,8 @@ class ParseResults(object):
return None
elif (len(self) == 1 and
len(self.__tokdict) == 1 and
self.__tokdict.values()[0][0][1] in (0,-1)):
return self.__tokdict.keys()[0]
list(self.__tokdict.values())[0][0][1] in (0,-1)):
return list(self.__tokdict.keys())[0]
else:
return None
@ -423,13 +423,13 @@ def line( loc, strg ):
return strg[lastCR+1:]
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 ):
print "Matched",expr,"->",toks.asList()
print("Matched",expr,"->",toks.asList())
def _defaultExceptionDebugAction( instring, loc, expr, exc ):
print "Exception raised:", exc
print("Exception raised:", exc)
def nullDebugAction(*args):
"""'Do-nothing' debug action, to suppress debugging output during parsing."""
@ -547,8 +547,8 @@ class ParserElement(object):
try:
loc,tokens = self.parseImpl( instring, loc, doActions )
except IndexError:
raise ParseException, ( instring, len(instring), self.errmsg, self )
except ParseException, err:
raise ParseException( instring, len(instring), self.errmsg, self)
except ParseException as err:
#~ print "Exception raised:", err
if (self.debugActions[2] ):
self.debugActions[2]( instring, tokensStart, self, err )
@ -561,7 +561,7 @@ class ParserElement(object):
try:
loc,tokens = self.parseImpl( instring, loc, doActions )
except IndexError:
raise ParseException, ( instring, len(instring), self.errmsg, self )
raise ParseException( instring, len(instring), self.errmsg, self)
else:
loc,tokens = self.parseImpl( instring, loc, doActions )
@ -579,7 +579,7 @@ class ParserElement(object):
self.resultsName,
asList=self.saveAsList and isinstance(tokens,(ParseResults,list)),
modal=self.modalResults )
except ParseException, err:
except ParseException as err:
#~ print "Exception raised in user parse action:", err
if (self.debugActions[2] ):
self.debugActions[2]( instring, tokensStart, self, err )
@ -670,49 +670,49 @@ class ParserElement(object):
def __add__(self, other ):
"""Implementation of + operator - returns And"""
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return And( [ self, other ] )
def __radd__(self, other ):
"""Implementation of += operator"""
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return other + self
def __or__(self, other ):
"""Implementation of | operator - returns MatchFirst"""
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return MatchFirst( [ self, other ] )
def __ror__(self, other ):
"""Implementation of |= operator"""
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return other | self
def __xor__(self, other ):
"""Implementation of ^ operator - returns Or"""
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return Or( [ self, other ] )
def __rxor__(self, other ):
"""Implementation of ^= operator"""
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return other ^ self
def __and__(self, other ):
"""Implementation of & operator - returns Each"""
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return Each( [ self, other ] )
def __rand__(self, other ):
"""Implementation of right-& operator"""
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return other & self
@ -985,7 +985,7 @@ class Word(Token):
if max > 0:
self.maxLen = max
else:
self.maxLen = sys.maxint
self.maxLen = sys.maxsize
if exact > 0:
self.maxLen = exact
@ -1064,7 +1064,7 @@ class CharsNotIn(Token):
if max > 0:
self.maxLen = max
else:
self.maxLen = sys.maxint
self.maxLen = sys.maxsize
if exact > 0:
self.maxLen = exact
@ -1143,7 +1143,7 @@ class White(Token):
if max > 0:
self.maxLen = max
else:
self.maxLen = sys.maxint
self.maxLen = sys.maxsize
if exact > 0:
self.maxLen = exact
@ -1197,7 +1197,7 @@ class GoToColumn(PositionToken):
def parseImpl( self, instring, loc, doActions=True ):
thiscol = col( loc, instring )
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
ret = instring[ loc: newloc ]
return newloc, ret
@ -1287,7 +1287,7 @@ class ParseExpression(ParserElement):
super(ParseExpression,self).__init__(savelist)
if isinstance( exprs, list ):
self.exprs = exprs
elif isinstance( exprs, basestring ):
elif isinstance( exprs, str ):
self.exprs = [ Literal( exprs ) ]
else:
self.exprs = [ exprs ]
@ -1390,12 +1390,12 @@ class And(ParseExpression):
loc, resultlist = self.exprs[0].parse( instring, loc, doActions )
for e in self.exprs[1:]:
loc, exprtokens = e.parse( instring, loc, doActions )
if exprtokens or exprtokens.keys():
if exprtokens or list(exprtokens.keys()):
resultlist += exprtokens
return loc, resultlist
def __iadd__(self, other ):
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return self.append( other ) #And( [ self, other ] )
@ -1435,11 +1435,11 @@ class Or(ParseExpression):
for e in self.exprs:
try:
loc2 = e.tryParse( instring, loc )
except ParseException, err:
except ParseException as err:
if err.loc > maxExcLoc:
maxException = err
maxExcLoc = err.loc
except IndexError, err:
except IndexError as err:
if len(instring) > maxExcLoc:
maxException = ParseException(instring,len(instring),e.errmsg,self)
maxExcLoc = len(instring)
@ -1454,7 +1454,7 @@ class Or(ParseExpression):
return maxMatchExp.parse( instring, loc, doActions )
def __ixor__(self, other ):
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return self.append( other ) #Or( [ self, other ] )
@ -1492,11 +1492,11 @@ class MatchFirst(ParseExpression):
try:
ret = e.parse( instring, loc, doActions )
return ret
except ParseException, err:
except ParseException as err:
if err.loc > maxExcLoc:
maxException = err
maxExcLoc = err.loc
except IndexError, err:
except IndexError as err:
if len(instring) > maxExcLoc:
maxException = ParseException(instring,len(instring),e.errmsg,self)
maxExcLoc = len(instring)
@ -1506,7 +1506,7 @@ class MatchFirst(ParseExpression):
raise maxException
def __ior__(self, other ):
if isinstance( other, basestring ):
if isinstance( other, str ):
other = Literal( other )
return self.append( other ) #MatchFirst( [ self, other ] )
@ -1580,13 +1580,13 @@ class Each(ParseExpression):
finalResults = ParseResults([])
for r in resultlist:
dups = {}
for k in r.keys():
if k in finalResults.keys():
for k in list(r.keys()):
if k in list(finalResults.keys()):
tmp = ParseResults(finalResults[k])
tmp += ParseResults(r[k])
dups[k] = tmp
finalResults += ParseResults(r)
for k,v in dups.items():
for k,v in list(dups.items()):
finalResults[k] = v
return loc, finalResults
@ -1609,7 +1609,7 @@ class ParseElementEnhance(ParserElement):
"""Abstract subclass of ParserElement, for combining and post-processing parsed tokens."""
def __init__( self, expr, savelist=False ):
super(ParseElementEnhance,self).__init__(savelist)
if isinstance( expr, basestring ):
if isinstance( expr, str ):
expr = Literal(expr)
self.expr = expr
self.strRepr = None
@ -1739,7 +1739,7 @@ class ZeroOrMore(ParseElementEnhance):
if hasIgnoreExprs:
loc = self.skipIgnorables( instring, loc )
loc, tmptokens = self.expr.parse( instring, loc, doActions )
if tmptokens or tmptokens.keys():
if tmptokens or list(tmptokens.keys()):
tokens += tmptokens
except (ParseException,IndexError):
pass
@ -1772,7 +1772,7 @@ class OneOrMore(ParseElementEnhance):
if hasIgnoreExprs:
loc = self.skipIgnorables( instring, loc )
loc, tmptokens = self.expr.parse( instring, loc, doActions )
if tmptokens or tmptokens.keys():
if tmptokens or list(tmptokens.keys()):
tokens += tmptokens
except (ParseException,IndexError):
pass
@ -1928,7 +1928,7 @@ class Upcase(TokenConverter):
DeprecationWarning,stacklevel=2)
def postParse( self, instring, loc, tokenlist ):
return map( string.upper, tokenlist )
return list(map( string.upper, tokenlist ))
class Combine(TokenConverter):
@ -1957,7 +1957,7 @@ class Combine(TokenConverter):
del retToks[:]
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 ]
else:
return retToks
@ -1991,7 +1991,7 @@ class Dict(TokenConverter):
else:
dictvalue = tok.copy() #ParseResults(i)
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)
else:
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])
_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)))
_escapedOctChar = Combine( Suppress(_bslash) + Word("0","01234567") ).setParseAction(lambda s,l,t:unichr(int(t[0],8)))
_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:chr(int(t[0],8)))
_singleChar = _escapedPunc | _escapedHexChar | _escapedOctChar | Word(_printables_less_backslash,exact=1)
_charRange = Group(_singleChar + Suppress("-") + _singleChar)
_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):
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):
"""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):
"""Helper parse action to convert tokens to lower case."""
return map( str.lower, t )
return list(map( str.lower, t ))
def _makeTags(tagStr, xml):
"""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__":
def test( teststring ):
print teststring,"->",
print(teststring,"->", end=' ')
try:
tokens = simpleSQL.parseString( teststring )
tokenlist = tokens.asList()
print tokenlist
print "tokens = ", tokens
print "tokens.columns =", tokens.columns
print "tokens.tables =", tokens.tables
print tokens.asXML("SQL",True)
except ParseException, err:
print err.line
print " "*(err.column-1) + "^"
print err
print
print(tokenlist)
print("tokens = ", tokens)
print("tokens.columns =", tokens.columns)
print("tokens.tables =", tokens.tables)
print(tokens.asXML("SQL",True))
except ParseException as err:
print(err.line)
print(" "*(err.column-1) + "^")
print(err)
print()
selectToken = CaselessLiteral( "select" )
fromToken = CaselessLiteral( "from" )

View File

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

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* 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.
Copyright (C) 2007-2013 Cas Cremers
Copyright (C) 2007-2020 Cas Cremers
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -48,6 +48,6 @@ def getDescription():
if __name__ == '__main__':
tag = getDescription()
writeTag(tag)
print tag
print(tag)

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

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

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,6 @@
/*
* 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
* modify it under the terms of the GNU General Public License

View File

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

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