重贴详细跟踪加注释代码,指哪位兄弟指出错误并写出算法思想
004014DF /. 55 push ebp
004014E0 |. 8BEC mov ebp, esp
004014E2 |. 6A FF push -1
004014E4 |. 68 8F204000 push 0040208F ; SE 处理程序安装
004014E9 |. 64:A1 0000000>mov eax, dword ptr fs:[0]
004014EF |. 50 push eax
004014F0 |. 64:8925 00000>mov dword ptr fs:[0], esp
004014F7 |. 81EC B4010000 sub esp, 1B4
004014FD |. 56 push esi
004014FE |. 57 push edi
004014FF |. 898D 40FEFFFF mov dword ptr [ebp-1C0], ecx
00401505 |. C745 F0 45632>mov dword ptr [ebp-10], 81276345 ; 这一句很关键,[ebp-10]处放了一个定值81276345H
0040150C |. 68 AC414000 push 004041AC
00401511 |. 8D4D EC lea ecx, dword ptr [ebp-14]
00401514 |. E8 77080000 call <jmp.&MFC42.#537_CString::CString>
00401519 |. C745 FC 00000>mov dword ptr [ebp-4], 0
00401520 |. 68 B0414000 push 004041B0
00401525 |. 8D4D E8 lea ecx, dword ptr [ebp-18]
00401528 |. E8 63080000 call <jmp.&MFC42.#537_CString::CString>
0040152D |. C645 FC 01 mov byte ptr [ebp-4], 1
00401531 |. 68 B4414000 push 004041B4
00401536 |. 8D4D DC lea ecx, dword ptr [ebp-24]
00401539 |. E8 52080000 call <jmp.&MFC42.#537_CString::CString>
0040153E |. C645 FC 02 mov byte ptr [ebp-4], 2
00401542 |. 8D45 EC lea eax, dword ptr [ebp-14]
00401545 |. 50 push eax
00401546 |. 68 E8030000 push 3E8
0040154B |. 8B8D 40FEFFFF mov ecx, dword ptr [ebp-1C0]
00401551 |. E8 34080000 call <jmp.&MFC42.#3097_CWnd::GetDlgItemTextA>
00401556 |. 8D4D E8 lea ecx, dword ptr [ebp-18]
00401559 |. 51 push ecx
0040155A |. 68 E9030000 push 3E9
0040155F |. 8B8D 40FEFFFF mov ecx, dword ptr [ebp-1C0]
00401565 |. E8 20080000 call <jmp.&MFC42.#3097_CWnd::GetDlgItemTextA>
0040156A |. 8D4D EC lea ecx, dword ptr [ebp-14] ; [ebp-14]的有效地址给ecx
0040156D |. E8 DE020000 call 00401850
00401572 |. 8945 E4 mov dword ptr [ebp-1C], eax ; 取得用户名长度放到堆栈的[ebp-1c]处
00401575 |. 837D E4 05 cmp dword ptr [ebp-1C], 5 ; 如果大于等于5就跳,不跳就完蛋
00401579 |. 7D 43 jge short 004015BE
0040157B |. 6A 40 push 40
0040157D |. 68 20404000 push 00404020 ; ASCII "CrackMe"
00401582 |. 68 28404000 push 00404028 ; ASCII "User Name must have at least 5 characters."
00401587 |. 8B8D 40FEFFFF mov ecx, dword ptr [ebp-1C0]
0040158D |. E8 F2070000 call <jmp.&MFC42.#4224_CWnd::MessageBoxA>
00401592 |. C645 FC 01 mov byte ptr [ebp-4], 1
00401596 |. 8D4D DC lea ecx, dword ptr [ebp-24]
00401599 |. E8 C2070000 call <jmp.&MFC42.#800_CString::~CString>
0040159E |. C645 FC 00 mov byte ptr [ebp-4], 0
004015A2 |. 8D4D E8 lea ecx, dword ptr [ebp-18] ; 把[EBP-18]里存的假码的指针给ECX
004015A5 |. E8 B6070000 call <jmp.&MFC42.#800_CString::~CString> ; 调C++函数处理密码
004015AA |. C745 FC FFFFF>mov dword ptr [ebp-4], -1
004015B1 |. 8D4D EC lea ecx, dword ptr [ebp-14] ; 把[ebp-14]里的用户名给ECX
004015B4 |. E8 A7070000 call <jmp.&MFC42.#800_CString::~CString> ; 调C++函数处理用户名
004015B9 |. E9 F9010000 jmp 004017B7
004015BE |> C745 E0 00000>mov dword ptr [ebp-20], 0 ; 初始化[EBP-20]为0
004015C5 |. EB 09 jmp short 004015D0
004015C7 |> 8B55 E0 /mov edx, dword ptr [ebp-20] ; ebp-18里放的用户名;ebp-14里放的是假注册码
004015CA |. 83C2 01 |add edx, 1 ; edx+1
004015CD |. 8955 E0 |mov dword ptr [ebp-20], edx
004015D0 |> 8B45 E0 mov eax, dword ptr [ebp-20] ; 同时初始化EAX(堆栈[ebp-20]里面的双字内容给弹给eax)
004015D3 |. 3B45 E4 |cmp eax, dword ptr [ebp-1C] ; [ebp-1c]里放的是用户名的长度
004015D6 |. 7D 42 |jge short 0040161A
004015D8 |. 8B4D E0 |mov ecx, dword ptr [ebp-20]
004015DB |. 51 |push ecx ; /Arg1
004015DC |. 8D4D EC |lea ecx, dword ptr [ebp-14] ; |把用户名指针首地址给ECX
004015DF |. E8 1C030000 |call 00401900 ; \crackme1.00401900
004015E4 |. 0FBED0 |movsx edx, al ; 给EDX(先符号扩展再传送)
004015E7 |. 8B45 F0 |mov eax, dword ptr [ebp-10] ; [ebp-10]里的内容给eax
004015EA |. 03C2 |add eax, edx ; eax=eax+edx
004015EC |. 8945 F0 |mov dword ptr [ebp-10], eax ; 重新放回[ebp-10],这里是关键,也就是说用户名字符累加的结果一直放在[ebp-10]开头的栈
004015EF |. 8B4D E0 |mov ecx, dword ptr [ebp-20] ; 把[ebp-20]计数器给ECX
004015F2 |. C1E1 08 |shl ecx, 8 ; 左移8位(乘256)
004015F5 |. 8B55 F0 |mov edx, dword ptr [ebp-10] ; 取出计算机后存的结果
004015F8 |. 33D1 |xor edx, ecx ; 把得到的字符与ECX异或
004015FA |. 8955 F0 |mov dword ptr [ebp-10], edx ; 回存到[EBP-10]单元(一次占四个字节)
004015FD |. 8B45 E0 |mov eax, dword ptr [ebp-20]
00401600 |. 83C0 01 |add eax, 1 ; 计数器eax加1
00401603 |. 8B4D E4 |mov ecx, dword ptr [ebp-1C] ; 用户字符长度给ECX
00401606 |. 0FAF4D E0 |imul ecx, dword ptr [ebp-20] ; 用户长度*计数器(结果低位在AX)
0040160A |. F7D1 |not ecx ; ecx取反
0040160C |. 0FAFC1 |imul eax, ecx ; eax*ecx(上次乘的结果的低位和求反后的ECX再乘)
0040160F |. 8B55 F0 |mov edx, dword ptr [ebp-10] ; 这里明显的可以看出直接忽略高位
00401612 |. 0FAFD0 |imul edx, eax ; edx*eax(再乘)
00401615 |. 8955 F0 |mov dword ptr [ebp-10], edx ; 取高位回存
00401618 |.^ EB AD \jmp short 004015C7
0040161A |> 8B45 F0 mov eax, dword ptr [ebp-10]
0040161D |. 50 push eax
0040161E |. 68 54404000 push 00404054 ; ASCII "%lu"
00401623 |. 8D4D DC lea ecx, dword ptr [ebp-24] ; 保存[ebp-24]单元的内容到堆栈
00401626 |. 51 push ecx
00401627 |. E8 52070000 call <jmp.&MFC42.#2818_CString::Format> ; 调用C++函数
0040162C |. 83C4 0C add esp, 0C ; 到这儿就把原来的计算结果转成ASCII码了
0040162F |. 8D4D DC lea ecx, dword ptr [ebp-24] ; [ebp-24]处还存了一个明码,并且在上面那个码前加了一个6
00401632 |. E8 79020000 call 004018B0
00401637 |. 50 push eax ; /Arg1
00401638 |. 8D4D E8 lea ecx, dword ptr [ebp-18] ; |
0040163B |. E8 80020000 call 004018C0 ; \crackme1.004018C0
00401640 |. 85C0 test eax, eax ; 关键跳,注册码错误不相等为1
00401642 |. 0F85 FF000000 jnz 00401747
00401648 |. 8D8D ACFEFFFF lea ecx, dword ptr [ebp-154]
0040164E |. E8 19070000 call <jmp.&MFC42.#540_CString::CString>
00401653 |. C645 FC 03 mov byte ptr [ebp-4], 3
00401657 |. 6A 66 push 66
00401659 |. 8D8D ACFEFFFF lea ecx, dword ptr [ebp-154]
0040165F |. E8 02070000 call <jmp.&MFC42.#4160_CString::LoadStrin>
00401664 |. B9 07000000 mov ecx, 7
00401669 |. BE 58404000 mov esi, 00404058 ; ASCII "Correct!! "
0040166E |. 8DBD 48FEFFFF lea edi, dword ptr [ebp-1B8]
00401674 |. F3:A5 rep movs dword ptr es:[edi], dword ptr [>
00401676 |. 66:A5 movs word ptr es:[edi], word ptr [esi]
00401678 |. A4 movs byte ptr es:[edi], byte ptr [esi]
00401679 |. B9 11000000 mov ecx, 11
0040167E |. 33C0 xor eax, eax
00401680 |. 8DBD 67FEFFFF lea edi, dword ptr [ebp-199]
00401686 |. F3:AB rep stos dword ptr es:[edi]
00401688 |. AA stos byte ptr es:[edi]
00401689 |. B9 07000000 mov ecx, 7
0040168E |. BE 78404000 mov esi, 00404078 ; ASCII "<BrD-SoB> "
00401693 |. 8DBD 14FFFFFF lea edi, dword ptr [ebp-EC]
00401699 |. F3:A5 rep movs dword ptr es:[edi], dword ptr [>
0040169B |. 66:A5 movs word ptr es:[edi], word ptr [esi]
0040169D |. B9 11000000 mov ecx, 11
004016A2 |. 33C0 xor eax, eax
004016A4 |. 8DBD 32FFFFFF lea edi, dword ptr [ebp-CE]
004016AA |. F3:AB rep stos dword ptr es:[edi]
004016AC |. 66:AB stos word ptr es:[edi]
004016AE |. B9 06000000 mov ecx, 6
004016B3 |. BE 98404000 mov esi, 00404098 ; ASCII "Incorrect!!, Try Again."
004016B8 |. 8DBD 78FFFFFF lea edi, dword ptr [ebp-88]
004016BE |. F3:A5 rep movs dword ptr es:[edi], dword ptr [>
004016C0 |. B9 13000000 mov ecx, 13
004016C5 |. 33C0 xor eax, eax
004016C7 |. 8D7D 90 lea edi, dword ptr [ebp-70]
004016CA |. F3:AB rep stos dword ptr es:[edi]
004016CC |. B9 07000000 mov ecx, 7
004016D1 |. BE B0404000 mov esi, 004040B0 ; ASCII "Correct way to go, You Got It."
004016D6 |. 8DBD B0FEFFFF lea edi, dword ptr [ebp-150]
004016DC |. F3:A5 rep movs dword ptr es:[edi], dword ptr [>
004016DE |. 66:A5 movs word ptr es:[edi], word ptr [esi]
004016E0 |. A4 movs byte ptr es:[edi], byte ptr [esi]
004016E1 |. B9 11000000 mov ecx, 11
004016E6 |. 33C0 xor eax, eax
004016E8 |. 8DBD CFFEFFFF lea edi, dword ptr [ebp-131]
004016EE |. F3:AB rep stos dword ptr es:[edi]
004016F0 |. AA stos byte ptr es:[edi]
004016F1 |. 6A 40 push 40
004016F3 |. 68 D0404000 push 004040D0 ; ASCII "CrackMe"
004016F8 |. 8D8D ACFEFFFF lea ecx, dword ptr [ebp-154]
004016FE |. E8 AD010000 call 004018B0
00401703 |. 50 push eax
00401704 |. 8B8D 40FEFFFF mov ecx, dword ptr [ebp-1C0]
0040170A |. E8 75060000 call <jmp.&MFC42.#4224_CWnd::MessageBoxA>
0040170F |. C645 FC 02 mov byte ptr [ebp-4], 2
00401713 |. 8D8D ACFEFFFF lea ecx, dword ptr [ebp-154]
00401719 |. E8 42060000 call <jmp.&MFC42.#800_CString::~CString>
0040171E |. C645 FC 01 mov byte ptr [ebp-4], 1
00401722 |. 8D4D DC lea ecx, dword ptr [ebp-24]
00401725 |. E8 36060000 call <jmp.&MFC42.#800_CString::~CString>
0040172A |. C645 FC 00 mov byte ptr [ebp-4], 0
0040172E |. 8D4D E8 lea ecx, dword ptr [ebp-18]
00401731 |. E8 2A060000 call <jmp.&MFC42.#800_CString::~CString>
00401736 |. C745 FC FFFFF>mov dword ptr [ebp-4], -1
0040173D |. 8D4D EC lea ecx, dword ptr [ebp-14]
00401740 |. E8 1B060000 call <jmp.&MFC42.#800_CString::~CString>
00401745 |. EB 70 jmp short 004017B7
00401747 |> 8D8D 44FEFFFF lea ecx, dword ptr [ebp-1BC]
0040174D |. E8 1A060000 call <jmp.&MFC42.#540_CString::CString>
00401752 |. C645 FC 04 mov byte ptr [ebp-4], 4
00401756 |. 6A 67 push 67
00401758 |. 8D8D 44FEFFFF lea ecx, dword ptr [ebp-1BC]
0040175E |. E8 03060000 call <jmp.&MFC42.#4160_CString::LoadStrin>
00401763 |. 6A 40 push 40
00401765 |. 68 D8404000 push 004040D8 ; ASCII "CrackMe"
0040176A |. 8D8D 44FEFFFF lea ecx, dword ptr [ebp-1BC]
00401770 |. E8 3B010000 call 004018B0
00401775 |. 50 push eax
00401776 |. 8B8D 40FEFFFF mov ecx, dword ptr [ebp-1C0]
0040177C |. E8 03060000 call <jmp.&MFC42.#4224_CWnd::MessageBoxA> ; 调用MessageboxA显示出错信息
4018C0处的函数调用:
004018C0 /$ 55 push ebp
004018C1 |. 8BEC mov ebp, esp
004018C3 |. 51 push ecx
004018C4 |. 894D FC mov dword ptr [ebp-4], ecx
004018C7 |. 8B45 08 mov eax, dword ptr [ebp+8]
004018CA |. 50 push eax ; /Arg2
004018CB |. 8B4D FC mov ecx, dword ptr [ebp-4] ; |
004018CE |. 8B11 mov edx, dword ptr [ecx] ; |
004018D0 |. 52 push edx ; |EDX里放的错误注册码.EAX放的是算出来的注册码
004018D1 |. E8 0A000000 call 004018E0 ; \crackme1.004018E0
004018D6 |. 83C4 08 add esp, 8 ; 恢复返回环境
004018D9 |. 8BE5 mov esp, ebp
004018DB |. 5D pop ebp
004018DC \. C2 0400 retn 4
4018E0处的函数调用
004018E0 /$ 55 push ebp
004018E1 |. 8BEC mov ebp, esp
004018E3 |. 8B45 0C mov eax, dword ptr [ebp+C]
004018E6 |. 50 push eax ; /s2
004018E7 |. 8B4D 08 mov ecx, dword ptr [ebp+8] ; |
004018EA |. 51 push ecx ; |s1
004018EB |. FF15 B4314000 call dword ptr [<&MSVCRT._mbscmp>] ; \调C++调数进行比较
004018F1 |. 83C4 08 add esp, 8
004018F4 |. 5D pop ebp
004018F5 \. C3 retn
401900处的函数调用
00401900 /$ 55 push ebp
00401901 |. 8BEC mov ebp, esp
00401903 |. 51 push ecx ; 先存一下ECX
00401904 |. 894D FC mov dword ptr [ebp-4], ecx ; 让EAX指向ECX双字单元
00401907 |. 8B45 FC mov eax, dword ptr [ebp-4] ; 把[EBP-4]指针里的地址给EAX
0040190A |. 8B08 mov ecx, dword ptr [eax] ; 再把EAX指放的地址指针指向的内容转ECX(用户名给ECX)
0040190C |. 8B55 08 mov edx, dword ptr [ebp+8] ; [ebp+8]处放的是用户名表的偏移针指计数器
0040190F |. 8A0411 mov al, byte ptr [ecx+edx] ; 取第N加1个字符到AL
00401912 |. 8BE5 mov esp, ebp ; 临时栈复位
00401914 |. 5D pop ebp ; 取出原来的栈基址
00401915 \. C2 0400 retn 4
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课