能力值:
( LV9,RANK:1170 )
|
-
-
9 楼
我帮你贴个算法分析吧。
【文章标题】: 一个简单VB程序的破解
【文章作者】: bxm
【作者邮箱】: bxm78@163.com
【保护方式】: 用户名、注册码
【编写语言】: VB
【使用工具】: OD、计算器、VB Decompiler Lite
【操作平台】: winxp
【作者声明】: 只是感兴趣,没有其他目的。失误之处敬请诸位大侠赐教!
--------------------------------------------------------------------------------
【详细过程】
用VB Decompiler Lite找到关键断点下断:
00402A42 . 8985 14FFFFFF mov [ebp-EC], eax ; 用户名长度入[ebp-EC]
00402A48 . 66:C786 8C000>mov word ptr [esi+8C], 1
00402A51 > 66:8B86 8C000>mov ax, [esi+8C] ; [esi+8c]为循环计数器
00402A58 . C745 C4 04000>mov dword ptr [ebp-3C], 80020004
00402A5F . 66:3B85 14FFF>cmp ax, [ebp-EC]
00402A66 . C745 BC 0A000>mov dword ptr [ebp-44], 0A
00402A6D . 0F8F 61010000 jg 00402BD4 ; 用户名读完了,跳
00402A73 . 8D8E 90000000 lea ecx, [esi+90]
00402A79 . C785 6CFFFFFF>mov dword ptr [ebp-94], 4008
00402A83 . 898D 74FFFFFF mov [ebp-8C], ecx
00402A89 . 8D4D BC lea ecx, [ebp-44]
00402A8C . 0FBFD0 movsx edx, ax
00402A8F . 51 push ecx
00402A90 . 8D85 6CFFFFFF lea eax, [ebp-94]
00402A96 . 52 push edx
00402A97 . 8D4D AC lea ecx, [ebp-54]
00402A9A . 50 push eax
00402A9B . 51 push ecx
00402A9C . FF15 50104000 call [<&MSVBVM60.#632>] ; MSVBVM60.rtcMidCharVar
00402AA2 . 8D55 AC lea edx, [ebp-54]
00402AA5 . 8D45 D8 lea eax, [ebp-28]
00402AA8 . 52 push edx
00402AA9 . 50 push eax
00402AAA . FF15 88104000 call [<&MSVBVM60.__vbaStrVarVal>] ; MSVBVM60.__vbaStrVarVal
00402AB0 . 50 push eax
00402AB1 . FF15 28104000 call [<&MSVBVM60.#516>] ; 依次取用户名的每个字符
00402AB7 . 8D95 4CFFFFFF lea edx, [ebp-B4]
00402ABD . 8D4E 34 lea ecx, [esi+34]
00402AC0 . 66:8985 54FFF>mov [ebp-AC], ax
00402AC7 . C785 4CFFFFFF>mov dword ptr [ebp-B4], 2
00402AD1 . FFD3 call ebx
00402AD3 . 8D4D D8 lea ecx, [ebp-28]
00402AD6 . FF15 D8104000 call [<&MSVBVM60.__vbaFreeStr>] ; MSVBVM60.__vbaFreeStr
00402ADC . 8D4D AC lea ecx, [ebp-54]
00402ADF . 8D55 BC lea edx, [ebp-44]
00402AE2 . 51 push ecx
00402AE3 . 52 push edx
00402AE4 . 6A 02 push 2
00402AE6 . FF15 18104000 call [<&MSVBVM60.__vbaFreeVarList>; MSVBVM60.__vbaFreeVarList
00402AEC . 83C4 0C add esp, 0C
00402AEF . 8D46 34 lea eax, [esi+34]
00402AF2 . C785 74FFFFFF>mov dword ptr [ebp-8C], 60
00402AFC . C785 6CFFFFFF>mov dword ptr [ebp-94], 8002
00402B06 . 50 push eax
00402B07 . 8D85 6CFFFFFF lea eax, [ebp-94]
00402B0D . 50 push eax
00402B0E . FF15 C4104000 call [<&MSVBVM60.__vbaVarTstGe>] ; MSVBVM60.__vbaVarTstGe
00402B14 . 66:85C0 test ax, ax
00402B17 . 74 39 je short 00402B52
00402B19 . 8D46 34 lea eax, [esi+34]
00402B1C . 8D8D 6CFFFFFF lea ecx, [ebp-94]
00402B22 . 50 push eax
00402B23 . 8D55 BC lea edx, [ebp-44]
00402B26 . 51 push ecx
00402B27 . 52 push edx
00402B28 . C785 74FFFFFF>mov dword ptr [ebp-8C], 3
00402B32 . C785 6CFFFFFF>mov dword ptr [ebp-94], 2
00402B3C . FF15 BC104000 call [<&MSVBVM60.__vbaVarAdd>] ; 取出的字符+3,结果记为A
00402B42 . 8BD0 mov edx, eax
00402B44 . 8D4E 34 lea ecx, [esi+34]
00402B47 . FFD3 call ebx
00402B49 . 8D4D BC lea ecx, [ebp-44]
00402B4C . FF15 10104000 call [<&MSVBVM60.__vbaFreeVar>] ; MSVBVM60.__vbaFreeVar
00402B52 > 8D46 44 lea eax, [esi+44]
00402B55 . 50 push eax
00402B56 . 8D46 34 lea eax, [esi+34]
00402B59 . 50 push eax
00402B5A . 8D45 BC lea eax, [ebp-44]
00402B5D . 50 push eax
00402B5E . FF15 BC104000 call [<&MSVBVM60.__vbaVarAdd>] ; A+上一次循环的结果(第一次循环时,初始值为0),结果记为B
00402B64 . 8BD0 mov edx, eax
00402B66 . 8D4E 44 lea ecx, [esi+44]
00402B69 . FFD3 call ebx
00402B6B . 8D4D BC lea ecx, [ebp-44]
00402B6E . FF15 10104000 call [<&MSVBVM60.__vbaFreeVar>] ; MSVBVM60.__vbaFreeVar
00402B74 . 8D46 44 lea eax, [esi+44]
00402B77 . 8D8D 6CFFFFFF lea ecx, [ebp-94]
00402B7D . 50 push eax
00402B7E . 8D46 7C lea eax, [esi+7C]
00402B81 . 50 push eax
00402B82 . 8D55 BC lea edx, [ebp-44]
00402B85 . 51 push ecx
00402B86 . 52 push edx
00402B87 . C785 74FFFFFF>mov dword ptr [ebp-8C], 3
00402B91 . C785 6CFFFFFF>mov dword ptr [ebp-94], 2
00402B9B . FF15 00104000 call [<&MSVBVM60.__vbaVarSub>] ; 用户名长度-3,结果记为C
00402BA1 . 50 push eax
00402BA2 . 8D45 AC lea eax, [ebp-54]
00402BA5 . 50 push eax
00402BA6 . FF15 74104000 call [<&MSVBVM60.__vbaVarMul>] ; B*C
00402BAC . 8BD0 mov edx, eax
00402BAE . 8D4E 44 lea ecx, [esi+44]
00402BB1 . FFD3 call ebx
00402BB3 . 66:8B8E 8C000>mov cx, [esi+8C]
00402BBA . B8 01000000 mov eax, 1
00402BBF . 66:03C8 add cx, ax
00402BC2 . 0F80 DB230000 jo 00404FA3
00402BC8 . 66:898E 8C000>mov [esi+8C], cx
00402BCF .^ E9 7DFEFFFF jmp 00402A51 ; 循环
以上程序功能:
char name[20];
long int sum=0,i;
for(i=0;i<用户名长度;i++)
{
sum=sum+name[i]+3;
sum=sum*(用户名长度-3);
}
=================================================================
省略一些代码……
00402C47 . FF15 28104000 call [<&MSVBVM60.#516>] ; 返回用户名的第3个字符
00402C4D . 66:8BD0 mov dx, ax
00402C50 . 8D4D AC lea ecx, [ebp-54]
00402C53 . 8D45 D8 lea eax, [ebp-28]
00402C56 . 51 push ecx
00402C57 . 50 push eax
00402C58 . 66:8995 0AFFF>mov [ebp-F6], dx
00402C5F . FFD3 call ebx
00402C61 . 50 push eax
00402C62 . FF15 28104000 call [<&MSVBVM60.#516>] ; 返回用户名的第1个字符
00402C68 . 66:8B8D 0AFFF>mov cx, [ebp-F6] ; 用户名的第3个字符入CX
00402C6F . 8D5E 44 lea ebx, [esi+44]
00402C72 . 66:03C8 add cx, ax ; CX+AX,结果记为G
00402C75 . 8D95 2CFFFFFF lea edx, [ebp-D4]
00402C7B . 53 push ebx
00402C7C . 8D85 7CFFFFFF lea eax, [ebp-84]
00402C82 . 52 push edx
00402C83 . 50 push eax
00402C84 . 0F80 19230000 jo 00404FA3
00402C8A . 66:898D 34FFF>mov [ebp-CC], cx
00402C91 . C785 2CFFFFFF>mov dword ptr [ebp-D4], 2
00402C9B . FF15 38104000 call [<&MSVBVM60.__vbaVarXor>] ; 上一次的循环运算结果与G异或,结果记为D
省略一些代码……
00404423 . FF15 74104000 call [<&MSVBVM60.__vbaVarMul>] ; D*用户名长度=E
00404429 . 50 push eax
0040442A . 8D46 7C lea eax, [esi+7C]
0040442D . 50 push eax
0040442E . 8D45 AC lea eax, [ebp-54]
00404431 . 50 push eax
00404432 . FF15 BC104000 call [<&MSVBVM60.__vbaVarAdd>] ; E+用户名长度
00404438 . 8BD0 mov edx, eax
0040443A . 8D4E 44 lea ecx, [esi+44]
0040443D . FF15 0C104000 call [<&MSVBVM60.__vbaVarMove>] ; MSVBVM60.__vbaVarMove
00404443 . 8D4D AC lea ecx, [ebp-54]
00404446 . FF15 10104000 call [<&MSVBVM60.__vbaFreeVar>] ; MSVBVM60.__vbaFreeVar
0040444C . 8B4E 74 mov ecx, [esi+74]
0040444F . 8B56 78 mov edx, [esi+78]
00404452 . 8D85 6CFFFFFF lea eax, [ebp-94]
00404458 . 898D 74FFFFFF mov [ebp-8C], ecx
0040445E . 50 push eax
0040445F . 8D46 44 lea eax, [esi+44]
00404462 . 50 push eax
00404463 . 8995 78FFFFFF mov [ebp-88], edx
00404469 . C785 6CFFFFFF>mov dword ptr [ebp-94], 8005
00404473 . FF15 60104000 call [<&MSVBVM60.__vbaVarTstEq>] ; 真、假码的十六进制比较
00404479 . 66:85C0 test ax, ax
0040447C . 74 46 je short 004044C4
0040447E . A1 10604000 mov eax, [406010]
00404483 . 85C0 test eax, eax
00404485 . 75 10 jnz short 00404497
00404487 . 68 10604000 push 00406010
0040448C . 68 68204000 push 00402068
00404491 . FF15 98104000 call [<&MSVBVM60.__vbaNew2>] ; MSVBVM60.__vbaNew2
00404497 > A1 10604000 mov eax, [406010]
0040449C . 68 781E4000 push 00401E78 ; 真的强啊,兄弟
此段代码功能:
(sum ^(用户名的第1个字符+第3个字符))*用户名长度+用户名长度,然后真假码比较
要想得到正确的注册码,只要把此结果转换成十进制即可。
附可用的一组注册码:
用户名:bxm78
注册码:33060
--------------------------------------------------------------------------------
【版权声明】: 本文原创于看雪技术论坛, 转载请注明作者并保持文章的完整, 谢谢!
2006年09月27日 下午 10:13:08
|