pyc文件,用在线pyc反编译工具pyc反编译

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import base64

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'

flag值经过encode函数,返回值为base64加密
写脚本先base64解密

1
2
3
4
5
import base64
s='XlNkVmtUI1MgXWBZXCFeKY+AaXNt'
s=base64.b64decode(s)
print(s)

1
b'^SdVkT#S ]`Y\\!^)\x8f\x80ism'

逆向脚本

1
2
3
4
5
6
7
8
s="b'^SdVkT#S ]`Y\\!^)\x8f\x80ism'"
flag = ''
for i in s:
x = ord(i) - 16
x = x ^ 32
flag += chr(x)
print(flag)

1
nctf{d3c0mpil1n9_PyC}