加密解密2光盤中一個(gè)CRACKME的算法分析
來(lái)源:龍人計(jì)算機(jī)研究所 作者:站長(zhǎng) 時(shí)間:2006-11-07 15:09:11
【破文標(biāo)題】CRACKME算法分析
【破文作者】逍遙風(fēng)[OCN][PYG]
【作者郵箱】tc-xb@163.com
【破解工具】OD PEID
【破解平臺(tái)】WINXP
------------------------------------------------------------------------
1)PEID檢查,Borland Delphi 3.0 無(wú)殼
2)根據(jù)錯(cuò)誤提示,用OD的字符串查找,很容易來(lái)到如下代碼處00427B44 /. 55 PUSH EBP
00427B45 |. 8BEC MOV EBP,ESP
00427B47 |. 6A 00 PUSH 0
00427B49 |. 6A 00 PUSH 0
00427B4B |. 53 PUSH EBX
00427B4C |. 8BD8 MOV EBX,EAX
00427B4E |. 33C0 XOR EAX,EAX
00427B50 |. 55 PUSH EBP
00427B51 |. 68 FA7B4200 PUSH echap515.00427BFA
00427B56 |. 64:FF30 PUSH DWORD PTR FS:[EAX]
00427B59 |. 64:8920 MOV DWORD PTR FS:[EAX],ESP
00427B5C |. 8D55 FC LEA EDX,DWORD PTR SS:[EBP-4]
00427B5F |. 8B83 DC010000 MOV EAX,DWORD PTR DS:[EBX+1DC]
00427B65 |. E8 26E2FEFF CALL echap515.00415D90 ; 取注冊(cè)名
00427B6A |. 8B45 FC MOV EAX,DWORD PTR SS:[EBP-4] ; EBP-4=注冊(cè)名
00427B6D |. E8 3EBCFDFF CALL echap515.004037B0 ; 取注冊(cè)名位數(shù)
00427B72 |. 48 DEC EAX ; 注冊(cè)名位數(shù)減1
00427B73 |. 7C 30 JL SHORT echap515.00427BA5
00427B75 |. 8D55 FC LEA EDX,DWORD PTR SS:[EBP-4]
00427B78 |. 8B83 EC010000 MOV EAX,DWORD PTR DS:[EBX+1EC]
00427B7E |. E8 0DE2FEFF CALL echap515.00415D90 ; 取假碼位數(shù)
00427B83 |. 8B45 FC MOV EAX,DWORD PTR SS:[EBP-4] ; EBP-4=假碼
00427B86 |. 50 PUSH EAX
00427B87 |. 8D55 F8 LEA EDX,DWORD PTR SS:[EBP-8]
00427B8A |. 8B83 DC010000 MOV EAX,DWORD PTR DS:[EBX+1DC]
00427B90 |. E8 FBE1FEFF CALL echap515.00415D90 ; 取注冊(cè)名位數(shù)
00427B95 |. 8B45 F8 MOV EAX,DWORD PTR SS:[EBP-8] ; EBP-8=注冊(cè)名
00427B98 |. 5A POP EDX
00427B99 |. E8 82FEFFFF CALL echap515.00427A20 ; 算法CALL。。。
00427B9E |. 3D 4E61BC00 CMP EAX,0BC614E
00427BA3 |. 7D 1E JGE SHORT echap515.00427BC3
00427BA5 |> 6A 00 PUSH 0
00427BA7 |. 68 087C4200 PUSH echap515.00427C08 ; error
00427BAC |. 68 107C4200 PUSH echap515.00427C10 ; wrong serial number !
00427BB1 |. A1 44974200 MOV EAX,DWORD PTR DS:[429744]
00427BB6 |. E8 411EFFFF CALL echap515.004199FC
00427BBB |. 50 PUSH EAX ; |hOwner
00427BBC |. E8 4FD9FDFF CALL <JMP.&user32.MessageBoxA> ; \MessageBoxA
00427BC1 |. EB 1C JMP SHORT echap515.00427BDF
00427BC3 |> 6A 00 PUSH 0
00427BC5 |. 68 287C4200 PUSH echap515.00427C28 ; success
00427BCA |. 68 307C4200 PUSH echap515.00427C30 ; congratulation !
進(jìn)入算法CALL。。。
00427A20 /$ 55 PUSH EBP
00427A21 |. 8BEC MOV EBP,ESP
00427A23 |. 83C4 F0 ADD ESP,-10
00427A26 |. 53 PUSH EBX
00427A27 |. 56 PUSH ESI
00427A28 |. 33C9 XOR ECX,ECX
00427A2A |. 894D F0 MOV DWORD PTR SS:[EBP-10],ECX
00427A2D |. 894D F4 MOV DWORD PTR SS:[EBP-C],ECX
00427A30 |. 8955 F8 MOV DWORD PTR SS:[EBP-8],EDX
00427A33 |. 8945 FC MOV DWORD PTR SS:[EBP-4],EAX
00427A36 |. 8B45 FC MOV EAX,DWORD PTR SS:[EBP-4]
00427A39 |. E8 26BFFDFF CALL echap515.00403964
00427A3E |. 8B45 F8 MOV EAX,DWORD PTR SS:[EBP-8]
00427A41 |. E8 1EBFFDFF CALL echap515.00403964
00427A46 |. 33C0 XOR EAX,EAX
00427A48 |. 55 PUSH EBP
00427A49 |. 68 2A7B4200 PUSH echap515.00427B2A
00427A4E |. 64:FF30 PUSH DWORD PTR FS:[EAX]
00427A51 |. 64:8920 MOV DWORD PTR FS:[EAX],ESP
00427A54 |. 33DB XOR EBX,EBX
00427A56 |. 8B45 FC MOV EAX,DWORD PTR SS:[EBP-4]
00427A59 |. E8 52BDFDFF CALL echap515.004037B0
00427A5E |. 8BF0 MOV ESI,EAX
00427A60 |. 85F6 TEST ESI,ESI
00427A62 |. 7E 3C JLE SHORT echap515.00427AA0
00427A64 |. B8 01000000 MOV EAX,1
00427A69 |> 8BD0 /MOV EDX,EAX
00427A6B |. 8B4D FC |MOV ECX,DWORD PTR SS:[EBP-4]
00427A6E |. 0FB64C11 FF |MOVZX ECX,BYTE PTR DS:[ECX+EDX-1]
00427A73 |. 03D9 |ADD EBX,ECX
00427A75 |. 71 05 |JNO SHORT echap515.00427A7C
00427A77 |. E8 B4AFFDFF |CALL echap515.00402A30
00427A7C |> C1E3 08 |SHL EBX,8
00427A7F |. 8B0D 80884200 |MOV ECX,DWORD PTR DS:[428880]
00427A85 |. 0FB65411 FF |MOVZX EDX,BYTE PTR DS:[ECX+EDX-1]
00427A8A |. 0BDA |OR EBX,EDX
00427A8C |. 85DB |TEST EBX,EBX
00427A8E |. 7D 0C |JGE SHORT echap515.00427A9C
00427A90 |. 6BD3 FF |IMUL EDX,EBX,-1
00427A93 |. 71 05 |JNO SHORT echap515.00427A9A
00427A95 |. E8 96AFFDFF |CALL echap515.00402A30
00427A9A |> 8BDA |MOV EBX,EDX
00427A9C |> 40 |INC EAX
00427A9D |. 4E |DEC ESI
00427A9E |.^ 75 C9 \JNZ SHORT echap515.00427A69
00427AA0 |> 81F3 78563412 XOR EBX,12345678
00427AA6 |. 8D55 F0 LEA EDX,DWORD PTR SS:[EBP-10]
00427AA9 |. 8BC3 MOV EAX,EBX
00427AAB |. E8 44E9FDFF CALL echap515.004063F4
00427AB0 |. 8B45 F0 MOV EAX,DWORD PTR SS:[EBP-10]
00427AB3 |. E8 F8BCFDFF CALL echap515.004037B0
00427AB8 |. 8BF0 MOV ESI,EAX
00427ABA |. 85F6 TEST ESI,ESI
00427ABC |. 7E 38 JLE SHORT echap515.00427AF6
00427ABE |> 8BC3 /MOV EAX,EBX
00427AC5 |. 99 |CDQ
00427AC6 |. F7F9 |IDIV ECX
00427AC8 |. 6215 3C7B4200 |BOUND EDX,QWORD PTR DS:[427B3C]
00427ACE |. 8A92 84884200 |MOV DL,BYTE PTR DS:[EDX+428884]
00427AD4 |. 8D45 F0 |LEA EAX,DWORD PTR SS:[EBP-10]
00427AD7 |. E8 FCBBFDFF |CALL echap515.004036D8
00427ADC |. 8B55 F0 |MOV EDX,DWORD PTR SS:[EBP-10]
00427ADF |. 8D45 F4 |LEA EAX,DWORD PTR SS:[EBP-C]
00427AE2 |. E8 D1BCFDFF |CALL echap515.004037B8
00427AE7 |. 8BC3 |MOV EAX,EBX
00427AE9 |. B9 0A000000 |MOV ECX,0A
00427AEE |. 99 |CDQ
00427AEF |. F7F9 |IDIV ECX
00427AF1 |. 8BD8 |MOV EBX,EAX
00427AF3 |. 4E |DEC ESI
00427AF4 |.^ 75 C8 \JNZ SHORT echap515.00427ABE
省略一些代碼。。。
00427B33 . 5E POP ESI
00427B34 . 5B POP EBX
00427B35 . 8BE5 MOV ESP,EBP
00427B37 . 5D POP EBP
00427B38 . C3 RETN
------------------------------------------------------------------------
算法總結(jié):
算法中要用到兩張固定的表,表1:LANNYDIBANDINGINANAKEKHYANGNGENTOT
表2:LANNY5646521
1)注冊(cè)名每一位ASCII值加上上一次計(jì)算結(jié)果Cn,得到An,An乘以2的8次方得到Bn.
查表1取與注冊(cè)名各位位數(shù)對(duì)應(yīng)字符的HEX值(注冊(cè)名第一位,就取表1中的第一位)
Bn與對(duì)應(yīng)的HEX值進(jìn)行OR運(yùn)算,得到C(n+1) (注:C1=0)。
2)最終結(jié)果C(n+1)與12345678進(jìn)行XOR運(yùn)算。所得結(jié)果為D。
3)將D轉(zhuǎn)換成對(duì)應(yīng)的10進(jìn)制數(shù)。并取這個(gè)十進(jìn)制數(shù)的位數(shù)做為下次循環(huán)計(jì)算的循環(huán)次數(shù)
4)En除以0A(定值),在表2中取與余數(shù)對(duì)應(yīng)位數(shù)的字符的后一位字符
(例:某次計(jì)算所得余數(shù)為2,就對(duì)應(yīng)表2中的第3個(gè)字符),并將每一次得到的字符合并成注冊(cè)碼。
En除以0A(定值)的商作為E(n+1)。循環(huán)計(jì)算 注意:E1=D
例:注冊(cè)名tc
1)74+0=74。74*100(16進(jìn)制中2的8次方)=7400,7400(OR)4C=744C
63+744C=74AF。74AF*100=74AF00,74AF00(OR)41=74AF41
2)74AF41(XOR)12345678=1240F939
3)1240F939對(duì)應(yīng)的十進(jìn)制數(shù)=306247993,它有9位。
4)1240F939除以0A商為1D34C1F,余數(shù)為3,對(duì)應(yīng)表2中第4位的字符N
1D34C1F 除以0A商為2EBACF,余數(shù)為9,對(duì)應(yīng)表中第10位字符5
2EBACF除以0A商為。。。。。。依次類推。
注冊(cè)名:tc
注冊(cè)碼:N554YN6LN