diff --git a/gui/Gui/Makeimage.py b/gui/Gui/Makeimage.py index b0c30e7..e641429 100644 --- a/gui/Gui/Makeimage.py +++ b/gui/Gui/Makeimage.py @@ -53,7 +53,7 @@ def writeGraph(attackthread,txt,fp): ALL = 3 def graphLine(txt): - fp.write("\t%s;\n" % (txt)) + fp.write(("\t%s;\n" % (txt)).encode('utf-8')) def setAttr(atxt,EdgeNodeDefAll=ALL): if EdgeNodeDefAll == ALL: @@ -81,7 +81,7 @@ def writeGraph(attackthread,txt,fp): # write all graph lines but add layout modifiers for l in txt.splitlines(): - fp.write(l) + fp.write(l.encode('utf-8')) if l.startswith("digraph"): # Write additional stuff for this graph # @@ -147,7 +147,7 @@ def makeImageDot(dotdata,attackthread=None): p.stdin.close() for l in p.stdout.read(): - f.write(l) + f.write(str(l)) p.stdout.close() f.flush() diff --git a/gui/Scyther/FindDot.py b/gui/Scyther/FindDot.py index 116f8dd..077326c 100644 --- a/gui/Scyther/FindDot.py +++ b/gui/Scyther/FindDot.py @@ -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 diff --git a/gui/Scyther/Scyther.py b/gui/Scyther/Scyther.py index ad173ae..ba88f74 100755 --- a/gui/Scyther/Scyther.py +++ b/gui/Scyther/Scyther.py @@ -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() @@ -399,7 +403,7 @@ class Scyther(object): (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 +499,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 +599,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: diff --git a/gui/scyther-gui.py b/gui/scyther-gui.py index e558bf3..863f35b 100755 --- a/gui/scyther-gui.py +++ b/gui/scyther-gui.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ Scyther : An automatic verifier for security protocols. Copyright (C) 2007-2013 Cas Cremers @@ -193,7 +193,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 diff --git a/gui/scyther.py b/gui/scyther.py index 4b39568..41b39f9 100755 --- a/gui/scyther.py +++ b/gui/scyther.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Scyther : An automatic verifier for security protocols. Copyright (C) 2007-2013 Cas Cremers