BUUCTF-[GWCTF 2019]pyre

26 篇文章 1 订阅

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']

这里我推荐使用这个。 

 pyc反编译 - 爱资料工具

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!}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值