其他分享
首页 > 其他分享> > BUUCTF_Re_[GWCTF 2019]pyre

BUUCTF_Re_[GWCTF 2019]pyre

作者:互联网

pyc文件使用Easy Python Decompiler v1.3.2反汇编得到源代码

:

# Embedded file name: encode.py
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']

其中一句:num = ((input1[i] + i) % 128 + 128) % 128

可以等于:num = (input[i]+i)%128

然后再进行异或

脚本:

s=['\x1f',
 '\x12',
 '\x1d',
 '(',
 '0',
 '4',
 '\x01',
 '\x06',
 '\x14',
 '4',
 ',',
 '\x1b',
 'U',
 '?',
 'o',
 '6',
 '*',
 ':',
 '\x01',
 'D',
 ';',
 '%',
 '\x13']
flag=''
for i in range(len(s)-2,-1,-1):
    s[i]=chr(ord(s[i])^ord(s[i+1]))
for i in range(len(s)):
    print(chr((ord(s[i])-i)%128),end='')

flag
GWHT{Just_Re_1s_Ha66y!}

标签:code,BUUCTF,print,range,Re,GWCTF,input1,128,x01
来源: https://www.cnblogs.com/1ucky/p/16122569.html