【文章标题】: Bjanes's #2算法分析(VB简单)
【文章作者】: bxm
【作者邮箱】: bxm78@163.com
【保护方式】: name,serial
【编写语言】: Microsoft Visual Basic 5.0 / 6.0
【使用工具】: OD,计算器
【操作平台】: winxp
【作者声明】: 只是感兴趣,没有其他目的。失误之处敬请诸位大侠赐教!
--------------------------------------------------------------------------------
【详细过程】
通过字符串参考在[00404596]下断点,输入
name:bxm78
serial:780328051
00404596 > \8B55 D4 mov edx, [ebp-2C] ; name入EDX
00404599 . 52 push edx
0040459A . FF15 10104000 call [<&MSVBVM60.__vbaLenBstr>] ; EAX返回name长度
004045A0 . 33C9 xor ecx, ecx
004045A2 . 83F8 02 cmp eax, 2 ; EAX>=2 ?
004045A5 . 0F9CC1 setl cl ; 是,CL置0,否则置1
004045A8 . F7D9 neg ecx
004045AA . 898D 3CFFFFFF mov [ebp-C4], ecx
004045B0 . 8D4D D4 lea ecx, [ebp-2C]
004045B3 . FF15 D0104000 call [<&MSVBVM60.__vbaFreeStr>] ; MSVBVM60.__vbaFreeStr
004045B9 . 8D4D CC lea ecx, [ebp-34]
004045BC . FF15 D4104000 call [<&MSVBVM60.__vbaFreeObj>] ; MSVBVM60.__vbaFreeObj
004045C2 . 66:39BD 3CFFF>cmp [ebp-C4], di
004045C9 . 0F84 8B000000 je 0040465A ; 检查name长度是否符合要求
……省略一些代码……
00404694 . FF15 B4104000 call [<&MSVBVM60.#617>] ; 取name的第1个字符
0040469A . 8B45 C8 mov eax, [ebp-38]
0040469D . 8D4D 98 lea ecx, [ebp-68]
004046A0 . 6A 01 push 1
004046A2 . 8D55 88 lea edx, [ebp-78]
004046A5 . 51 push ecx
004046A6 . 52 push edx
004046A7 . 897D C8 mov [ebp-38], edi
004046AA . 8945 A0 mov [ebp-60], eax
004046AD . C745 98 09000>mov dword ptr [ebp-68], 9
004046B4 . FF15 C0104000 call [<&MSVBVM60.#619>] ; 取name的最后1个字符
004046BA . 8B3D 80104000 mov edi, [<&MSVBVM60.__vbaStrVarVal>>; MSVBVM60.__vbaStrVarVal
004046C0 . 8D45 88 lea eax, [ebp-78]
004046C3 . 8D4D D0 lea ecx, [ebp-30]
004046C6 . 50 push eax
004046C7 . 51 push ecx
004046C8 . FFD7 call edi ; <&MSVBVM60.__vbaStrVarVal>
004046CA . 50 push eax
004046CB . FF15 24104000 call [<&MSVBVM60.#516>] ; MSVBVM60.rtcAnsiValueBstr
004046D1 . 66:8BD0 mov dx, ax
004046D4 . 8D45 A8 lea eax, [ebp-58]
004046D7 . 8D4D D4 lea ecx, [ebp-2C]
004046DA . 50 push eax
004046DB . 51 push ecx
004046DC . 66:8995 26FFF>mov [ebp-DA], dx
004046E3 . FFD7 call edi
004046E5 . 50 push eax
004046E6 . FF15 24104000 call [<&MSVBVM60.#516>] ; EAX返回取得的第1个字符
004046EC . 66:8B95 26FFF>mov dx, [ebp-DA] ; name最后1个字符入DX
004046F3 . 8D4D D8 lea ecx, [ebp-28]
004046F6 . 66:03D0 add dx, ax ; DX+AX=9A
004046F9 . C785 78FFFFFF>mov dword ptr [ebp-88], 2
00404703 . 0F80 94030000 jo 00404A9D ; 溢出转移
00404709 . 66:8955 80 mov [ebp-80], dx ; DX存入[ebp-80]
0040470D . 8D95 78FFFFFF lea edx, [ebp-88]
00404713 . FF15 08104000 call [<&MSVBVM60.__vbaVarMove>] ; MSVBVM60.__vbaVarMove
00404719 . 8D45 D0 lea eax, [ebp-30]
0040471C . 8D4D D4 lea ecx, [ebp-2C]
0040471F . 50 push eax
00404720 . 51 push ecx
00404721 . 6A 02 push 2
00404723 . FF15 9C104000 call [<&MSVBVM60.__vbaFreeStrList>] ; MSVBVM60.__vbaFreeStrList
00404729 . 8D55 C8 lea edx, [ebp-38]
0040472C . 8D45 CC lea eax, [ebp-34]
0040472F . 52 push edx
00404730 . 50 push eax
00404731 . 6A 02 push 2
00404733 . FF15 20104000 call [<&MSVBVM60.__vbaFreeObjList>] ; MSVBVM60.__vbaFreeObjList
00404739 . 8D4D 88 lea ecx, [ebp-78]
0040473C . 8D55 98 lea edx, [ebp-68]
0040473F . 51 push ecx
00404740 . 8D45 A8 lea eax, [ebp-58]
00404743 . 52 push edx
00404744 . 8D4D B8 lea ecx, [ebp-48]
00404747 . 50 push eax
00404748 . 51 push ecx
00404749 . 6A 04 push 4
0040474B . FF15 14104000 call [<&MSVBVM60.__vbaFreeVarList>] ; MSVBVM60.__vbaFreeVarList
00404751 . 83C4 2C add esp, 2C
00404754 . 8D55 D8 lea edx, [ebp-28]
00404757 . 8D85 78FFFFFF lea eax, [ebp-88]
0040475D . 8D4D B8 lea ecx, [ebp-48]
00404760 . 52 push edx ; 上面相加和作为乘数1,入栈
00404761 . 50 push eax ; [EAX+8],即下面的0F423F入栈作为乘数2
00404762 . 51 push ecx
00404763 . C745 80 3F420>mov dword ptr [ebp-80], 0F423F
0040476A . C785 78FFFFFF>mov dword ptr [ebp-88], 3
00404774 . FF15 6C104000 call [<&MSVBVM60.__vbaVarMul>] ; 相乘
……省略一些代码……
004048B6 > \8D95 78FFFFFF lea edx, [ebp-88] ; name计算结果地址入EDX
004048BC . 52 push edx
004048BD . FF15 84104000 call [<&MSVBVM60.#536>] ; 把EDX转换成十进制字符串,如果前面有0转换空格
004048C3 . 8BD0 mov edx, eax
004048C5 . 8D4D D0 lea ecx, [ebp-30]
004048C8 . FF15 BC104000 call [<&MSVBVM60.__vbaStrMove>] ; MSVBVM60.__vbaStrMove
004048CE . 50 push eax ; 真码入栈
004048CF . 8B45 D4 mov eax, [ebp-2C]
004048D2 . 50 push eax ; 假码入栈
004048D3 . FF15 58104000 call [<&MSVBVM60.__vbaStrCmp>] ; 比较
004048D9 . 8BF0 mov esi, eax
004048DB . 8D4D D4 lea ecx, [ebp-2C]
004048DE . F7DE neg esi
004048E0 . 1BF6 sbb esi, esi
004048E2 . 8D55 D0 lea edx, [ebp-30]
004048E5 . 51 push ecx
004048E6 . 46 inc esi
004048E7 . 52 push edx
004048E8 . 6A 02 push 2
004048EA . F7DE neg esi
004048EC . FF15 9C104000 call [<&MSVBVM60.__vbaFreeStrList>] ; MSVBVM60.__vbaFreeStrList
004048F2 . 83C4 0C add esp, 0C
004048F5 . 8D4D CC lea ecx, [ebp-34]
004048F8 . FF15 D4104000 call [<&MSVBVM60.__vbaFreeObj>] ; MSVBVM60.__vbaFreeObj
004048FE . 8B3D 34104000 mov edi, [<&MSVBVM60.__vbaBoolStr>] ; MSVBVM60.__vbaBoolStr
00404904 . 68 00314000 push 00403100 ; UNICODE "False"
00404909 . FFD7 call edi ; <&MSVBVM60.__vbaBoolStr>
0040490B . 66:3BF0 cmp si, ax
0040490E . 0F85 81000000 jnz 00404995 ; 关键跳,跳则成功
算法小结:
取name的第一个和最后一个字符相加,然后乘0F423FH,并把结果转换成十进制字符串,前面添上一个空格,即成注册码。
--------------------------------------------------------------------------------
【版权声明】: 本文原创于看雪技术论坛, 转载请注明作者并保持文章的完整, 谢谢!
2006年08月24日 下午 03:17:29
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课