大家好,我这里有一个CM,按作者的要求是需要写出KEGEN的,所以必须先把其中的算法搞清楚,我想这个算法应该不是很难,不过作为新手的我,由于学习时日尚浅功力欠缺,对于其算法的关键之处还是看不明白,不过我还是凭自己的毅力分析出一些东西,呵呵,应该没问题的(如有不对之处希望能看到这篇帖子的高手能够不吝指教)。
根据我的调试分析,这个CM对用户名的要求是16个字节,注册码呢要求是17个字节,于是我按照这个要求,用OD载入程序,成功下断,程序断在以下代码处:
004010B5 |. E8 0F020000 CALL <JMP.&USER32.GetDlgItemTextA> ; \GetDlgItemTextA
004010BA |. 0BC0 OR EAX,EAX
004010BC |. 74 61 JE SHORT cycle.0040111F
004010BE |. 6A 11 PUSH 11 ; /Count = 11 (17.)
004010C0 |. 68 60214000 PUSH cycle.00402160 ; |Buffer = cycle.00402160
004010C5 |. 68 E8030000 PUSH 3E8 ; |ControlID = 3E8 (1000.)
004010CA |. FF75 08 PUSH DWORD PTR SS:[EBP+8] ; |hWnd
004010CD |. E8 F7010000 CALL <JMP.&USER32.GetDlgItemTextA> ; \GetDlgItemTextA
004010D2 |. 0BC0 OR EAX,EAX
004010D4 |. 74 49 JE SHORT cycle.0040111F
004010D6 |. B9 10000000 MOV ECX,10
004010DB |. 2BC8 SUB ECX,EAX
004010DD |. BE 60214000 MOV ESI,cycle.00402160 ; ASCII "jjjjjjjjjjjjjjjj"
004010E2 |. 8BFE MOV EDI,ESI
004010E4 |. 03F8 ADD EDI,EAX
004010E6 |. FC CLD
004010E7 |. F3:A4 REP MOVS BYTE PTR ES:[EDI],BYTE PTR DS:[>
004010E9 |. 33C9 XOR ECX,ECX
004010EB |. BE 71214000 MOV ESI,cycle.00402171 ; ASCII "llllllllllllllll"
004010F0 |> 41 /INC ECX
004010F1 |. AC |LODS BYTE PTR DS:[ESI]
004010F2 |. 0AC0 |OR AL,AL
004010F4 |. 74 0A |JE SHORT cycle.00401100
004010F6 |. 3C 7E |CMP AL,7E
004010F8 |. 7F 06 |JG SHORT cycle.00401100
004010FA |. 3C 30 |CMP AL,30
004010FC |. 72 02 |JB SHORT cycle.00401100
004010FE |.^ EB F0 \JMP SHORT cycle.004010F0
00401100 |> 83F9 11 CMP ECX,11
00401103 |. 75 1A JNZ SHORT cycle.0040111F
00401105 |. E8 E7000000 CALL cycle.004011F1
0040110A |. B9 01FF0000 MOV ECX,0FF01
0040110F |. 51 PUSH ECX
00401110 |. E8 7B000000 CALL cycle.00401190
00401115 |. 83F9 01 CMP ECX,1
00401118 |. 74 06 JE SHORT cycle.00401120
0040111A |> E8 47000000 CALL cycle.00401166
0040111F |> C3 RET
很明显,程序是断在地址为004010B5这个CALL处的,因为我是对GetDlgItemTextA这个函数下的断点,这些代码的大概意思我只能判断是对用户名和注册码的位数在做检测,具体的意思我就不是特别明白了,希望哪位前辈能详细的帮我分析一下,不胜感激!
还有地址00401105处得CALL我断定他肯定就是关键CALL,在这个CALL之前程序对用户名和注册码的前期检测已经完毕,我想这个CALL里面肯定是放着关于注册码的关键算法,于是我F7跟进去,可是里面的代码让我心乱如麻,一点也是看不明白,所以恳请好心前辈忙里偷闲帮我详细分析一下,我把这个CALL里的代码贴在下方:
004011F1 /$ A1 60214000 MOV EAX,DWORD PTR DS:[402160]
004011F6 |. 8B1D 64214000 MOV EBX,DWORD PTR DS:[402164]
004011FC |. 3305 71214000 XOR EAX,DWORD PTR DS:[402171]
00401202 |. 331D 75214000 XOR EBX,DWORD PTR DS:[402175]
00401208 |. 25 0F1F3F7F AND EAX,7F3F1F0F
0040120D |. 81E3 00010307 AND EBX,7030100
00401213 |. 33C9 XOR ECX,ECX
00401215 |> 8BF0 /MOV ESI,EAX
00401217 |. 8BFB |MOV EDI,EBX
00401219 |. D3E6 |SHL ESI,CL
0040121B |. D3E7 |SHL EDI,CL
0040121D |. 81E6 80808080 |AND ESI,80808080
00401223 |. 81E7 80808080 |AND EDI,80808080
00401229 |. 8BD6 |MOV EDX,ESI
0040122B |. C0EE 07 |SHR DH,7
0040122E |. 66:C1E2 07 |SHL DX,7
00401232 |. C1EA 08 |SHR EDX,8
00401235 |. C0EE 07 |SHR DH,7
00401238 |. 66:C1E2 07 |SHL DX,7
0040123C |. C1EA 08 |SHR EDX,8
0040123F |. C0EE 07 |SHR DH,7
00401242 |. 66:D1EA |SHR DX,1
00401245 |. 8BF2 |MOV ESI,EDX
00401247 |. 8BD7 |MOV EDX,EDI
00401249 |. C0EE 07 |SHR DH,7
0040124C |. 66:C1E2 07 |SHL DX,7
00401250 |. C1EA 08 |SHR EDX,8
00401253 |. C0EE 07 |SHR DH,7
00401256 |. 66:C1E2 07 |SHL DX,7
0040125A |. C1EA 08 |SHR EDX,8
0040125D |. C0EE 07 |SHR DH,7
00401260 |. 66:C1EA 05 |SHR DX,5
00401264 |. 8BFA |MOV EDI,EDX
00401266 |. 33FE |XOR EDI,ESI
00401268 |. 8BD7 |MOV EDX,EDI
0040126A |. 81E2 FF000000 |AND EDX,0FF
00401270 |. 51 |PUSH ECX
00401271 |. 52 |PUSH EDX
00401272 |. BA 08000000 |MOV EDX,8
00401277 |. 91 |XCHG EAX,ECX
00401278 |. 83F8 03 |CMP EAX,3
0040127B |. 7F 0F |JG SHORT cycle.0040128C
0040127D |. F6E2 |MUL DL
0040127F |. 5A |POP EDX
00401280 |. 83C0 08 |ADD EAX,8
00401283 |. 91 |XCHG EAX,ECX
00401284 |. D3C0 |ROL EAX,CL
00401286 |. 33C2 |XOR EAX,EDX
00401288 |. D3C8 |ROR EAX,CL
0040128A |. EB 0D |JMP SHORT cycle.00401299
0040128C |> 83E8 03 |SUB EAX,3
0040128F |. F6E2 |MUL DL
00401291 |. 5A |POP EDX
00401292 |. 91 |XCHG EAX,ECX
00401293 |. D3C3 |ROL EBX,CL
00401295 |. 33DA |XOR EBX,EDX
00401297 |. D3CB |ROR EBX,CL
00401299 |> 59 |POP ECX
0040129A |. 41 |INC ECX
0040129B |. 83F9 08 |CMP ECX,8
0040129E |.^ 0F85 71FFFFFF \JNZ cycle.00401215
004012A4 \. C3 RET
这里应该就是注册码的关键算法,可惜我一点也不明白,这是我最关键的时候我想如果我突破了这一关,以后我的提高就应该会很快了,最后拜托能看到此帖的好心前辈或者看雪的版主牛人们,抽点时间帮帮我这个新人,再次致谢!
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课