News:

Holy shit, it's 2018 2019 2020 2021 2022 2023 2024, and the US isn't a fascist country! What a time to be alive.

Main Menu

[ASM/VB6] Starcraft Key Verification (Reversed from installer)

Started by Joe, August 20, 2005, 02:53:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joe

Yep! iago found the function, but I did all the porting. I actually tested it and it returned true on my key.

Option Explicit

'   mov     eax, 3
'   mov     esi, ecx
'   mov     ebp, edx
'   xor     ecx, ecx
'Top:
'   movsx   edx, byte ptr [ecx+esi]
'   sub     edx, 30h       
'   lea     edi, [eax+eax] 
'   xor     edx, edi       
'   add     eax, edx       
'   inc     ecx           
'   cmp     ecx, 0Ch       
'   jl      short Top
'   xor     edx, edx 
'   mov     ecx, 0Ah 
'   div     ecx       
'   
'   movsx   eax, byte ptr [esi+0Ch]
'   movsx   edx, dl
'   add     edx, 30h
'   cmp     eax, edx
'   jnz     bottom
'   mov     eax, 1 
'   retn    8
'bottom:
'   xor     eax, eax
'   retn    8


Public Function VerifyKey(Key As String) As Boolean
    Dim eax&, esi&, ecx&, ebp&, edx&, dl&
    Let eax = 3
    Let esi = 0             'it should be ecx, the pointer to the key, but we obviously dont need that
    Let ebp = edx
    Let ecx = ecx Xor ecx
   
Top:
    Let edx = Asc(Mid(Key, ecx + 1, 1))
    Let edx = edx - &H30
    Let eax = eax + edx
    Let ecx = ecx + 1
    If ecx = &HC Then _
    GoTo Top
    Let edx = edx Xor edx
    Let ecx = &HA
    Let dl = ecx Mod 10
   
    Let eax = Asc(Mid(Key, &HC))
    Let edx = dl
    Let edx = edx + &H30
    If eax <> edx Then _
    GoTo Bottom
    Let VerifyKey = True: Exit Function
   
Bottom:
    Let VerifyKey = True
End Function
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.


Blaze

Hmm, did you notice that you always return true no matter the result?


...
    Let VerifyKey = True: Exit Function
...
    Let VerifyKey = True
End Function
And like a fool I believed myself, and thought I was somebody else...

rabbit

No wonder it worked ^^

Also, Let is entirely useless

With the correction (return false), it does not work.

Joe

Option Explicit

Private Sub Form_Load()
    Call MsgBox(VerifyKey("0000000000003")) '// <-- Valid Key
    End
End Sub

'   mov     eax, 3
'   mov     esi, ecx
'   mov     ebp, edx
'   xor     ecx, ecx
'Top:
'   movsx   edx, byte ptr [ecx+esi]
'   sub     edx, 30h
'   lea     edi, [eax+eax]
'   xor     edx, edi
'   add     eax, edx
'   inc     ecx
'   cmp     ecx, 0Ch
'   jl      short Top
'   xor     edx, edx
'   mov     ecx, 0Ah
'   div     ecx
'
'   movsx   eax, byte ptr [esi+0Ch]
'   movsx   edx, dl
'   add     edx, 30h
'   cmp     eax, edx
'   jnz     bottom
'   mov     eax, 1
'   retn    8
'bottom:
'   xor     eax, eax
'   retn    8

Public Function VerifyKey(Key As String) As Boolean
    Dim eax&, esi&, ecx&, ebp&, edx&, edi&, dl&
    Let eax = 3
    Let esi = 1             '// Key pointer
    'Let ebp = edx          '// No clue what this does, but its not needed
    Let ecx = ecx Xor ecx   '// Key position

Top:
    Let edx = Asc(Mid(Key, (ecx + esi), 1))
    Let edx = edx - &H30    '// Move from the ASCII value of the number, to the numerical value
    Let edi = eax + eax
    Let edx = edx Xor edi
    Let eax = eax + edx
    Let ecx = ecx + 1
    If Not ecx = &HC Then GoTo Top
    Let edx = 0
    Let edx = &HA
    Let dl = eax Mod edx
   
    Let eax = Asc(Mid(Key, (esi + &HC), 1))
    Let edx = dl
    Let edx = edx + &H30
    If Not eax = edx Then GoTo Bottom
    Let VerifyKey = True: Exit Function

Bottom:
    Let VerifyKey = False: Exit Function
End Function


Fixed. I left the broken code so people can have a good laugh.

EDIT -
It was still always returning true. This time I actually did fix it.
Quote from: Camel on June 09, 2009, 04:12:23 PMI'd personally do as Joe suggests

Quote from: AntiVirus on October 19, 2010, 02:36:52 PM
You might be right about that, Joe.