CTF_python-trade
下载得到一个pyc文件,随便找一个python在线反编译网站,把pyc放进去:
def encode(message):
s = ''
for i in message:
x = ord(i) ^ 32
x = x + 16
s += chr(x)
return base64.b64encode(s)
correct = 'XlNkVmtUI1MgXWBZXCFeKY+AaXNt'
flag = ''
print 'Input flag:'
flag = raw_input()
if encode(flag) == correct:
print 'correct'
else:
print 'wrong'
得到代码之后,就可以写解密脚本了:
import base64
s='XlNkVmtUI1MgXWBZXCFeKY+AaXNt'
str=base64.b64decode(s)
flag=''
for i in str:
i-=16
i^=32
flag+=chr(i)
print(flag)
最后运行就可以了: