程序会在输入序列号时创建新线程计算序列号是否正确,结果保存在一个全局变量中,点击按钮里根据全局变量结果从资源中加载字符串提示。
下面是算法部分
.text:00401000 ; DWORD __stdcall StartAddress(LPVOID)
.text:00401000 StartAddress proc near ; DATA XREF: DialogFunc+CBo
.text:00401000
.text:00401000 var_1 = byte ptr -1
.text:00401000
.text:00401000 push ebp
.text:00401001 mov ebp, esp
.text:00401003 add esp, 0FFFFFFFCh
.text:00401006 push ebx
.text:00401007 push esi
.text:00401008 push edi
.text:00401009 pusha
.text:0040100A mov ebx, offset szSerial
.text:0040100F mov ebp, offset szSerial
.text:00401014 movzx eax, len
.text:0040101B movzx edx, len
.text:00401022 cmp eax, 6 ;序列号长度不得小于6
.text:00401025 jb loc_4010BD
.text:0040102B mov esi, edx ;序列号个数是否是双数,不是双
.text:0040102D mov ecx, 2 ;数取序列号第2个字母补到最后
.text:00401032 div cl
.text:00401034 or ah, ah
.text:00401036 jz short loc_401048
.text:00401038 add al, 1
.text:0040103A movzx ecx, al
.text:0040103D mov [ebp+var_1], al
.text:00401040 mov al, [ebx+1]
.text:00401043 mov [edx+ebp], al
.text:00401046 jmp short loc_401051
.text:00401048 ; ---------------------------------------------------------------------------
.text:00401048
.text:00401048 loc_401048: ; CODE XREF: StartAddress+36j
.text:00401048 movzx ecx, al
.text:0040104B mov [ebp+var_1], al
.text:0040104E sub esi, 1
.text:00401051
.text:00401051 loc_401051: ; CODE XREF: StartAddress+46j
.text:00401051 xor eax, eax ;清零,保存计算结果
.text:00401053 push ebp
.text:00401054 jmp short loc_401067
.text:00401056 ; ---------------------------------------------------------------------------
.text:00401056
.text:00401056 loc_401056: ; CODE XREF: StartAddress+6Aj
.text:00401056 movzx edx, byte ptr [ebx]
.text:00401059 movzx edi, byte ptr [esi+ebp] ;序列号第1位与倒数第1位
.text:0040105D xor edx, edi ;异或,并累加到eax中
.text:0040105F add eax, edx ;eax *= ecx;
.text:00401061 imul eax, ecx ;ecx=序列号长度/2
.text:00401064 inc ebx ;下一位序列号
.text:00401065 dec ebp ;前一位序列号
.text:00401066 dec ecx ;递减ecx
.text:00401067
.text:00401067 loc_401067: ; CODE XREF: StartAddress+54j
.text:00401067 cmp ecx, 1
.text:0040106A jnb short loc_401056
.text:0040106C cmp eax, 66h ;计算结果为66h,159h,0e8h
.text:0040106F jz short loc_40107F ;时,序列号正确
.text:00401071 cmp eax, 159h
.text:00401076 jz short loc_40107F
.text:00401078 cmp eax, 0EBh
.text:0040107D jnz short loc_401088
.text:0040107F
.text:0040107F loc_40107F: ; CODE XREF: StartAddress+6Fj
.text:0040107F ; StartAddress+76j
.text:0040107F mov byte_4030D5, 1 ;设置正确标志
.text:00401086 jmp short loc_40108F
.text:00401088 ; ---------------------------------------------------------------------------
.text:00401088
.text:00401088 loc_401088: ; CODE XREF: StartAddress+7Dj
.text:00401088 mov byte_4030D5, 0
.text:0040108F
.text:0040108F loc_40108F: ; CODE XREF: StartAddress+86j
.text:0040108F pop ebp
.text:00401090 mov cl, [ebp+var_1]
.text:00401093 mov ebx, offset szSerial
.text:00401098 mov ebp, offset szSerial
.text:0040109D jmp short loc_4010B6
.text:0040109F ; ---------------------------------------------------------------------------
.text:0040109F
.text:0040109F loc_40109F: ; CODE XREF: StartAddress+B9j
.text:0040109F movzx edx, byte ptr [ebx] ;序列号第1位与倒数第1位
.text:004010A2 movzx edi, byte ptr [esi+ebp] ;第2位与倒数第2位.......
.text:004010A6 cmp edx, edi ;不能相同
.text:004010A8 jnz short loc_4010B3
.text:004010AA mov byte_4030D5, 0
.text:004010B1 jmp short loc_4010C4
.text:004010B3 ; ---------------------------------------------------------------------------
.text:004010B3
.text:004010B3 loc_4010B3: ; CODE XREF: StartAddress+A8j
.text:004010B3 inc ebx
.text:004010B4 dec ebp
.text:004010B5 dec ecx
.text:004010B6
.text:004010B6 loc_4010B6: ; CODE XREF: StartAddress+9Dj
.text:004010B6 cmp ecx, 1
.text:004010B9 jnb short loc_40109F
.text:004010BB jmp short loc_4010C4
.text:004010BD ; ---------------------------------------------------------------------------
.text:004010BD
.text:004010BD loc_4010BD: ; CODE XREF: StartAddress+25j
.text:004010BD mov byte_4030D5, 0
.text:004010C4
.text:004010C4 loc_4010C4: ; CODE XREF: StartAddress+B1j
.text:004010C4 ; StartAddress+BBj
.text:004010C4 popa
.text:004010C5 pop edi
.text:004010C6 pop esi
.text:004010C7 pop ebx
.text:004010C8 leave
.text:004010C9 retn 4
.text:004010C9 StartAddress endp
基本算法就这样了,暴破改全局变量就行了,可是不知道要怎样找出正确的序列号,请大家指点一下。
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课