首页 > 编程语言 > 详细

Reverse——python-trade

时间:2020-01-03 21:57:19      阅读:90      评论:0      收藏:0      [点我收藏+]

XCTF的新手逆向题

题目是pyc的后缀,反编译得到python源码

#!/usr/bin/env python
# encoding: utf-8

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

#!/usr/bin/env python
# encoding: utf-8

import base64

correct = ‘XlNkVmtUI1MgXWBZXCFeKY+AaXNt‘
def decode(message):
    s=‘‘
    for i in message:
        x=ord(i)
        x=x-16
        x=x^32
        s+=chr(x)
    return s

print decode(base64.b64decode(correct))

Reverse——python-trade

原文:https://www.cnblogs.com/luocodes/p/12146997.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!