高手飘过,我是菜鸟,自己练手的.这是某个破解教程里的一个CrackMe,由于简单就分析了下。
第一次搞这东西。虽然内容不多,但是搞得很累。
00401000 /$ 53 PUSH EBX
00401001 |. 8B5C24 0C MOV EBX,DWORD PTR SS:[ESP+C] ; ebx=code
00401005 |. 55 PUSH EBP
00401006 |. 56 PUSH ESI
00401007 |. 8B7424 10 MOV ESI,DWORD PTR SS:[ESP+10] ; esi=name
0040100B |. 8A0B MOV CL,BYTE PTR DS:[EBX]
0040100D |. 33ED XOR EBP,EBP
0040100F |. 57 PUSH EDI
00401010 |. 8A06 MOV AL,BYTE PTR DS:[ESI]
00401012 |. 3AC1 CMP AL,CL
00401014 |. 0F85 69010000 JNZ 第4课.00401183 ; code[0]!=name[0]则跳走
0040101A |. 8BFE MOV EDI,ESI ; edi=name
0040101C |. 83C9 FF OR ECX,FFFFFFFF ; ECX=FFFFFFFF
0040101F |. 33C0 XOR EAX,EAX ; EAX=0
00401021 |. F2:AE REPNE SCAS BYTE PTR ES:[EDI]
00401023 |. F7D1 NOT ECX
00401025 |. 49 DEC ECX
00401026 |. 83F9 05 CMP ECX,5
00401029 |. 0F82 54010000 JB 第4课.00401183 ; strlen(name)<5则跳走
0040102F |. 807B 01 2D CMP BYTE PTR DS:[EBX+1],2D ; code[1]!='-'则跳走
00401033 |. 0F85 4A010000 JNZ 第4课.00401183
00401039 |. 8BFE MOV EDI,ESI ; edi=name
0040103B |. 83C9 FF OR ECX,FFFFFFFF ; ECX=FFFFFFFF
0040103E |. 33C0 XOR EAX,EAX ; EAX=0
00401040 |. 33D2 XOR EDX,EDX ; EDX=0
00401042 |. F2:AE REPNE SCAS BYTE PTR ES:[EDI]
00401044 |. F7D1 NOT ECX
00401046 |. 49 DEC ECX
00401047 |. 74 17 JE SHORT 第4课.00401060 ; strlen(name)==0则跳走
00401049 |> 0FBE0C32 /MOVSX ECX,BYTE PTR DS:[EDX+ESI] ; ecx=name[edx]
0040104D |. 03E9 |ADD EBP,ECX ; ebp+=ecx ebp保存name个字符之和
0040104F |. 8BFE |MOV EDI,ESI ; edi=name
00401051 |. 83C9 FF |OR ECX,FFFFFFFF ; ECX=FFFFFFFF
00401054 |. 33C0 |XOR EAX,EAX ; EAX=0
00401056 |. 42 |INC EDX ; edx++
00401057 |. F2:AE |REPNE SCAS BYTE PTR ES:[EDI]
00401059 |. F7D1 |NOT ECX
0040105B |. 49 |DEC ECX
0040105C |. 3BD1 |CMP EDX,ECX
0040105E |.^ 72 E9 \JB SHORT 第4课.00401049 ; edx<strlen(name)则循环
00401060 |> 81C5 64600000 ADD EBP,6064 ; ebp+=6064
00401066 |. 55 PUSH EBP
00401067 |. 68 34604000 PUSH 第4课.00406034 ; ASCII "%lu"
0040106C |. 68 306B4000 PUSH 第4课.00406B30 ; ASCII "50232"
00401071 |. E8 B6030000 CALL 第4课.0040142C
00401076 |. 8A16 MOV DL,BYTE PTR DS:[ESI] ; dl=name[0]
00401078 |. 8BFE MOV EDI,ESI ; edi=name
0040107A |. 83C9 FF OR ECX,FFFFFFFF ; ECX=FFFFFFFF
0040107D |. 33C0 XOR EAX,EAX ; EAX=0
0040107F |. 8815 446B4000 MOV BYTE PTR DS:[406B44],DL ; *(406b44)=j
00401085 |. C605 456B4000>MOV BYTE PTR DS:[406B45],2D ; *(406b45)='-'
0040108C |. F2:AE REPNE SCAS BYTE PTR ES:[EDI]
0040108E |. F7D1 NOT ECX
00401090 |. 49 DEC ECX
00401091 |. 0FBE4431 FF MOVSX EAX,BYTE PTR DS:[ECX+ESI-1] ; eax=name[strlen(name)-1]
00401096 |. 50 PUSH EAX
00401097 |. E8 C4020000 CALL 第4课.00401360
0040109C |. A2 466B4000 MOV BYTE PTR DS:[406B46],AL ; *(406b46)='Y'
004010A1 |. BF 306B4000 MOV EDI,第4课.00406B30 ; ASCII "50232"
004010A6 |. 83C9 FF OR ECX,FFFFFFFF ; ECX=FFFFFFFF
004010A9 |. 33C0 XOR EAX,EAX ; eax=0
004010AB |. F2:AE REPNE SCAS BYTE PTR ES:[EDI]
004010AD |. F7D1 NOT ECX
004010AF |. 2BF9 SUB EDI,ECX ; edi=25556
004010B1 |. 81C5 64600000 ADD EBP,6064 ; ebp+=6064
004010B7 |. 8BF7 MOV ESI,EDI ; esi=25556
004010B9 |. 8BD1 MOV EDX,ECX ; edx=ecx=6
004010BB |. BF 446B4000 MOV EDI,第4课.00406B44 ; edi=j-Y
004010C0 |. 83C9 FF OR ECX,FFFFFFFF ; ECX=FFFFFFF
004010C3 |. F2:AE REPNE SCAS BYTE PTR ES:[EDI]
004010C5 |. 8BCA MOV ECX,EDX ; ecx=edx
004010C7 |. 4F DEC EDI
004010C8 |. C1E9 02 SHR ECX,2
004010CB |. F3:A5 REP MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI] ; strncat(edi,esi,4) edi='j-Y',esi=0D 056'
004010CD |. 8BCA MOV ECX,EDX ; ecx=edx
004010CF |. 55 PUSH EBP
004010D0 |. 83E1 03 AND ECX,3
004010D3 |. 68 34604000 PUSH 第4课.00406034 ; ASCII "%lu"
004010D8 |. F3:A4 REP MOVS BYTE PTR ES:[EDI],BYTE PTR DS:[ESI] ; strncat(edi,esi,1)
004010DA |. BF 30604000 MOV EDI,第4课.00406030 ; edi='-'
004010DF |. 83C9 FF OR ECX,FFFFFFFF
004010E2 |. F2:AE REPNE SCAS BYTE PTR ES:[EDI]
004010E4 |. F7D1 NOT ECX ; edi='-'
004010E6 |. 2BF9 SUB EDI,ECX
004010E8 |. 68 306B4000 PUSH 第4课.00406B30 ; ASCII "50232"
004010ED |. 8BF7 MOV ESI,EDI
004010EF |. 8BD1 MOV EDX,ECX ; edx=ecx=2
004010F1 |. BF 446B4000 MOV EDI,第4课.00406B44
004010F6 |. 83C9 FF OR ECX,FFFFFFFF
004010F9 |. F2:AE REPNE SCAS BYTE PTR ES:[EDI]
004010FB |. 8BCA MOV ECX,EDX
004010FD |. 4F DEC EDI
004010FE |. C1E9 02 SHR ECX,2
00401101 |. F3:A5 REP MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI] ; strncat(edi,esi,1) esi='-',edi='j-Y25556-
00401103 |. 8BCA MOV ECX,EDX ; ecx=edx=2
00401105 |. 83E1 03 AND ECX,3
00401108 |. F3:A4 REP MOVS BYTE PTR ES:[EDI],BYTE PTR DS:[ESI]
0040110A |. E8 1D030000 CALL 第4课.0040142C
0040110F |. BF 306B4000 MOV EDI,第4课.00406B30 ; ASCII "50232"
00401114 |. 83C9 FF OR ECX,FFFFFFFF
00401117 |. 33C0 XOR EAX,EAX
00401119 |. 83C4 1C ADD ESP,1C
0040111C |. F2:AE REPNE SCAS BYTE PTR ES:[EDI]
0040111E |. F7D1 NOT ECX
00401120 |. 2BF9 SUB EDI,ECX ; edi='50232'
00401122 |. 8BF7 MOV ESI,EDI ; esi=edi='50232'
00401124 |. 8BD1 MOV EDX,ECX ; edx=ecx=6
00401126 |. BF 446B4000 MOV EDI,第4课.00406B44
0040112B |. 83C9 FF OR ECX,FFFFFFFF
0040112E |. F2:AE REPNE SCAS BYTE PTR ES:[EDI]
00401130 |. 8BCA MOV ECX,EDX ; ecx=edx=6
00401132 |. 4F DEC EDI
00401133 |. C1E9 02 SHR ECX,2
00401136 |. F3:A5 REP MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI] ; strncat(edi,esi,4)
00401138 |. 8BCA MOV ECX,EDX ; ecx=edx=6
0040113A |. 8BC3 MOV EAX,EBX
0040113C |. 83E1 03 AND ECX,3
0040113F |. F3:A4 REP MOVS BYTE PTR ES:[EDI],BYTE PTR DS:[ESI]
00401141 |. BE 446B4000 MOV ESI,第4课.00406B44 ;esi中保存的已经是正确的注册码了
00401146 |> 8A10 /MOV DL,BYTE PTR DS:[EAX] ; dl=code[i]
00401148 |. 8A1E |MOV BL,BYTE PTR DS:[ESI] ; bl=regcode[i]
0040114A |. 8ACA |MOV CL,DL
0040114C |. 3AD3 |CMP DL,BL
0040114E |. 75 25 |JNZ SHORT 第4课.00401175 ; code[i]!=regcode[i],则跳走
00401150 |. 84C9 |TEST CL,CL
00401152 |. 74 16 |JE SHORT 第4课.0040116A
00401154 |. 8A50 01 |MOV DL,BYTE PTR DS:[EAX+1] ; dl=code[i+1]
00401157 |. 8A5E 01 |MOV BL,BYTE PTR DS:[ESI+1] ; bl=regcode[i+1]
0040115A |. 8ACA |MOV CL,DL
0040115C |. 3AD3 |CMP DL,BL
0040115E |. 75 15 |JNZ SHORT 第4课.00401175 ; code[i+1]!=regcode[i+1],则跳走
00401160 |. 83C0 02 |ADD EAX,2
00401163 |. 83C6 02 |ADD ESI,2
00401166 |. 84C9 |TEST CL,CL
00401168 |.^ 75 DC \JNZ SHORT 第4课.00401146
0040116A |> 33C0 XOR EAX,EAX
0040116C |. 33D2 XOR EDX,EDX
0040116E |. 85C0 TEST EAX,EAX
00401170 |. 0F94C2 SETE DL
00401173 |. EB 12 JMP SHORT 第4课.00401187
00401175 |> 1BC0 SBB EAX,EAX
00401177 |. 83D8 FF SBB EAX,-1
0040117A |. 33D2 XOR EDX,EDX
0040117C |. 85C0 TEST EAX,EAX
0040117E |. 0F94C2 SETE DL
00401181 |. EB 04 JMP SHORT 第4课.00401187
00401183 |> 8B5424 14 MOV EDX,DWORD PTR SS:[ESP+14]
00401187 |> B9 40000000 MOV ECX,40
0040118C |. 33C0 XOR EAX,EAX
0040118E |. BF 446B4000 MOV EDI,第4课.00406B44
00401193 |. F3:AB REP STOS DWORD PTR ES:[EDI]
00401195 |. 5F POP EDI
00401196 |. 5E POP ESI
00401197 |. 5D POP EBP
00401198 |. 8BC2 MOV EAX,EDX
0040119A |. 5B POP EBX
0040119B \. C3 RETN
keygen:
#include <stdio.h>
#include <windows.h>
#include "conio.h"
int main()
{
char id[50]={0};
char reg[15]={0};
char *treg=NULL;
unsigned int sum=0;
printf("input name,name lenght >= 5:");
scanf("%s",id);
for(treg=id;*treg;)
{
sum+=*(treg)++;
}
wsprintf(treg=reg,"%c-%c%u-%u",id[0],((id[strlen(id)-1]>='a'&&id[strlen(id)-1]<='z')?id[strlen(id)-1] & 0xdf:id[strlen(id)-1]),sum+0x6064,sum+0x6064+0x6064);
printf("注册码为:%s\n",reg);
getch();
return 0;
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!