攻防世界 reverse 进阶 -gametime

19.gametime csaw-ctf-2016-quals

这是一个小游戏,挺有意思的

's'-->' '    'x'-->'x'   'm'-->'m'

观察流程,发现检验函数在

 1 char __usercall check_input_401507@<al>(int a1@<edx>, int a2@<ecx>, DWORD dwMilliseconds, int a4, int a5)
 2 {
 3   int v5; // esi
 4   int v6; // ebx
 5 
 6   v5 = a1;
 7   v6 = a2;
 8   print_401A73((int)"key is %s (%s)", a5, a4);
 9   bks_401423();
10   print_401A73((int)"
                                 
");
11   if ( v5 > 0 )
12   {
13     do
14     {
15       print_401A73((int)".");
16       Sleep(dwMilliseconds);
17       --v5;
18     }
19     while ( v5 );
20   }
21   if ( check_time_401260(v6, 500 * dwMilliseconds) )//关键
22     return 1;
23   print_401A73((int)"key is %s (%s)
", a5, a4);
24   print_401A73((int)"UDDER FAILURE! http://imgur.com/4Ajx21P 
");
25   return 0;
26 }

检验工作交给了:401260()函数

 1 bool __fastcall check_time_401260(int a1, int t)
 2 {
 3   int a1_2; // edi
 4   int t_2; // esi
 5   int input_c; // eax
 6 
 7   a1_2 = a1;
 8   t_2 = t;
 9   if ( a1 == ' ' )
10     print_401A73((int)"s
");
11   else
12     print_401A73((int)"%c
", a1);
13   if ( t_2 )
14   {
15     while ( !_kbhit() )
16     {
17       if ( !--t_2 )
18         goto LABEL_7;
19     }
20     input_c = _getch();                         // 输入
21   }
22   else
23   {
24 LABEL_7:
25     input_c = -1;
26   }
27   return input_c != -1 && input_c == a1_2;      // 相应时间内输入,并判断是否正确
28 }

最简单的方法就是修改401260()函数的返回值,nop掉失败跳,ok

 

 key is  (no5c30416d6cf52638460377995c6a8cf5)

原文地址:https://www.cnblogs.com/DirWang/p/11448796.html