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}