pyc逆向工程
使用uncompyle2工具进行pyc反编译
工具链接
查看反编译出来的源代码
#Embedded file name: ans.py
import base64
def encode1(ans):
s = ''
for i in ans:
x = ord(i) ^ 36
x = x + 25
s += chr(x)
return s
def encode2(ans):
s = ''
for i in ans:
x = ord(i) + 36
x = x ^ 36
s += chr(x)
return s
def encode3(ans):
return base64.b32encode(ans)
flag = ' '
print 'Please Input your flag:'
flag = raw_input()
final = 'UC7KOWVXWVNKNIC2XCXKHKK2W5NLBKNOUOSK3LNNVWW3E==='
if encode3(encode2(encode1(flag))) == final:
print 'correct'
else:
print 'wrong'
解密脚本:
import base64
def decode1(ans):
s=''
for i in ans:
x=ord(i)
x=x-25
x=x^36
s+=chr(x)
return s
def decode2(ans):
s=''
for i in ans:
x=ord(i)
x=x^36
x=x-36
s+=chr(x)
return s
def decode3(ans):
a=base64.b32decode(ans)
return a
print decode1(decode2(decode3('UC7KOWVXWVNKNIC2XCXKHKK2W5NLBKNOUOSK3LNNVWW3E===')))
执行结果