elrond32
elrond32
一、查壳
无壳,32位
二、IDA分析
1.main
2.sub_8048538
要知道v2值,即unk_8048760
可以看出有效值之间间隔3个0,所以写代码,得出真正的值
char = [
15, 0, 0, 0, 31, 0, 0, 0, 4, 0,
0, 0, 9, 0, 0, 0, 28, 0, 0, 0,
18, 0, 0, 0, 66, 0, 0, 0, 9, 0,
0, 0, 12, 0, 0, 0, 68, 0, 0, 0,
13, 0, 0, 0, 7, 0, 0, 0, 9, 0,
0, 0, 6, 0, 0, 0, 45, 0, 0, 0,
55, 0, 0, 0, 89, 0, 0, 0, 30, 0,
0, 0, 0, 0, 0, 0, 89, 0, 0, 0,
15, 0, 0, 0, 8, 0, 0, 0, 28, 0,
0, 0, 35, 0, 0, 0, 54, 0, 0, 0,
7, 0, 0, 0, 85, 0, 0, 0, 2, 0,
0, 0, 12, 0, 0, 0, 8, 0, 0, 0,
65, 0, 0, 0, 10, 0, 0, 0, 20, 0,
0, 0
] #Shife+E提取数据
result = []
for i in range(0, len(char), 4):
result.append(f"{char[i]},")
print(' '.join(result))
---------------------------------------------------------
15, 31, 4, 9, 28, 18, 66, 9, 12, 68, 13, 7, 9, 6, 45, 55, 89, 30, 0, 89, 15, 8, 28, 35, 54, 7, 85, 2, 12, 8, 65, 10, 20,
3.sub_8048414
发现是一个循环。sub_8048414(a1 + 1, 7 * (a2 + 1) % 11),这条语句会让a2 = 7*(a2+1)%11。另外,在case中少了2、8和10,也就是说,当a2值为2、8、10时,返回值即为1.所以a2没有2、8、10的值
由绿色框框对应的a1
可以发现是个递归,模拟一下得到a2(main中的是a2,这里代表a1)是105,115,101,110,103,97,114,100
所以sub_8048538里全了
三、写脚本
chars =[
15, 31, 4, 9, 28, 18, 66, 9, 12, 68, 13, 7, 9, 6, 45,
55, 89, 30, 0, 89, 15, 8,28, 35,54,7, 85,2, 12, 8,
65, 10, 20
]
a2 = [0,7,1,3,6,5,9,4,2]
a1 = [105,115,101,110,103,97,114,100]
flag = ""
for i in range(len(chars)):
flag += chr( chars[i] ^ (a1[i%8]) )
print(flag)
-----------------------------------------------------
flag{s0me7hing_S0me7hinG_t0lki3n}