Author Topic: [ASM/VB6] Starcraft Key Verification (Reversed from installer)  (Read 4277 times)

0 Members and 1 Guest are viewing this topic.

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Yep! iago found the function, but I did all the porting. I actually tested it and it returned true on my key.

Code: [Select]
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
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: [ASM/VB6] Starcraft Key Verification (Reversed from installer)
« Reply #1 on: August 20, 2005, 10:24:25 am »
Hmm, did you notice that you always return true no matter the result?

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

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: [ASM/VB6] Starcraft Key Verification (Reversed from installer)
« Reply #2 on: August 20, 2005, 04:25:01 pm »
No wonder it worked ^^

Also, Let is entirely useless

With the correction (return false), it does not work.
« Last Edit: August 20, 2005, 04:27:29 pm by rabbit »

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: [ASM/VB6] Starcraft Key Verification (Reversed from installer)
« Reply #3 on: August 20, 2005, 04:37:16 pm »
Code: [Select]
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.
« Last Edit: August 20, 2005, 05:04:45 pm by Joe[x86] »
I'd personally do as Joe suggests

You might be right about that, Joe.