-
-
[原创]第一题解题过程
-
发表于: 2019-12-24 19:17 4715
-
正确的密码:
5461023
分析过程:
执行goodluck.exe,提示需要输入正确的密码,输入后有msgbox展示输入的结果。直接用od加载exe后bp所有的MessageBoxA调用。执行exe,随便输入一个密码,程序停在密码错误提示前:查看调用堆栈,定位到程序的上一次调用位置
以下是程序判断的主要逻辑:
解释:
00401871 mov ecx,[local.2] // 获取输入的字符串
00401874 push ecx ; /s = "pU"
00401875 call <jmp.&MSVCRT.strlen> ; \strlen
0040187A add esp,0x4
0040187D test eax,eax // 判断输入字符串长度是否为0
0040187F jnz short goodluck.00401894
00401881 push 0x0
00401883 push 0x0
00401885 push goodluck.004035A8 ; ASCII "请输入password!"
0040188A mov ecx,[local.1]
0040188D call <jmp.&MFC42.#4224> // 输入password提示框
00401892 jmp short goodluck.0040190F
00401894 mov [local.3],goodluck.004035A0 ; ASCII "cuk!ogl" // 基准字符串
0040189B mov [local.4],0x0
004018A2 mov [local.4],0x0
004018A9 mov edx,[local.2] // 进入循环,遍历字符串
004018AC add edx,[local.4] ; mfc42.7CCB784B
004018AF movsx eax,byte ptr ds:[edx]
004018B2 test eax,eax // 判断是否退出循环
004018B4 je short goodluck.004018FB // 字符串遍历完成后进行结果比较
004018B6 mov ecx,[local.2]
004018B9 add ecx,[local.4] ; mfc42.7CCB784B
004018BC movsx edx,byte ptr ds:[ecx]
004018BF cmp edx,0x39
004018C2 jg short goodluck.004018EB // 如果字符大于'9', 提示错误
004018C4 mov eax,[local.2]
004018C7 add eax,[local.4] ; mfc42.7CCB784B
004018CA movsx ecx,byte ptr ds:[eax]
004018CD cmp ecx,0x30
004018D0 jl short goodluck.004018EB // 如果字符小于'0', 提示错误
004018D2 mov edx,[local.2]
004018D5 add edx,[local.4] ; mfc42.7CCB784B
004018D8 movsx eax,byte ptr ds:[edx]
004018DB mov ecx,[local.4] ; mfc42.7CCB784B
004018DE mov edx,[local.3]
004018E1 mov al,byte ptr ds:[edx+eax-0x30]
004018E5 mov byte ptr ss:[ebp+ecx-0x18],al
004018E9 jmp short goodluck.004018F0
004018EB call goodluck.004017B0 // 根据输入的数字,在cuk!ogl中取对应位置的字符
004018F0 mov ecx,[local.4] ; mfc42.7CCB784B
004018F3 add ecx,0x1
004018F6 mov [local.4],ecx
004018F9 jmp short goodluck.004018A9
004018FB mov edx,[local.4] ; mfc42.7CCB784B // 字符串遍历完成
004018FE mov byte ptr ss:[ebp+edx-0x18],0x0
00401903 lea eax,[local.6]
00401906 push eax
00401907 call goodluck.004017F0 // 执行比较函数
字符串比较函数:
004017F0 /$ 55 push ebp
004017F1 |. 8BEC mov ebp,esp
004017F3 |. 83EC 40 sub esp,0x40
004017F6 |. 53 push ebx
004017F7 |. 56 push esi ; mfc42.#4234
004017F8 |. 57 push edi
004017F9 |. 68 98354000 push goodluck.00403598 ; /s2 = "goluck!"
004017FE |. 8B45 08 mov eax,[arg.1] ; |
00401801 |. 50 push eax ; |s1 = "uk!"
00401802 |. E8 29070000 call <jmp.&MSVCRT.strcmp> ; \strcmp // 根据输入的数字从cuk!ogl中取出的字符串,与goluck!比较,相等则通过
00401807 |. 83C4 08 add esp,0x8
0040180A |. 85C0 test eax,eax
0040180C |. 75 07 jnz short goodluck.00401815
0040180E |. E8 5DFFFFFF call goodluck.00401770
00401813 |. EB 05 jmp short goodluck.0040181A
00401815 |> E8 96FFFFFF call goodluck.004017B0
结果:
字典
0 1 2 3 4 5 6
c u k ! o g l
比较字符:
g o l u c k !
5 4 6 1 0 2 3
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!
赞赏
他的文章
- [原创]第一题解题过程 4716
看原图
赞赏
雪币:
留言: