Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Ithien on July 09, 2003, 05:25 PM

Title: Password Change
Post by: Ithien on July 09, 2003, 05:25 PM
I've been trying to do the Account-Change send, but I can't find out what one part of it is for.

(DWORD) Client Key
How would i retreieve the client key, and what is it?

I know how to do everything else.

Public Sub SendChangePassword()
   Dim Result As Boolean
   Dim accountHash As String
   accountHash = String(5 * 4, vbNullChar)
   Result = X(accountHash, varPass)

   Dim Result2 As Boolean
   Dim accountHash2 As String
   accountHash2 = String(5 * 4, vbNullChar)
   Result2 = X(accountHash2, setup.vOPass.text)

   If Result = True And Result2 = True Then
       'pbuffer.InsertDWORD ClientKey
       pbuffer.InsertDWORD ServerKey
       pbuffer.InsertNonNTString accountHash2
       pbuffer.InsertNonNTString accountHash
       pbuffer.InsertNTString varUser
       pbuffer.sendPacket &H31
   Else
       AddChat vbRed, " - Password change failed, Could not hash"
       form1.BotDisconnect
   End If
'(DWORD)      Client Key
'(DWORD)      Server Key
'(DWORD[5])   Old password hash
'(DWORD[5])   New password hash
'(STRING)         Account name
End Sub
Title: Re:Password Change
Post by: Camel on July 09, 2003, 06:41 PM
Quote from: JoeCool on July 09, 2003, 06:15 PM
Now, why are you putting a "change password" on your bot.. ? whynot just have a create account if wrong password?..
Create account is for accounts that don't exist. Change password is for accounts that do.

IIRC, client key is the client key used to hash the old password (it's double hashed)
Result2 = X(accountHash2, setup.vOPass.text)
Result2 = X(accountHash2, MKL(ClientKey) & MKL(ServerKey) & accountHash2)
accountHash2 = MKL(ClientKey) & MKL(ServerKey) & accountHash2

or use X2 from bnetauth.dll; i forget what the format is [probably just result = X2(accounthash2, clientkey,serverkey,setup.vOPass.text) or something simmilar]

[edit] stupid coding error
Title: Re:Password Change
Post by: Ithien on July 09, 2003, 06:56 PM
Do I still put the 2 dwords before the hash, if I do it the way you did?

And do i just declare a empty ClientKey as a long before doing that, or does it need to contain something?

Do i just set the ServerKey as i normally would?
Title: Re:Password Change
Post by: Camel on July 09, 2003, 08:13 PM
Quote from: Ithien on July 09, 2003, 06:56 PM
Do I still put the 2 dwords before the hash, if I do it the way you did?

And do i just declare a empty ClientKey as a long before doing that, or does it need to contain something?

Do i just set the ServerKey as i normally would?

Yes.
Use GetTickCount.
Yes.
Title: Re:Password Change
Post by: Ithien on July 10, 2003, 12:27 PM
So i set Clientkey as gettickcount() before i hash the passwords?
Title: Re:Password Change
Post by: Ithien on July 10, 2003, 03:32 PM
Public Sub SendChangePassword()
   Dim Result As Boolean
   Dim accountHash As String
   accountHash = String(5 * 4, vbNullChar)
   Result = X(accountHash, varPass)
   Dim Result2 As Boolean
   Dim ClientKEY As Long
   ClientKEY = GetTickCount()
   Dim accountHash2 As String
   accountHash2 = String(5 * 4, vbNullChar)
Result2 = X(accountHash2, setup.vOPass.text)
Result2 = X(accountHash2, MKL(ClientKEY) & MKL(ServerKey) & accountHash2)
accountHash2 = MKL(ClientKEY) & MKL(ServerKey) & accountHash2
   If Result = True And Result2 = True Then
       pbuffer.InsertDWORD ClientKEY
       pbuffer.InsertDWORD ServerKey
       pbuffer.InsertNonNTString accountHash2
       pbuffer.InsertNonNTString accountHash
       pbuffer.InsertNTString varUser
       pbuffer.sendPacket &H31
   Else
       AddChat vbRed, " - Password change failed, Could not hash"
       form1.BotDisconnect
   End If
'(DWORD)      Client Key
'(DWORD)      Server Key
'(DWORD[5])   Old password hash
'(DWORD[5])   New password hash
'(STRING)         Account name
End Sub

Right after i send that, bnet kills the connection, so I don't know what's wrong with it,
Title: Re:Password Change
Post by: Ithien on July 10, 2003, 10:03 PM
[9:48:32 PM]  - Hash information was successfull
[9:48:32 PM]  - Icons File: icons.bni
[9:48:32 PM]  - Sending cdkey information...
[9:48:32 PM]  - Cdkey information was successfull
[9:48:32 PM]  - Attempting to change password...
[9:48:33 PM]  - Disconnected

Still, right after it's sent, bnet kills the connection.