Example 2b

From SkullSecurity
Revision as of 17:46, 17 November 2008 by Ron (talk | contribs)
Jump to navigation Jump to search
Stop hand.png This page is under construction. USE AT YOUR OWN RISK!

This is the third (and, basically, final) part of the Starcraft CDKey Decode. I'm going to present the code only, not the answer (although you can find the finished product around). This may cover things we haven't talked about (like a function call and local variables, for example).

As usual, esi is a pointer to the cdkey.

    mov     ebp, 13AC9741h
    mov     ebx, 0Bh

    movsx   eax, byte ptr [ebx+esi]
    push    eax             ; Parameter to toupper()
    call    _toupper        ; Call toupper()
    add     esp, 4          ; Fix the stack (don't worry about this)
    cmp     al, 37h
    mov     byte ptr [ebx+esi], al
    jg      short body1
    mov     ecx, ebp
    mov     dl, cl
    and     dl, 7
    xor     dl, al
    shr     ecx, 3
    mov     byte ptr [ebx+esi], dl
    mov     ebp, ecx
    jmp     short body2

    cmp     al, 41h
    jge     short body2
    mov     cl, bl
    and     cl, 1
    xor     cl, al
    mov     byte ptr [ebx+esi], cl

    dec     ebx
    jns     short top