攻防世界 reverse Mysterious

Mysterious  BUUCTF-2019

int __stdcall sub_401090(HWND hWnd, int a2, int a3, int a4)
{
  char v5; // [esp+50h] [ebp-310h]
  CHAR Text[4]; // [esp+154h] [ebp-20Ch]
  char v7; // [esp+159h] [ebp-207h]
  __int16 v8; // [esp+255h] [ebp-10Bh]
  char v9; // [esp+257h] [ebp-109h]
  int v10_108; // [esp+258h] [ebp-108h]
  CHAR myinput; // [esp+25Ch] [ebp-104h]
  char v11_101; // [esp+25Fh] [ebp-101h]
  char v12_100; // [esp+260h] [ebp-100h]
  char v13_FF; // [esp+261h] [ebp-FFh]

  memset(&myinput, 0, 0x104u);
  v10_108 = 0;
  if ( a2 == 16 )
  {
    DestroyWindow(hWnd);
    PostQuitMessage(0);
  }
  else if ( a2 == 273 )
  {
    if ( a3 == 1000 )
    {
      GetDlgItemTextA(hWnd, 1002, &myinput, 260);
      strlen(&myinput);
      if ( strlen(&myinput) > 6 )               // 输入小于7位
        ExitProcess(0);
      v10_108 = atoi(&myinput) + 1;             // int atoi(const char *nptr);是把字符串转换成整型数的一个函数。扫描nptr,如果遇到‘0-9’之外的字符便停止。
                                                // v10=转换的数字+1
      if ( v10_108 == 123 && v11_101 == 'x' && v13_FF == 'z' && v12_100 == 'y' )// 输入atoi转整形得到结果+1等于123,则输入开始的数字部分为122
                                                // 输入的后3位为xyz
      {
        strcpy(Text, "flag");                   // 下面开始拼接flag
        memset(&v7, 0, 0xFCu);
        v8 = 0;
        v9 = 0;
        _itoa(v10_108, &v5, 10);
        strcat(Text, "{");
        strcat(Text, &v5);
        strcat(Text, "_");
        strcat(Text, "Buff3r_0v3rf|0w");
        strcat(Text, "}");
        MessageBoxA(0, Text, "well done", 0);
      }
      SetTimer(hWnd, 1u, 0x3E8u, TimerFunc);
    }
    if ( a3 == 1001 )
      KillTimer(hWnd, 1u);
  }
  return 0;
}

 flag{123_Buff3r_0v3rf|0w}

猜你喜欢

转载自www.cnblogs.com/DirWang/p/12230643.html