Further Python3 fixes.
This commit is contained in:
parent
3a6041ccac
commit
38a0fba212
@ -53,7 +53,7 @@ def writeGraph(attackthread,txt,fp):
|
|||||||
ALL = 3
|
ALL = 3
|
||||||
|
|
||||||
def graphLine(txt):
|
def graphLine(txt):
|
||||||
fp.write("\t%s;\n" % (txt))
|
fp.write(("\t%s;\n" % (txt)).encode('utf-8'))
|
||||||
|
|
||||||
def setAttr(atxt,EdgeNodeDefAll=ALL):
|
def setAttr(atxt,EdgeNodeDefAll=ALL):
|
||||||
if EdgeNodeDefAll == ALL:
|
if EdgeNodeDefAll == ALL:
|
||||||
@ -81,7 +81,7 @@ def writeGraph(attackthread,txt,fp):
|
|||||||
|
|
||||||
# write all graph lines but add layout modifiers
|
# write all graph lines but add layout modifiers
|
||||||
for l in txt.splitlines():
|
for l in txt.splitlines():
|
||||||
fp.write(l)
|
fp.write(l.encode('utf-8'))
|
||||||
if l.startswith("digraph"):
|
if l.startswith("digraph"):
|
||||||
# Write additional stuff for this graph
|
# Write additional stuff for this graph
|
||||||
#
|
#
|
||||||
@ -147,7 +147,7 @@ def makeImageDot(dotdata,attackthread=None):
|
|||||||
p.stdin.close()
|
p.stdin.close()
|
||||||
|
|
||||||
for l in p.stdout.read():
|
for l in p.stdout.read():
|
||||||
f.write(l)
|
f.write(str(l))
|
||||||
|
|
||||||
p.stdout.close()
|
p.stdout.close()
|
||||||
f.flush()
|
f.flush()
|
||||||
|
@ -41,8 +41,9 @@ def testDot(fpath):
|
|||||||
try:
|
try:
|
||||||
cmd = "%s -V" % (fpath)
|
cmd = "%s -V" % (fpath)
|
||||||
(sts,sout,serr) = Misc.safeCommandOutput(cmd)
|
(sts,sout,serr) = Misc.safeCommandOutput(cmd)
|
||||||
|
|
||||||
if sts != -1:
|
if sts != -1:
|
||||||
if "version" in sout + serr:
|
if "version" in str(sout) + str(serr):
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -294,14 +294,18 @@ class Scyther(object):
|
|||||||
|
|
||||||
# Apparently we are supporsed to be able to use the cache
|
# Apparently we are supporsed to be able to use the cache
|
||||||
m = hashlib.sha256()
|
m = hashlib.sha256()
|
||||||
|
|
||||||
|
def muppet(m, s):
|
||||||
|
m.update(s.encode('utf-8'))
|
||||||
|
|
||||||
if spdl == None:
|
if spdl == None:
|
||||||
m.update("[spdl:None]")
|
muppet(m, "[spdl:None]")
|
||||||
else:
|
else:
|
||||||
m.update(spdl)
|
muppet(m, spdl)
|
||||||
if args == None:
|
if args == None:
|
||||||
m.update("[args:None]")
|
muppet(m, "[args:None]")
|
||||||
else:
|
else:
|
||||||
m.update(args)
|
muppet(m, args)
|
||||||
|
|
||||||
uid = m.hexdigest()
|
uid = m.hexdigest()
|
||||||
|
|
||||||
@ -399,7 +403,7 @@ class Scyther(object):
|
|||||||
(fdi,fni) = tempfile.mkstemp() # input
|
(fdi,fni) = tempfile.mkstemp() # input
|
||||||
|
|
||||||
# Write (input) file
|
# Write (input) file
|
||||||
fhi = os.fdopen(fdi,'w+b')
|
fhi = os.fdopen(fdi,'w+')
|
||||||
fhi.write(spdl)
|
fhi.write(spdl)
|
||||||
fhi.close()
|
fhi.close()
|
||||||
|
|
||||||
@ -495,7 +499,7 @@ class Scyther(object):
|
|||||||
# whoohee, xml
|
# whoohee, xml
|
||||||
self.validxml = True
|
self.validxml = True
|
||||||
|
|
||||||
xmlfile = StringIO.StringIO(output)
|
xmlfile = io.StringIO(output)
|
||||||
reader = XMLReader.XMLReader()
|
reader = XMLReader.XMLReader()
|
||||||
self.claims = reader.readXML(xmlfile)
|
self.claims = reader.readXML(xmlfile)
|
||||||
|
|
||||||
@ -595,10 +599,10 @@ def FindProtocols(path="",filterProtocol=None):
|
|||||||
Note: Unix only! Will not work under windows.
|
Note: Unix only! Will not work under windows.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import commands
|
import subprocess
|
||||||
|
|
||||||
cmd = "find %s -iname '*.spdl'" % (path)
|
cmd = "find %s -iname '*.spdl'" % (path)
|
||||||
plist = commands.getoutput(cmd).splitlines()
|
plist = subprocess.getoutput(cmd).splitlines()
|
||||||
nlist = []
|
nlist = []
|
||||||
for prot in plist:
|
for prot in plist:
|
||||||
if filterProtocol != None:
|
if filterProtocol != None:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Scyther : An automatic verifier for security protocols.
|
Scyther : An automatic verifier for security protocols.
|
||||||
Copyright (C) 2007-2013 Cas Cremers
|
Copyright (C) 2007-2013 Cas Cremers
|
||||||
@ -193,7 +193,7 @@ class ScytherApp(wx.App):
|
|||||||
|
|
||||||
# License option may abort here
|
# License option may abort here
|
||||||
if opts.license:
|
if opts.license:
|
||||||
print Scyther.GetLicense()
|
print(Scyther.GetLicense())
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# Load preferences file
|
# Load preferences file
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
Scyther : An automatic verifier for security protocols.
|
Scyther : An automatic verifier for security protocols.
|
||||||
Copyright (C) 2007-2013 Cas Cremers
|
Copyright (C) 2007-2013 Cas Cremers
|
||||||
|
Loading…
Reference in New Issue
Block a user