Difference between revisions of "Example 6"

From SkullSecurity
Jump to navigation Jump to search
Line 1: Line 1:
{{Construction}}
{{Infobox assembly}}
{{Infobox assembly}}
[[Category: Assembly Examples]]
[[Category: Assembly Examples]]

Revision as of 18:41, 15 March 2007

Stop hand.png This page is under construction. USE AT YOUR OWN RISK!







Assembly Language Tutorial
Please choose a tutorial page:

The previous example demonstrates how to crack a game. This example goes one step further and demonstrates how to write a keygen for that game.

As with the previous example, if you want the name of the game, please contact me privately -- if I know you, I'll let you know which game and where to find it. If I don't know you, I won't be able to tell you. I'm not sure what the legality of this is, but I don't want to piss anybody off for obvious reasons.

In previous examples, I documented every line. This code, however, is actually extremely simplistic, so I won't bother spending time going through every line, only the important ones.

This code, as normal, is directly copied from IDA, all I did was name the function GenerateCode. The code takes a number (the registration code) and generates/returns the key to activate the game.

GenerateCode proc near

arg_0= dword ptr  8

push    ebx
mov     edx, [esp+arg_0] ; edx gets the reg code
xor     ebx, ebx
mov     ebx, edx
lea     eax, [edx+7]
imul    ebx, eax
lea     ebx, [ebx+33h]
mov     ecx, 8085h
mov     eax, ebx
cdq
idiv    ecx
mov     ebx, edx
imul    ebx, 4Fh
mov     ecx, 702Fh
mov     eax, ebx
cdq
idiv    ecx
mov     ebx, edx
shl     ebx, 5
lea     eax, [edx+edx*2]
sub     ebx, eax
mov     ecx, 47A9h
mov     eax, ebx
cdq
idiv    ecx
mov     ebx, edx
imul    ebx, 2DBh
mov     ecx, 2710h
mov     eax, ebx
cdq
idiv    ecx
mov     ebx, edx
lea     eax, [ebx+2710h]
pop     ebx
retn

GenerateCode endp

Annotated Code

N/A

C Code

Cleaned Up C Code

Reduced C Code

Finished Code

Questions

Feel free to edit this section and post questions, I'll do my best to answer them. But you may need to contact me to let me know that a question exists.