Further Python3 fixes.
This commit is contained in:
parent
3a6041ccac
commit
38a0fba212
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user