刘功瑞的博客

有一天你突然惊醒,发现这一切,都只不过是一场梦。

攻防世界 XCTF Reverse debug Writeup

image.png

使用ida打开发现无法反编译

image.png

image.png

提示是.net平台,使用ILSpy进行反编译,可以看到算法,由于没有安装vc环境,使用python来改写。

image.png

import hashlib


def func(A_0, A_1):
    arr = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103,
           107, 109, 113]
    return arr[A_1] ^ A_0


a1 = "CreateByTenshine"
num = 0
A_2 = ''
if 0 < len(a1):
    while num < len(a1):
        c = a1[num]
        num2 = 1
        while num2 < 15:
            c = chr(func(ord(c), num2))
            num2 += 1
        A_2 += c
        num += 1

A_2 = hashlib.md5(A_2).hexdigest()
print "flag{" + A_2.upper() + "}"
#flag{967DDDFBCD32C1F53527C221D9E40A0B}


发表评论:

Powered By Z-BlogPHP 1.5.2 Zero

Copyright www.liugongrui.com.All Rights Reserved.