加一个注册算法:
程序使用DES算法,计算注册码:
注册码为机器码DES加密,再由字符转16进制字符串
机器码:77D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222
KEY:6A933333(由机器码算出)
密文16进制:E8AF80B9A78B9D71DAB0FF57B599BC9E4391F5A7602E2AFA36862AFA2589C3F3F3C2BE1B8E783538F817B8B47B55B3564A61720FFF98654013141CF96580E488
附件为js写的一个注册机,直接运行htm文件,输入辅助注册码,点击注册得到真注册码
==============================================
1、辅助注册码:
JP201077D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222
去除开始的"JP2010",即为机器码"77D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222"
2、取KEY的过程:
77D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222
字符串长度:64
首字符为长度/2-1处的字符(起始位置0)
第2-8位字符为上个字符的ASCII码位置处的字符
字符 所在位置 ASCII码
1 64/2-1=31 49
0 49-1 % 64 = 48 48
5 48-1 % 64 = 47 53
0 53-1 % 64 = 52 48
5 48-1 % 64 = 47 53
0 53-1 % 64 = 52 48
5 48-1 % 64 = 47 53
0 53-1 % 64 = 52 48
机器码按上述方法取字符:"10505050",
不满8位,追加特殊字符串"a1k)&,32",再取前8位
3、DES加密,原文"a1k)&,32",KEY="10505050",得到密文,ASCII字符转16进制字符串:"9531BA36317864B2"
4、按上述方法取字符:"6A933333"
5、假注册码为16进制字符串,转换为ASCII字符,再DES解密,KEY="6A933333",得到密文
6、密文的16进制值与机器码字符串进行比较,相同则注册通过
==============================================
简单的分析思路:
注册码输入比对过程:
005FEFA0 >/$ 53 push ebx ; sub_5FEFA0
005FEFA1 |. 8BD8 mov ebx, eax
005FEFA3 |. 8BC3 mov eax, ebx
005FEFA5 |. E8 36010000 call <123.sub_5FF0E0> ; 关键 跟进
005FEFAA |. 84C0 test al, al
005FEFAC |. 74 24 je short <123.loc_5FEFD2> ; 不能跳转(跳转则注册失败)
005FEFAE |. 68 40000400 push 40040
005FEFB3 |. B9 F0EF5F00 mov ecx, <123.byte_5FEFF0> ; "提示"
005FEFB8 |. BA F8EF5F00 mov edx, <123.dword_5FEFF8> ; "注册成功!"
005FEFBD |. A1 986F6000 mov eax, dword ptr [606F98]
005FEFC2 |. 8B00 mov eax, dword ptr [eax]
005FEFC4 |. E8 D3C7E8FF call <123.Forms::TApplication::Messag>
005FEFC9 |. 8BC3 mov eax, ebx
005FEFCB |. E8 C88DE8FF call <123.Forms::TCustomForm::Close(v>
005FEFD0 |. 5B pop ebx ; kernel32.7C817077
005FEFD1 |. C3 retn
005FEFD2 >|> 68 40000400 push 40040 ; loc_5FEFD2
005FEFD7 |. B9 F0EF5F00 mov ecx, <123.byte_5FEFF0> ; "提示"
005FEFDC |. BA 04F05F00 mov edx, 123.005FF004 ; "注册码错误!"
005FEFE1 |. A1 986F6000 mov eax, dword ptr [606F98]
005FEFE6 |. 8B00 mov eax, dword ptr [eax]
005FEFE8 |. E8 AFC7E8FF call <123.Forms::TApplication::Messag>
005FEFED |. 5B pop ebx ; kernel32.7C817077
005FEFEE \. C3 retn
来到这里:
005FF0E0 >/$ 55 push ebp ; sub_5FF0E0
005FF0E1 |. 8BEC mov ebp, esp
005FF0E3 |. 33C9 xor ecx, ecx
005FF0E5 |. 51 push ecx
005FF0E6 |. 51 push ecx
005FF0E7 |. 51 push ecx
005FF0E8 |. 51 push ecx
005FF0E9 |. 53 push ebx
005FF0EA |. 56 push esi
005FF0EB |. 8BF0 mov esi, eax
005FF0ED |. 33C0 xor eax, eax
005FF0EF |. 55 push ebp
005FF0F0 |. 68 A3F15F00 push <123.loc_5FF1A3>
005FF0F5 |. 64:FF30 push dword ptr fs:[eax]
005FF0F8 |. 64:8920 mov dword ptr fs:[eax], esp
005FF0FB |. 33DB xor ebx, ebx
005FF0FD |. 8D45 FC lea eax, dword ptr [ebp-4]
005FF100 |. 50 push eax
005FF101 |. 8D55 F8 lea edx, dword ptr [ebp-8]
005FF104 |. 8B86 08030000 mov eax, dword ptr [esi+308]
005FF10A |. E8 5DBAE6FF call <123.Controls::TControl::GetText>
005FF10F |. 8B4D F8 mov ecx, dword ptr [ebp-8] ; 获取假注册码
005FF112 |. 8B96 10030000 mov edx, dword ptr [esi+310] ; 机器码"77D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222"
005FF118 |. A1 88605300 mov eax, dword ptr [<off_536088>] ; "TS6Reg"
005FF11D |. E8 3271F3FF call <123.sub_536254> ; 关键 跟进
005FF122 |. 8D55 F4 lea edx, dword ptr [ebp-C]
005FF125 |. 8B45 FC mov eax, dword ptr [ebp-4]
005FF128 |. E8 0BA5E0FF call <123.Sysutils::Trim(System::Ansi>
005FF12D |. 837D F4 00 cmp dword ptr [ebp-C], 0
005FF131 |. 74 1D je short <123.loc_5FF150>
005FF133 |. A1 D0726000 mov eax, dword ptr [6072D0]
005FF138 |. 8B00 mov eax, dword ptr [eax]
005FF13A |. 8B55 FC mov edx, dword ptr [ebp-4]
005FF13D |. E8 264AF3FF call <123.sub_533B68>
005FF142 |. A1 D0726000 mov eax, dword ptr [6072D0]
005FF147 |. 8B00 mov eax, dword ptr [eax]
005FF149 |. E8 8A3EF3FF call <123.sub_532FD8>
005FF14E |. B3 01 mov bl, 1
005FF150 >|> 8D55 F0 lea edx, dword ptr [ebp-10] ; loc_5FF150
005FF153 |. 8B86 08030000 mov eax, dword ptr [esi+308]
005FF159 |. E8 0EBAE6FF call <123.Controls::TControl::GetText>
005FF15E |. 8B4D F0 mov ecx, dword ptr [ebp-10]
005FF161 |. 8B96 10030000 mov edx, dword ptr [esi+310]
005FF167 |. A1 88605300 mov eax, dword ptr [<off_536088>]
005FF16C |. E8 6B6FF3FF call <123.sub_5360DC> ; 注册表操作
005FF171 |. 22C3 and al, bl
005FF173 |. 8BD8 mov ebx, eax
005FF175 |. 33C0 xor eax, eax
005FF177 |. 5A pop edx ; kernel32.7C817077
005FF178 |. 59 pop ecx ; kernel32.7C817077
005FF179 |. 59 pop ecx ; kernel32.7C817077
005FF17A |. 64:8910 mov dword ptr fs:[eax], edx ; ntdll.KiFastSystemCallRet
005FF17D |. 68 AAF15F00 push <123.loc_5FF1AA>
005FF182 >|> 8D45 F0 lea eax, dword ptr [ebp-10] ; loc_5FF182
005FF185 |. E8 EE57E0FF call <123.System::__linkproc__ LStrCl>
005FF18A |. 8D45 F4 lea eax, dword ptr [ebp-C]
005FF18D |. E8 E657E0FF call <123.System::__linkproc__ LStrCl>
005FF192 |. 8D45 F8 lea eax, dword ptr [ebp-8]
005FF195 |. E8 DE57E0FF call <123.System::__linkproc__ LStrCl>
005FF19A |. 8D45 FC lea eax, dword ptr [ebp-4]
005FF19D |. E8 D657E0FF call <123.System::__linkproc__ LStrCl>
005FF1A2 \. C3 retn
来到这里:
00536254 > $ 55 push ebp ; sub_536254
00536255 . 8BEC mov ebp, esp
00536257 . 6A 00 push 0
00536259 . 6A 00 push 0
0053625B . 53 push ebx
0053625C . 56 push esi
0053625D . 57 push edi ; ntdll.7C930228
0053625E . 8BF9 mov edi, ecx ; 假注册码
00536260 . 8BDA mov ebx, edx ; 机器码"77D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222"
00536262 . 8B75 08 mov esi, dword ptr [ebp+8] ; <123.start>
00536265 . 33C0 xor eax, eax
00536267 . 55 push ebp
00536268 . 68 F4625300 push <123.loc_5362F4>
0053626D . 64:FF30 push dword ptr fs:[eax]
00536270 . 64:8920 mov dword ptr fs:[eax], esp
00536273 . 8BC6 mov eax, esi
00536275 . E8 FEE6ECFF call <123.System::__linkproc__ LStrCl>
0053627A . 8D4D FC lea ecx, dword ptr [ebp-4] ; 假注册码
0053627D . 8BD3 mov edx, ebx ; 机器码"77D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222"
0053627F . A1 88605300 mov eax, dword ptr [<off_536088>] ; "TS6Reg"
00536284 . E8 83020000 call <123.sub_53650C> ; 关键 跟进(获取用于DES解密的KEY)(计算KEY的过程)
00536289 . 33C0 xor eax, eax
0053628B . 55 push ebp
0053628C . 68 CF625300 push <123.loc_5362CF>
00536291 . 64:FF30 push dword ptr fs:[eax]
00536294 . 64:8920 mov dword ptr fs:[eax], esp
00536297 . 8D45 F8 lea eax, dword ptr [ebp-8]
0053629A . 50 push eax
0053629B . 8B4D FC mov ecx, dword ptr [ebp-4] ; 由机器码计算得到的"6A933333"
0053629E . 8BD7 mov edx, edi ; ntdll.7C930228
005362A0 . A1 6C355100 mov eax, dword ptr [<off_51356C>] ; "TDESEncrypt"
005362A5 . E8 92E0FDFF call <123.sub_51433C> ; 关键(标准的DES加解密方法 DES解密假注册码,得到密文)
005362AA . 8B45 F8 mov eax, dword ptr [ebp-8] ; kernel32.7C817080
005362AD . 8BD3 mov edx, ebx
005362AF . E8 D0EAECFF call <123.System::__linkproc__ LStrCm>; 密文的16进制值与机器码字符串比较 相同则注册通过
005362B4 . 75 0F jnz short <123.loc_5362C5>
005362B6 . 8BCE mov ecx, esi
005362B8 . 8B55 F8 mov edx, dword ptr [ebp-8] ; kernel32.7C817080
005362BB . A1 88605300 mov eax, dword ptr [<off_536088>]
005362C0 . E8 97060000 call <123.Dbxinformixmetadatareader::>
005362C5 > > 33C0 xor eax, eax ; loc_5362C5
005362C7 . 5A pop edx ; kernel32.7C817077
005362C8 . 59 pop ecx ; kernel32.7C817077
005362C9 . 59 pop ecx ; kernel32.7C817077
005362CA . 64:8910 mov dword ptr fs:[eax], edx ; ntdll.KiFastSystemCallRet
005362CD . EB 0A jmp short <123.loc_5362D9>
005362CF > .^ E9 90DCECFF jmp <123.dword_604F64> ; loc_5362CF
005362D4 . E8 B7E0ECFF call <123.System::__linkproc__ DoneEx>
005362D9 > > 33C0 xor eax, eax ; loc_5362D9
005362DB . 5A pop edx ; kernel32.7C817077
005362DC . 59 pop ecx ; kernel32.7C817077
005362DD . 59 pop ecx ; kernel32.7C817077
005362DE . 64:8910 mov dword ptr fs:[eax], edx ; ntdll.KiFastSystemCallRet
005362E1 . 68 FB625300 push <123.loc_5362FB>
005362E6 > > 8D45 F8 lea eax, dword ptr [ebp-8] ; loc_5362E6
005362E9 . BA 02000000 mov edx, 2
005362EE . E8 A9E6ECFF call <123.System::__linkproc__ LStrAr>
005362F3 . C3 retn
005362F4 > .^ E9 1FDFECFF jmp <123.unknown_libname_63> ; loc_5362F4
005362F9 .^ EB EB jmp short <123.loc_5362E6>
005362FB > . 5F pop edi ; loc_5362FB
005362FC . 5E pop esi ; kernel32.7C817077
005362FD . 5B pop ebx ; kernel32.7C817077
005362FE . 59 pop ecx ; kernel32.7C817077
005362FF . 59 pop ecx ; kernel32.7C817077
00536300 . 5D pop ebp ; kernel32.7C817077
00536301 . C2 0400 retn 4
关键(计算KEY的过程):
0053650C >/$ 55 push ebp ; sub_53650C
0053650D |. 8BEC mov ebp, esp
0053650F |. 6A 00 push 0
00536511 |. 6A 00 push 0
00536513 |. 6A 00 push 0
00536515 |. 6A 00 push 0
00536517 |. 6A 00 push 0
00536519 |. 6A 00 push 0
0053651B |. 6A 00 push 0
0053651D |. 6A 00 push 0
0053651F |. 53 push ebx
00536520 |. 56 push esi
00536521 |. 57 push edi ; ntdll.7C930228
00536522 |. 8BF9 mov edi, ecx
00536524 |. 8955 FC mov dword ptr [ebp-4], edx ; 机器码"77D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222"
00536527 |. 33C0 xor eax, eax
00536529 |. 55 push ebp
0053652A |. 68 6A665300 push <123.loc_53666A>
0053652F |. 64:FF30 push dword ptr fs:[eax]
00536532 |. 64:8920 mov dword ptr fs:[eax], esp
00536535 |. 8BC7 mov eax, edi ; ntdll.7C930228
00536537 |. E8 3CE4ECFF call <123.System::__linkproc__ LStrCl>
0053653C |. 8B45 FC mov eax, dword ptr [ebp-4]
0053653F |. E8 F4E6ECFF call <123.sub_404C38> ; 计算字符串长度
00536544 |. 8945 F8 mov dword ptr [ebp-8], eax ; 长度=64(0x40)
00536547 |. 8B75 F8 mov esi, dword ptr [ebp-8] ; kernel32.7C817080
0053654A |. D1FE sar esi, 1 ; 长度/2=32
0053654C |. 79 03 jns short <123.loc_536551>
0053654E |. 83D6 00 adc esi, 0
00536551 >|> 85F6 test esi, esi ; loc_536551
00536553 |. 7E 06 jle short <123.loc_53655B>
00536555 |. 837D F8 08 cmp dword ptr [ebp-8], 8
00536559 |. 7D 0D jge short <123.loc_536568>
0053655B >|> 8BC7 mov eax, edi ; loc_53655B
0053655D |. 8B15 A0916000 mov edx, dword ptr [6091A0] ; 长度<=0或<8追加字符串"a1k)&,32"
00536563 |. E8 64E4ECFF call <123.System::__linkproc__ LStrAs>
00536568 >|> 8B45 FC mov eax, dword ptr [ebp-4] ; 机器码"77D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222"
0053656B |. 8A5C30 FF mov bl, byte ptr [eax+esi-1] ; 字符位置=64/2-1=31 字符"1"
0053656F |. 8D45 EC lea eax, dword ptr [ebp-14] ; 字符"1"所在位置
00536572 |. 8BD3 mov edx, ebx
00536574 |. E8 E7E5ECFF call <123.unknown_libname_74>
00536579 |. 8B55 EC mov edx, dword ptr [ebp-14] ; 取字符"1"
0053657C |. 8BC7 mov eax, edi ; ntdll.7C930228
0053657E |. E8 BDE6ECFF call <123.System::__linkproc__ LStrCa>; 连接字符串"" "1"
00536583 |. C745 F4 07000>mov dword ptr [ebp-C], 7
0053658A >|> 33C0 /xor eax, eax ; loc_53658A
0053658C |. 8AC3 |mov al, bl ; 字符"1"的ASCII码=49
0053658E |. 99 |cdq
0053658F |. F77D F8 |idiv dword ptr [ebp-8] ; kernel32.7C817080
00536592 |. 8BF2 |mov esi, edx ; 49 % 64 =49
00536594 |. 85F6 |test esi, esi
00536596 |. 75 0B |jnz short <123.loc_5365A3>
00536598 |. 33C0 |xor eax, eax
0053659A |. 8AC3 |mov al, bl
0053659C |. 40 |inc eax
0053659D |. 99 |cdq
0053659E |. F77D F8 |idiv dword ptr [ebp-8] ; kernel32.7C817080
005365A1 |. 8BF2 |mov esi, edx ; ntdll.KiFastSystemCallRet
005365A3 >|> 8B45 FC |mov eax, dword ptr [ebp-4] ; 机器码"77D3A0FF429589DB4AEC775C47414DB19DCE7C2B62D532A50B610026F0202222"
005365A6 |. 8A5C30 FF |mov bl, byte ptr [eax+esi-1] ; 49-1=48位置处字符"0"
005365AA |. 8D45 E8 |lea eax, dword ptr [ebp-18]
005365AD |. 8BD3 |mov edx, ebx ; "S6Mo0(*3"
005365AF |. E8 ACE5ECFF |call <123.unknown_libname_74>
005365B4 |. 8B55 E8 |mov edx, dword ptr [ebp-18] ; 转换为16进制值
005365B7 |. 8BC7 |mov eax, edi ; ntdll.7C930228
005365B9 |. E8 82E6ECFF |call <123.System::__linkproc__ LStrC>
005365BE |. FF4D F4 |dec dword ptr [ebp-C] ; kernel32.7C839AD8
005365C1 |.^ 75 C7 \jnz short <123.loc_53658A>
005365C3 |. 8D45 F0 lea eax, dword ptr [ebp-10]
005365C6 |. 50 push eax
005365C7 |. 8B0F mov ecx, dword ptr [edi]
005365C9 |. 8B15 A0916000 mov edx, dword ptr [6091A0]
005365CF |. A1 6C355100 mov eax, dword ptr [<off_51356C>]
005365D4 |. E8 77DBFDFF call <123.sub_514150> ; 标准的DES加密"a1k)&,32",KEY="10505050"
005365D9 |. 8B45 F0 mov eax, dword ptr [ebp-10] ; 得"9531BA36317864B2"
005365DC |. E8 57E6ECFF call <123.sub_404C38> ; 计算字符串长度
005365E1 |. 8945 F8 mov dword ptr [ebp-8], eax ; 长度=16
005365E4 |. 8B75 F8 mov esi, dword ptr [ebp-8] ; kernel32.7C817080
005365E7 |. D1FE sar esi, 1
005365E9 |. 79 03 jns short <123.loc_5365EE>
005365EB |. 83D6 00 adc esi, 0
005365EE >|> 85F6 test esi, esi ; loc_5365EE
005365F0 |. 7E 5D jle short <123.loc_53664F>
005365F2 |. 8B45 F0 mov eax, dword ptr [ebp-10]
005365F5 |. 8A5C30 FF mov bl, byte ptr [eax+esi-1]
005365F9 |. 8D45 E4 lea eax, dword ptr [ebp-1C]
005365FC |. 8BD3 mov edx, ebx
005365FE |. E8 5DE5ECFF call <123.unknown_libname_74>
00536603 |. 8B4D E4 mov ecx, dword ptr [ebp-1C]
00536606 |. 8BC7 mov eax, edi ; ntdll.7C930228
00536608 |. 33D2 xor edx, edx ; ntdll.KiFastSystemCallRet
0053660A |. E8 75E6ECFF call <123.System::__linkproc__ LStrCa>
0053660F |. C745 F4 07000>mov dword ptr [ebp-C], 7
00536616 >|> 33C0 /xor eax, eax ; loc_536616
00536618 |. 8AC3 |mov al, bl
0053661A |. 99 |cdq
0053661B |. F77D F8 |idiv dword ptr [ebp-8] ; kernel32.7C817080
0053661E |. 8BF2 |mov esi, edx ; ntdll.KiFastSystemCallRet
00536620 |. 85F6 |test esi, esi
00536622 |. 75 0B |jnz short <123.loc_53662F>
00536624 |. 33C0 |xor eax, eax
00536626 |. 8AC3 |mov al, bl
00536628 |. 40 |inc eax
00536629 |. 99 |cdq
0053662A |. F77D F8 |idiv dword ptr [ebp-8] ; kernel32.7C817080
0053662D |. 8BF2 |mov esi, edx ; ntdll.KiFastSystemCallRet
0053662F >|> 8B45 F0 |mov eax, dword ptr [ebp-10] ; loc_53662F
00536632 |. 8A5C30 FF |mov bl, byte ptr [eax+esi-1]
00536636 |. 8D45 E0 |lea eax, dword ptr [ebp-20]
00536639 |. 8BD3 |mov edx, ebx
0053663B |. E8 20E5ECFF |call <123.unknown_libname_74>
00536640 |. 8B55 E0 |mov edx, dword ptr [ebp-20]
00536643 |. 8BC7 |mov eax, edi ; ntdll.7C930228
00536645 |. E8 F6E5ECFF |call <123.System::__linkproc__ LStrC>
0053664A |. FF4D F4 |dec dword ptr [ebp-C] ; kernel32.7C839AD8
0053664D |.^ 75 C7 \jnz short <123.loc_536616>
0053664F >|> 33C0 xor eax, eax ; "6A933333"
00536651 |. 5A pop edx ; kernel32.7C817077
00536652 |. 59 pop ecx ; kernel32.7C817077
00536653 |. 59 pop ecx ; kernel32.7C817077
00536654 |. 64:8910 mov dword ptr fs:[eax], edx ; ntdll.KiFastSystemCallRet
00536657 |. 68 71665300 push <123.loc_536671>
0053665C >|> 8D45 E0 lea eax, dword ptr [ebp-20] ; loc_53665C
0053665F |. BA 05000000 mov edx, 5
00536664 |. E8 33E3ECFF call <123.System::__linkproc__ LStrAr>
00536669 \. C3 retn
==============================================
(完)