目录
reverse3
是个exe文件,不能运行,用exeinfo查壳,发现是32位的。
用ida打开,先看看字符串窗口,发现"right flag!\n",跟进并F5,看到"please enter the flag:",明白这是要输入值的就没想着用OD调试了
int __cdecl main_0(int argc, const char **argv, const char **envp)
{
size_t v3; // eax
const char *v4; // eax
size_t v5; // eax
char v7; // [esp+0h] [ebp-188h]
char v8; // [esp+0h] [ebp-188h]
signed int j; // [esp+DCh] [ebp-ACh]
int i; // [esp+E8h] [ebp-A0h]
signed int v11; // [esp+E8h] [ebp-A0h]
char Destination[108]; // [esp+F4h] [ebp-94h] BYREF
char Str[28]; // [esp+160h] [ebp-28h] BYREF
char v14[8]; // [esp+17Ch] [ebp-Ch] BYREF
for ( i = 0; i < 100; ++i )//将Deseination的前100个值置零
{
if ( (unsigned int)i >= 100 )
j____report_rangecheckfailure();
Destination[i] = 0;
}
sub_41132F("please enter the flag:", v7);
sub_411375("%20s", (char)Str);//输入flag
v3 = j_strlen(Str);
v4 = (const char *)sub_4110BE((int)Str, v3, (int)v14);// 加密算法
strncpy(Destination, v4, 40u);//将v4前40个字符复制给Destination
v11 = j_strlen(Destination);
for ( j = 0; j < v11; ++j )//加密算法
Destination[j] += j;
v5 = j_strlen(Destination);
if ( !strncmp(Destination, Str2, v5) )// Str2='e3nifIH9b_C@n@dH',比较Destination与Str2的前v5个字符,相等则函数值为零
sub_41132F("rigth flag!\n", v8);
else
sub_41132F("wrong flag!\n", v8);
return 0;
}
查看之前用来加密的函数,这函数挺让我头疼的,看了很久都没看懂,后来才明白根据aAbcdefghijklmn='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
再加以分析可以得出这就是base64加密
void *__cdecl sub_411AB0(char *a1, unsigned int a2, int *a3)
{
int v4; // [esp+D4h] [ebp-38h]
int v5; // [esp+D4h] [ebp-38h]
int v6; // [esp+D4h] [ebp-38h]
int v7; // [esp+D4h] [ebp-38h]
int i; // [esp+E0h] [ebp-2Ch]
unsigned int v9; // [esp+ECh] [ebp-20h]
int v10; // [esp+EC