writeUp-攻防世界-reverse-Hello,CTF

匿名 (未验证) 提交于 2019-12-03 00:11:01

先打开这个exe文件。

等等……没有壳?!

可以看到这个程序是C++写的。

拖到ida里查看。

搜索“please input your serial:”

看到这个东西在_main函数里面。

 1 int __cdecl main(int argc, const char **argv, const char **envp)  2 {  3   signed int v3; // ebx  4   char v4; // al  5   int result; // eax  6   int v6; // [esp+0h] [ebp-70h]  7   int v7; // [esp+0h] [ebp-70h]  8   char v8; // [esp+12h] [ebp-5Eh]  9   char v9[20]; // [esp+14h] [ebp-5Ch] 10   char v10; // [esp+28h] [ebp-48h] 11   __int16 v11; // [esp+48h] [ebp-28h] 12   char v12; // [esp+4Ah] [ebp-26h] 13   char v13; // [esp+4Ch] [ebp-24h] 14  15   strcpy(&v13, "437261636b4d654a757374466f7246756e");//把字符串"437261636b4d654a757374466f7246756e"复制到v13 16   while ( 1 ) 17   { 18     memset(&v10, 0, 0x20u); 19     v11 = 0; 20     v12 = 0; 21     sub_40134B(aPleaseInputYou, v6);//这里调用函数sub_40134B,输出aPleaseInputYou里的字符:"please input your serial:" 22     scanf(aS, v9);//获取输入字符,给v9 23     if ( strlen(v9) > 0x11 ) 24       break;//v9长度大于17就退掉 25     v3 = 0;//设置v3为计数器 26     do 27     { 28       v4 = v9[v3]; 29       if ( !v4 ) 30         break;//v4为0x00时退掉 31       sprintf(&v8, asc_408044, v4);//asc_408044为"%x"    sprintf(&v8,"%x",v4)把v4的值的16进制发到v8 32       strcat(&v10, &v8);//连接字符串v10与v8并把得到的字符串赋值给v10 33       ++v3;//计数器增加 34     } 35     while ( v3 < 17 ); 36     if ( !strcmp(&v10, &v13) ) 37       sub_40134B(aSuccess, v7);//strcmp(&v10, &v13) 在v10的字符串与v13的相等时返回0 38     else 39       sub_40134B(aWrong, v7); 40   } 41   sub_40134B(aWrong, v7); 42   result = stru_408090._cnt-- - 1; 43   if ( stru_408090._cnt < 0 ) 44     return _filbuf(&stru_408090); 45   ++stru_408090._ptr; 46   return result; 47 }

所以说正确的serial就是"437261636b4d654a757374466f7246756e"转化为字符串。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!