1.下载附件,得到的是pyc文件,在网上搜索python反编译在线网站即可,打开得到代码
# uncompyle6 version 3.5.0
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.5 (default, Nov 16 2020, 22:23:17)
# [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
# Embedded file name: encode.py
# Compiled at: 2019-08-19 21:01:57
print 'Welcome to Re World!'
print 'Your input1 is your flag~'
l = len(input1)
for i in range(l):
num = ((input1[i] + i) % 128 + 128) % 128
code += num
for i in range(l - 1):
code[i] = code[i] ^ code[(i + 1)]
print code
code = ['\x1f', '\x12', '\x1d', '(', '0', '4', '\x01', '\x06', '\x14', '4', ',', '\x1b', 'U', '?', 'o', '6', '*', ':', '\x01', 'D', ';', '%', '\x13']
这里我推荐使用这个。
python反编译 - 在线工具 ,这个有时间限制,可能还编译错误,跟其他编译不同。
pyc文件是从什么格式转化过来的:
pyc文件就是由Python文件经过编译后所生成的文件,py文件编译成pyc文件后加载速度更快而且提高了代码的安全性,是一个二进制文件,源代码其实是py格式的文件。
看到这种计算,反着过来即可
2.脚本:
print('Welcome to Re World!')
print('Your input1 is your flag~')
code = ['\x1f', '\x12', '\x1d', '(', '0', '4', '\x01', '\x06', '\x14', '4', ',', '\x1b', 'U', '?', 'o', '6', '*', ':', '\x01', 'D', ';', '%', '\x13']
l = len(code)
print(l)
flag=''
for i in range(l-2,-1,-1):
code[i] = chr(ord(code[i]) ^ ord(code[i + 1]))
for i in range(l):
flag+=chr((ord(code[i])-i)%128)
print(flag)
flag{Just_Re_1s_Ha66y!}