首页 > 代码库 > [Reversing.kr] Easy_KeygenMe Writeup

[Reversing.kr] Easy_KeygenMe Writeup

IDA打开。Main()函数就是关键算法

技术分享

 

v6,v7,v8 是连续的 。可看成 L=[16,32,48]输入的name每位分别于L[]异或 得到的值存在v13。然后清空v9的值 ,输入Serial储存v9  再让v13v9比较。

可还原算法:

#!usr/bin/env python
#!coding=utf-8

__author__ = ‘zhengjim‘

name = raw_input()
L=[16,32,48]
flag =‘‘
for i,name in enumerate(name):
    f = hex(ord(name)^L[i%3]).replace(‘0x‘,‘‘)
    flag+=f
print flag.upper()

暴力破解代码:

#!usr/bin/env python
#!coding=utf-8

__author__ = ‘zhengjim‘

S = [0x5B,0x13,0x49,0x77,0x13,0x5E,0x7D,0x13]
L=[16,32,48]
flag =‘‘
for i,s in enumerate(S):
    for f in xrange(127):
        if f^L[i%3] == s:
            flag+=chr(f)
            break
print flag

 

[Reversing.kr] Easy_KeygenMe Writeup