• buuctf-findKey


    exe文件

    运行发现这个窗口,没有任何消息

    32位

    进入字符串就发现了flag{

    左边红色代表没有F5成功

    我们再编译一下(选中红色的全部按p)

    1. LRESULT __stdcall sub_401640(HWND hWndParent, UINT Msg, WPARAM wParam, LPARAM lParam)
    2. {
    3. int v5; // eax
    4. size_t v6; // eax
    5. DWORD v7; // eax
    6. int v8; // eax
    7. int v9; // eax
    8. int v10; // [esp+4Ch] [ebp-400h]
    9. UINT v11; // [esp+50h] [ebp-3FCh]
    10. CHAR v12[256]; // [esp+54h] [ebp-3F8h] BYREF
    11. char v13[7]; // [esp+154h] [ebp-2F8h] BYREF
    12. __int16 v14; // [esp+15Bh] [ebp-2F1h]
    13. char v15; // [esp+15Dh] [ebp-2EFh]
    14. char Str[253]; // [esp+160h] [ebp-2ECh] BYREF
    15. __int16 v17; // [esp+25Dh] [ebp-1EFh]
    16. char v18; // [esp+25Fh] [ebp-1EDh]
    17. CHAR v19[256]; // [esp+260h] [ebp-1ECh] BYREF
    18. CHAR String[4]; // [esp+360h] [ebp-ECh] BYREF
    19. int v21; // [esp+364h] [ebp-E8h]
    20. __int16 v22; // [esp+368h] [ebp-E4h]
    21. CHAR Text[32]; // [esp+36Ch] [ebp-E0h] BYREF
    22. struct tagRECT Rect; // [esp+38Ch] [ebp-C0h] BYREF
    23. CHAR Buffer[100]; // [esp+39Ch] [ebp-B0h] BYREF
    24. HDC hdc; // [esp+400h] [ebp-4Ch]
    25. struct tagPAINTSTRUCT Paint; // [esp+404h] [ebp-48h] BYREF
    26. int v28; // [esp+444h] [ebp-8h]
    27. int v29; // [esp+448h] [ebp-4h]
    28. LoadStringA(hInstance, 0x6Au, Buffer, 100);
    29. v11 = Msg;
    30. if ( Msg > 0x111 )
    31. {
    32. if ( v11 == 517 )
    33. {
    34. if ( strlen((const char *)String1) > 6 )
    35. ExitProcess(0);
    36. if ( strlen((const char *)String1) )
    37. {
    38. memset(v19, 0, sizeof(v19));
    39. v6 = strlen((const char *)String1);
    40. memcpy(v19, String1, v6);
    41. v7 = strlen((const char *)String1);
    42. sub_40101E(String1, v7, (LPSTR)String1);
    43. strcpy(Str, "0kk`d1a`55k222k2a776jbfgd`06cjjb");
    44. memset(&Str[33], 0, 0xDCu);
    45. v17 = 0;
    46. v18 = 0;
    47. strcpy(v13, "SS");
    48. *(_DWORD *)&v13[3] = 0;
    49. v14 = 0;
    50. v15 = 0;
    51. v8 = strlen(Str);
    52. sub_401005(v13, (int)Str, v8);
    53. if ( _strcmpi((const char *)String1, Str) )
    54. {
    55. SetWindowTextA(hWndParent, "flag{}");
    56. MessageBoxA(hWndParent, "Are you kidding me?", "^_^", 0);
    57. ExitProcess(0);
    58. }
    59. memcpy(v12, &unk_423030, 0x32u);
    60. v9 = strlen(v12);
    61. sub_401005(v19, (int)v12, v9);
    62. MessageBoxA(hWndParent, v12, 0, 0x32u);
    63. }
    64. ++dword_428D54;
    65. }
    66. else
    67. {
    68. if ( v11 != 520 )
    69. return DefWindowProcA(hWndParent, Msg, wParam, lParam);
    70. if ( dword_428D54 == 16 )
    71. {
    72. strcpy(String, "ctf");
    73. v21 = 0;
    74. v22 = 0;
    75. SetWindowTextA(hWndParent, String);
    76. strcpy(Text, "Are you kidding me?");
    77. MessageBoxA(hWndParent, Text, Buffer, 0);
    78. }
    79. ++dword_428D54;
    80. }
    81. }
    82. else
    83. {
    84. switch ( v11 )
    85. {
    86. case 0x111u:
    87. v29 = (unsigned __int16)wParam;
    88. v28 = HIWORD(wParam);
    89. v10 = (unsigned __int16)wParam;
    90. if ( (unsigned __int16)wParam == 104 )
    91. {
    92. DialogBoxParamA(hInstance, (LPCSTR)0x67, hWndParent, (DLGPROC)DialogFunc, 0);
    93. }
    94. else
    95. {
    96. if ( v10 != 105 )
    97. return DefWindowProcA(hWndParent, Msg, wParam, lParam);
    98. DestroyWindow(hWndParent);
    99. }
    100. break;
    101. case 2u:
    102. PostQuitMessage(0);
    103. break;
    104. case 0xFu:
    105. hdc = BeginPaint(hWndParent, &Paint);
    106. GetClientRect(hWndParent, &Rect);
    107. v5 = strlen(Buffer);
    108. DrawTextA(hdc, Buffer, v5, &Rect, 1u);
    109. EndPaint(hWndParent, &Paint);
    110. break;
    111. default:
    112. return DefWindowProcA(hWndParent, Msg, wParam, lParam);
    113. }
    114. }
    115. return 0;
    116. }

    win32逆向的关键就是 messagebox 这个函数

    弹窗

    这两个都是输出kid

    我们看中间那个

    慢慢跟进就ok了

    很简单了逻辑

    flag{n0_Zu0_n0_die}

  • 相关阅读:
    小目标检测QueryDet
    华为ipsec vpn配置案例
    『无为则无心』Python面向对象 — 46、类和对象
    [SpringMVC]基于RESTful页面数据交互案例
    Java Web从入门到实战
    Java版分布式微服务云开发架构 Spring Cloud+Spring Boot+Mybatis 电子招标采购系统功能清单
    DNS 查询原理详解
    mybatis 执行流程,mybatis源码解析,推荐收藏
    C++:继承
    什么是Quartz
  • 原文地址:https://blog.csdn.net/wcj126/article/details/139650543