系統 : Windows xp
程序 : Rith's CrackMe #1
程序下載地址 :http://pan.baidu.com/s/1gecW9Qr
要求 : 注冊機編寫
使用工具 : IDA Pro & OD
可在“PEDIY CrackMe 2007”中查找關於此程序的破文,標題為“WAKU的第二個破文----Rith's CrackMe #1(非常簡單)”。
使用IDA載入程序,在字串表中找出正確注冊的提示“Well done cracker!”,並雙擊交叉參考來到關鍵代碼處:
00401582 . 68 B81B4000 push 00401BB8 ; SE handler installation
00401587 . 64:A1 0000000>mov eax, dword ptr fs:[0] 0040158D . 50 push eax 0040158E . 64:8925 00000>mov dword ptr fs:[0], esp 00401595 . 83EC 0C sub esp, 0C
00401598 . 53 push ebx 00401599 . 55 push ebp 0040159A . 56 push esi 0040159B . 8BF1 mov esi, ecx 0040159D . 57 push edi 0040159E . 68 48304000 push 00403048 ; ASCII "31415926535897932384"
004015A3 . 8D4C24 14 lea ecx, dword ptr [esp+14] 004015A7 . 897424 1C mov dword ptr [esp+1C], esi 004015AB . E8 FA020000 call <jmp.&MFC42.#537> 004015B0 . 6A 01 push 1
004015B2 . 8BCE mov ecx, esi 004015B4 . C74424 28 000>mov dword ptr [esp+28], 0
004015BC . E8 E3020000 call <jmp.&MFC42.#6334> ; MFC函數,此時,函數正在獲取對話框的數據
004015C1 . 8B7E 60 mov edi, dword ptr [esi+60] ; 執行完此指令,edi存着用戶名地址
004015C4 . 8B5F F8 mov ebx, dword ptr [edi-8] ; 用戶名長度
004015C7 . 83FB 05 cmp ebx, 5 ; 長度不能小於5
004015CA . 7C 7E jl short 0040164A
004015CC . 8B46 64 mov eax, dword ptr [esi+64] ; eax存着序列號地址
004015CF . 894424 14 mov dword ptr [esp+14], eax 004015D3 . 3958 F8 cmp dword ptr [eax-8], ebx ; 用戶名序列號長度是否相同?
004015D6 . 75 72 jnz short 0040164A
004015D8 . 83FB 14 cmp ebx, 14 ; 用戶名長度大於0x14?
004015DB . 7F 6D jg short 0040164A
004015DD . 33C9 xor ecx, ecx 004015DF . 85DB test ebx, ebx ; 長度為0,則跳轉。並沒有用的一條指令
004015E1 . 7E 54 jle short 00401637
004015E3 . 8B7424 10 mov esi, dword ptr [esp+10] ; 取密鑰
004015E7 > 8A040F mov al, byte ptr [edi+ecx] ; 迭代用戶名字串
004015EA . 0FBE2C31 movsx ebp, byte ptr [ecx+esi] ; 迭代密鑰
004015EE . 0FBEC0 movsx eax, al 004015F1 . 99 cdq ; 擴展指令
004015F2 . F7FD idiv ebp ; 用戶名字符除以密鑰字符
004015F4 . 8BC2 mov eax, edx ; 保留余數
004015F6 . D1E0 shl eax, 1 ; 左移1位
004015F8 . 83F8 7B cmp eax, 7B ; 小於等於7B?
004015FB . 7E 03 jle short 00401600
004015FD . 83E8 1A sub eax, 1A ; 大於7B則減去-1A
00401600 > 83F8 41 cmp eax, 41 ; 大於等於41?
00401603 . 7D 09 jge short 0040160E ; 是則進入下一cmp
00401605 . BA 82000000 mov edx, 82
0040160A . 2BD0 sub edx, eax ; edx-=eax
0040160C . 8BC2 mov eax, edx ; 保留edx
0040160E > 83F8 5B cmp eax, 5B ; 小於等於5B?
00401611 . 7E 12 jle short 00401625 ; 是則直接去序列號進行對比
00401613 . 83F8 61 cmp eax, 61 ; 大於等於61?
00401616 . 7D 0D jge short 00401625 ; 是則直接去序列號進行對比
00401618 . 99 cdq ; 否則eax除以10
00401619 . BD 0A000000 mov ebp, 0A
0040161E . F7FD idiv ebp 00401620 . 83C2 30 add edx, 30 ; 余數+30
00401623 . 8BC2 mov eax, edx ; 存入eax
00401625 > 8B5424 14 mov edx, dword ptr [esp+14] ; 取序列號
00401629 . 38040A cmp byte ptr [edx+ecx], al ; 序列號與處理結果是否相同?
0040162C . 75 1C jnz short 0040164A
0040162E . 41 inc ecx ; 循環變量自增
0040162F . 3BCB cmp ecx, ebx ; 迭代結束?
00401631 .^ 7C B4 jl short 004015E7
00401633 . 8B7424 18 mov esi, dword ptr [esp+18] 00401637 > 6A 00 push 0
00401639 . 68 34304000 push 00403034 ; ASCII "Congratulations!"
0040163E . 68 20304000 push 00403020 ; ASCII "Well done cracker!"
00401643 . 8BCE mov ecx, esi 00401645 . E8 54020000 call <jmp.&MFC42.#4224> ; MessageBox函數
以上就是注冊的關鍵代碼了,發現該程序調用了MFC函數,函數名並沒有在OD中顯示,不要緊,對比IDA中相同的地址就可以看到具體用了什么函數。快速破解這個程序需要對MFC有一定的了解。好了,仔細跟蹤代碼,發現程序采用了F(用戶名)=序列號的判斷形勢,我們用高級語言實現F(用戶名)即可。
打開http://www.cnblogs.com/ZRBYYXDM/p/5115596.html中搭建的框架,並修改OnBtnDecrypt函數如下:
void CKengen_TemplateDlg::OnBtnDecrypt() { // TODO: Add your control notification handler code here CString str; GetDlgItemText( IDC_EDIT_NAME,str ); //獲取用戶名字串基本信息。 int len = str.GetLength(); if ( len >= 5 && len <= 0x14 ){ //格式控制。 CString Serial = "31415926535897932384"; //密鑰 CString PassWord = str; //序列號 for ( int i = 0 ; i != len ; i++ ){ PassWord.SetAt( i,( PassWord[i] % Serial[i] ) << 1 ); if ( PassWord[i] > 0x7B ) PassWord.SetAt( i,PassWord[i] - 0x1A ); if ( PassWord[i] < 0x41 ) PassWord.SetAt( i,0x82 - PassWord[i] ); if ( PassWord[i] > 0x5B && PassWord[i] < 0x61 ) PassWord.SetAt( i,PassWord[i] % 10 + 0x30 ); } SetDlgItemText( IDC_EDIT_PASSWORD,PassWord ); } else MessageBox( "用戶名格式錯誤!" ); }
再在OnInitDialog中添加此代碼修改標題:SetWindowText(_T("Rith's CrackMe #1_Keygen"));
運行效果:
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。