Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Sorc.Polgara on March 01, 2005, 06:21 PM

Title: [C++] Client Token (Client session key)
Post by: Sorc.Polgara on March 01, 2005, 06:21 PM
Ok, I was looking at the open source Yobgul's (I think that is how you spell it) BnetAuth open source to figure out how to create the Client Token (Client session key) for local cd-key hashing in C++.

I figured the piece of code that he used to get the Client Token is the "GetTickCount()" function.

So I tested out the GetTickCount().  I compared the resulting DWORD from GetTickCount() and the Client Token that I recieved from BNLS_CDKEY (0x01).

They aren't the same, at all...

wtf...
Title: Re: [C++] Client Token (Client session key)
Post by: Eric on March 01, 2005, 06:25 PM
BNLS generates it's own client key, hashes the CD-Key and then returns the client key used and the CD-Key hash.  You are then expected to send both, the client key BNLS used and the CD-Key hash, to Battle.net.
Title: Re: [C++] Client Token (Client session key)
Post by: dxoigmn on March 01, 2005, 07:13 PM
Quote from: LoRd[nK] on March 01, 2005, 06:25 PM
BNLS generates it's own client key, hashes the CD-Key and then returns the client key used and the CD-Key hash.  You are expected to then send both, the client key BNLS used and the CD-Key hash, to Battle.net.

In other words, the client token can be completely random (or static) and, as the name indicates, is generated by the client.
Title: Re: [C++] Client Token (Client session key)
Post by: Sorc.Polgara on March 01, 2005, 08:38 PM
Quote from: dxoigmn on March 01, 2005, 07:13 PM
Quote from: LoRd[nK] on March 01, 2005, 06:25 PM
BNLS generates it's own client key, hashes the CD-Key and then returns the client key used and the CD-Key hash.  You are expected to then send both, the client key BNLS used and the CD-Key hash, to Battle.net.

In other words, the client token can be completely random (or static) and, as the name indicates, is generated by the client.

Ok, so... I can use the one generated by GetTickCount! yay.
Title: Re: [C++] Client Token (Client session key)
Post by: UserLoser. on March 01, 2005, 10:39 PM
Quote from: Solc.Polgara
So I tested out the GetTickCount().  I compared the resulting DWORD from GetTickCount() and the Client Token that I recieved from BNLS_CDKEY (0x01).

They aren't the same, at all...

wtf...
GetTickCount returns the number of milliseconds that the system has been up for.  Unless the server BNLS runs on and your system are perfectally syncronized, the value will never be the same (that is, assuming BNLS uses GetTickCount)
Title: Re: [C++] Client Token (Client session key)
Post by: Joe[x86] on March 02, 2005, 07:00 AM
Remember: You're going to have to set a constant long to GetTickCount(), because otherwise it'll change.
Title: Re: [C++] Client Token (Client session key)
Post by: MyndFyre on March 02, 2005, 11:15 AM
Quote from: JoeTheOdd on March 02, 2005, 07:00 AM
Remember: You're going to have to set a constant long to GetTickCount(), because otherwise it'll change.

Not a *constant* long, because that's set at compile-time, not runtime.  :P
Title: Re: [C++] Client Token (Client session key)
Post by: shout on March 04, 2005, 10:59 AM
If you are testing your code I belive you can use BNLS_CDKEYEX or something like that to specify a client token.