【文章标题】: 一个简单的非明码比较(适全新手)
【文章作者】: bxm
【作者邮箱】: bxm78@163.com
【保护方式】: name,serial
【使用工具】: peid,od
【操作平台】: winxp
【作者声明】: 只是感兴趣,没有其他目的。失误之处敬请诸位大侠赐教!
--------------------------------------------------------------------------------
【详细过程】
用peid查壳,无壳,运行,收集足够信息用OD载入,通过出错提示“one of the details you entered was wrong”向上找,下断点在[004014F5],输入
name:bxm780
serial:780328051
004014F5 |. E8 AA030000 call <jmp.&MFC42.#3876_CWnd::GetWindowTextLeng>
004014FA |. 8945 EC mov [ebp-14], eax
004014FD |. 837D EC 05 cmp dword ptr [ebp-14], 5 ; name长度>5 ?
00401501 |. 7F 05 jg short 00401508 ; 不是,完蛋
00401503 |. E9 BB000000 jmp 004015C3
00401508 |> 8B4D E0 mov ecx, [ebp-20]
0040150B |. 83C1 60 add ecx, 60
0040150E |. E8 91030000 call <jmp.&MFC42.#3876_CWnd::GetWindowTextLeng>
00401513 |. 8945 E8 mov [ebp-18], eax
00401516 |. 837D E8 05 cmp dword ptr [ebp-18], 5 ; serial长度>5 ?
0040151A |. 7F 05 jg short 00401521 ; 不是,完蛋
0040151C |. E9 A2000000 jmp 004015C3
00401521 |> 8B45 E0 mov eax, [ebp-20]
00401524 |. 05 E0000000 add eax, 0E0
00401529 |. 50 push eax
0040152A |. 8B4D E0 mov ecx, [ebp-20]
0040152D |. 81C1 A0000000 add ecx, 0A0
00401533 |. E8 66030000 call <jmp.&MFC42.#3874_CWnd::GetWindowTextA>
00401538 |. 8B4D E0 mov ecx, [ebp-20]
0040153B |. 81C1 E4000000 add ecx, 0E4
00401541 |. 51 push ecx
00401542 |. 8B4D E0 mov ecx, [ebp-20]
00401545 |. 83C1 60 add ecx, 60
00401548 |. E8 51030000 call <jmp.&MFC42.#3874_CWnd::GetWindowTextA>
0040154D |. 8B55 E0 mov edx, [ebp-20]
00401550 |. 81C2 E0000000 add edx, 0E0
00401556 |. 52 push edx
00401557 |. 8D4D E4 lea ecx, [ebp-1C]
0040155A |. E8 39030000 call <jmp.&MFC42.#858_CString::operator=>
0040155F |. 8B45 E0 mov eax, [ebp-20]
00401562 |. 05 E4000000 add eax, 0E4
00401567 |. 50 push eax
00401568 |. 8D4D F0 lea ecx, [ebp-10]
0040156B |. E8 28030000 call <jmp.&MFC42.#858_CString::operator=>
00401570 |. 33C0 xor eax, eax
00401572 |. 33DB xor ebx, ebx
00401574 |. 33C9 xor ecx, ecx
00401576 |. B9 01000000 mov ecx, 1 ; ECX存入1
0040157B |. 33D2 xor edx, edx
0040157D |. 8B45 E4 mov eax, [ebp-1C] ; name入EAX
00401580 |> 8A18 /mov bl, [eax] ; name的每个字符依次入BL
00401582 |. 32D9 |xor bl, cl ; bl与cl异或
00401584 |. 8818 |mov [eax], bl ; 运算后的BL放入name原来的位置
00401586 |. 41 |inc ecx
00401587 |. 40 |inc eax
00401588 |. 8038 00 |cmp byte ptr [eax], 0 ; name读完没?
0040158B |.^ 75 F3 \jnz short 00401580 ; 没有,继续读
0040158D |. 33C0 xor eax, eax
0040158F |. 33DB xor ebx, ebx
00401591 |. 33C9 xor ecx, ecx
00401593 |. B9 0A000000 mov ecx, 0A ; ECX存入0A
00401598 |. 33D2 xor edx, edx
0040159A |. 8B45 F0 mov eax, [ebp-10] ; serial入EAX
0040159D |> 8A18 /mov bl, [eax] ; serial的每个字符依次入BL
0040159F |. 32D9 |xor bl, cl ; bl与cl异或
004015A1 |. 8818 |mov [eax], bl ; 运算后的BL放入serial原来的位置
004015A3 |. 41 |inc ecx
004015A4 |. 40 |inc eax
004015A5 |. 8038 00 |cmp byte ptr [eax], 0 ; serial读完没?
004015A8 |.^ 75 F3 \jnz short 0040159D ; 没有,继续读
004015AA |. 8B45 E4 mov eax, [ebp-1C] ; 运算后的name入EAX
004015AD |. 8B55 F0 mov edx, [ebp-10] ; 运算后的serial入EDX
004015B0 |> 33C9 /xor ecx, ecx
004015B2 |. 8A18 |mov bl, [eax] ; 运算后的name的每个字符依次入BL
004015B4 |. 8A0A |mov cl, [edx] ; 依次与运算后的serial的每个字符比较
004015B6 |. 3AD9 |cmp bl, cl
004015B8 |. 75 09 |jnz short 004015C3 ; 不相等,完蛋
004015BA |. 40 |inc eax
004015BB |. 42 |inc edx
004015BC |. 8038 00 |cmp byte ptr [eax], 0 ; 比完了吗?
004015BF |.^ 75 EF \jnz short 004015B0 ; 没比完,继续
004015C1 |. EB 16 jmp short 004015D9 ; 都比完了,跳向成功
004015C3 |> 6A 00 push 0
004015C5 |. 68 6C304000 push 0040306C ; error
004015CA |. 68 40304000 push 00403040 ; one of the details you entered was wrong
004015CF |. 8B4D E0 mov ecx, [ebp-20]
004015D2 |. E8 BB020000 call <jmp.&MFC42.#4224_CWnd::MessageBoxA>
004015D7 |. EB 14 jmp short 004015ED
004015D9 |> 6A 00 push 0
004015DB |. 68 34304000 push 00403034 ; you did it
004015E0 |. 68 20304000 push 00403020 ; well done,cracker
004015E5 |. 8B4D E0 mov ecx, [ebp-20]
004015E8 |. E8 A5020000 call <jmp.&MFC42.#4224_CWnd::MessageBoxA>
算法小结:
此算法比较简单,name的长度必须大于5,具体过程如下:
1、name的每个字符依次与1、2、……异或。
2、通过反推serial部分的算法可知,只要把第1步中的结果依次于0A,0B,……异或就得到注册码了。
可用的一组注册码:
name:bxm780
serial:iqb>39
附注册机:
#include <iostream.h>
#include <string.h>
void main()
{
char name[50],serial[50];
int i;
cout<<"please input name:\n";
cin>>name;
for(i=1;i<strlen(name)+1;i++)
name[i-1]^=char(i);
for(i=10;i<strlen(name)+10;i++)
serial[i-10]=name[i-10]^char(i);
serial[i-10]=0;
cout<<endl<<serial<<endl;
}
--------------------------------------------------------------------------------
【版权声明】: 本文原创于看雪技术论坛, 转载请注明作者并保持文章的完整, 谢谢!
2006年07月26日 下午 10:33:42
[培训]科锐逆向工程师培训第53期2025年7月8日开班!