我正在尝试使用zlib解码大型编码/压缩文件,但它正在抛出SyntaxError:语法无效
import zlib
import marshal
import new
import sys
import base64
import time
import tty
import termios
a0_func = 'YwEAAAAJAAAABAAAAAMAAABzHAEAAGQBAH0BAHQAAGoAAIMAAH0CAHQBAGoCAGoDAIMAAH0DAHQEAGoFAHwDAIMBAH0EAHQGAGoHAHQBAGoCAGoDAIMAAIMBAAF0CAB0AQBqAgBqCQBkAgCDAQCDAQCJAAB0BABqCgB8AwB0BABqCwB8BACDAwABZAMAagwAdA0AhwAAZgEAZAQAhgAAfAAAgwIAgwEAfQUAdAAAagAAgwAAfQYAfAYAfAIAGGQFAGsEAHLVAGQDAGoMAHQNAIcAAGYBAGQGAIYAAHwAAIMCAIMBAH0FAG4AAHwFAGoOAHwBAIMBAH0HAHQPAHwHAIMBAGQCAGsCAHIKAWQHAH0IAHwHAGQIABl8CABmAgBTfAcAZAgAGXwHAGQCABlmAgBTKAkAAABOcwMAAAA6UjppAQAAAHQAAAAAYwEAAAABAAAAAwAAABMAAABzFAAAAHQAAHQBAHwAAIMBAIgAAEGDAQBTKAEAAABOKAIAAAB0AwAAAGNocnQDAAAAb3JkKAEAAAB0AQAAAHgoAQAAAHQKAAAAcGFzc3BocmFzZSgAAAAAcw8AAABydXNzaWFuX2RvbGwucHl0CAAAADxsYW1iZGE+KgAAAHMAAAAAaQQAAABjAQAAAAEAAAAEAAAAEwAAAHMYAAAAdAAAdAEAfAAAgwEAiAAAZAEAF0GDAQBTKAIAAABOaQEAAAAoAgAAAFIBAAAAUgIAAAAoAQAAAFIDAAAAKAEAAABSBAAAACgAAAAAcw8AAABydXNzaWFuX2RvbGwucHlSBQAAAC0AAABzAAAAAHQIAAAAZmluaXNoZWRpAAAAACgQAAAAdAQAAAB0aW1ldAMAAABzeXN0BQAAAHN0ZGludAYAAABmaWxlbm90BwAAAHRlcm1pb3N0CQAAAHRjZ2V0YXR0cnQDAAAAdHR5dAYAAABzZXRyYXdSAgAAAHQEAAAAcmVhZHQJAAAAdGNzZXRhdHRydAkAAABUQ1NBRFJBSU50BAAAAGpvaW50AwAAAG1hcHQFAAAAc3BsaXR0AwAAAGxlbigJAAAAdAcAAABtZXNzYWdldAwAAABzcGxpdF9zdHJpbmd0AgAAAHQwdAIAAABmZHQMAAAAb2xkX3NldHRpbmdzdAMAAAByZXN0AgAAAHQxUgMAAAB0AQAAAF8oAAAAACgBAAAAUgQAAABzDwAAAHJ1c3NpYW5fZG9sbC5weXQKAAAAYXNrZGVjcnlwdB8AAABzIAAAAAABBgIMAQ8BDwEWARgCFgIhAQwBEAEkAQ8BEgEGAQ4B'
with open('compress.txt','r') as f:
compressed = f.read()
x = marshal.loads(base64.b64decode(a0_func))
x_func = new.function(x, {'ord':ord, 'sys':sys,
'map':map, 'chr':chr,
'time':time, 'tty':tty,
'termios':termios,
'len':len,
})
x = zlib.decompress(base64.b64decode(compressed))
exec x
compress.txt的大小约为2mb。执行时我收到以下错误。
Traceback (most recent call last):
File "decode.py", line 25, in <module>
exec x
File "<string>", line 16
SyntaxError: invalid syntax
我对此非常新手,任何线索都将受到赞赏。感谢