Hgame week1里面应该说是最难的一个题。
主函数点进去之后会发现一个函数来判断输入的是不是flag。点进去内容如下:
发现ptr数组存的是输入字符串转化为ascii码之后每个字符的前4位,v7则是后4位,这里的位是二进制位。
然后分别将两个dword_6021xx数组找出来,点进生成v8v9的函数就可以把flag对应的每个字符的高低位算出来了。
其中v9生成函数比较容易求出v9,v8生成函数要求出v8本质上是解一个线性非齐次方程,这一点比较难想。
然后写如下代码,即可跑出flag
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int UKNOW[]={8,1,7,1,1,0,4,8,1,2,3,9,3,8,6,6,4,8,
3,5,7,8,8,7,0,9,0,2,3,4,2,3,2,5,4,0};
int DW_1[]={0x7A,0xCF,0x8C,0x95,0x8e,0xa8,0x5f,0xc9,0x7a,0x91,0x88,0xa7,0x70,0xc0,0x7f,0x89,0x86,
0x93,0x5f,0xcf,0x6e,0x86,0x85,0xad,0x88,0xd4,0xa0,0xa2,0x98,0xb3,0x79,0xc1,0x7e,0x7e,0x77,0x93};
int DW_2[]={0x10,0x8,0x8,0xe,0x6,0xb,0x5,0x17,0x5,0xa,0xc,0x17,0xe,0x17,0x13,0x7,0x8,0xa,0x4,
0xd,0x16,0x11,0xb,0x16,0x6,0xe,0x2,0xb,0x12,0x9,5,8,8,0xA,0x10,0xd};
int PART_2[]={8,7,1,13,5,11,1,15,4,8,9,14,11,15,13,1,4,2,1,8,15,9,3,15,6,5,2,9,15,5,3,5,6,5,12,13};
int PART_1[]={6,6,6,6,6,7,3,5,7,6,6,6,6,5,4,6,7,7,3,7,5,6,7,5,7,6,7,7,5,7,7,6,6,3,6,7};
int main(){
for(int i=0;i<36;i++)cout<<(char)((PART_1[i]<<4)|PART_2[i]);
}