9.6 BUUCTF [GWCTF 2019]pyre
pyc文件用https://tool.lu/pyc/ 打开
然后分析源码
直接通过最后计算出的 code[] 反向即可
注意 要将 "%lf"这种转成 "\x1f"才能让python转义为字符
所以处理后的code[]:
code = [
'\x1f','\x12','\x1d','(','0','4','\x01','\x06','\x14',
'4',',','\x1b','U','?','o','6','*',':','\x01','D',';','%','\x13']
还有一个点 枚举ascii时 1~123的范围不够 会漏掉 '{' 所以循环上届开大点
if __name__ == '__main__':
code = [
'\x1f','\x12','\x1d','(','0','4','\x01','\x06','\x14',
'4',',','\x1b','U','?','o','6','*',':','\x01','D',';','%','\x13']
l = len(code)
for j in range(l-1):
# print(j)
i = l-2-j
# print(i)
code[i] = chr(ord(code[i])^ord(code[i+1]))
flag=""
for i in range(l):
for k in range(1,178):
if ord(code[i])==(((k+i)%128)+128)%128:
flag += chr(k)
break
print(flag)
最后flag: