Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: TruffleShuffle on November 23, 2002, 08:41 PM

Title: Old 0x36 packet [C++]
Post by: TruffleShuffle on November 23, 2002, 08:41 PM
                             printf("Checking product key...\n");
                                    ValidCdkey = DecodeCDKey(cdkey, &valProdID, &valValue1, &valValue2);
                                    if(!ValidCdkey){
                                          printf("Local decode of product key returned false -- aborting!\n");
                                          Disconnect();
                                          return;
                                    }
                                    cdkeyhashbuf[0] = d;
                                    cdkeyhashbuf[1] = encryptvalue;
                                    cdkeyhashbuf[2] = a;
                                    cdkeyhashbuf[3] = b;
                                    cdkeyhashbuf[4] = c;
                                    HashData((char *)cdkeyhashbuf, 20, (char *)cdkeyhash);

                                    packetbuf.insert((int)0);
                                    packetbuf.insert(strlen(cdkey));
                                    packetbuf.insert(a);
                                    packetbuf.insert(b);
                                    packetbuf.insert(encryptvalue);
                                    packetbuf.insert(d);
                                    packetbuf.insert(cdkeyhash[0]);
                                    packetbuf.insert(cdkeyhash[1]);
                                    packetbuf.insert(cdkeyhash[2]);
                                    packetbuf.insert(cdkeyhash[3]);
                                    packetbuf.insert(cdkeyhash[4]);
                                    packetbuf.insert(username);
                                    packetbuf.sendpacket(bnet_data, 0x36);

This doesn't ip ban, but bnet returns invalid cdkey. Anyone see why?
Title: Re: Old 0x36 packet [C++]
Post by: Noodlez on November 23, 2002, 11:05 PM
ewwww use 0x51

and do you even know what that code does? or did you copy & paste it out of the vlbot on pscode

/me rollseyes

i dont remember 0x36 very clearly, but that looks correct
Title: Re: Old 0x36 packet [C++]
Post by: TruffleShuffle on November 24, 2002, 05:44 AM
Actually, I did not copy it out of vlbot, and I know what I want it to do..
Title: Re: Old 0x36 packet [C++]
Post by: Arta on November 24, 2002, 09:14 AM
Which game are you doing this for?

I don't use this packet but I would assume the hash is the same as SID_AUTH_INFO's. if it is, you're hashing the wrong data - should be:

ClientToken
ServerToken
KeyProduct
KeyValue1
0
KeyValue2

But you should use new packets, nood is right :)
Title: Re: Old 0x36 packet [C++]
Post by: Zakath on November 24, 2002, 10:15 AM
Yeah...new packets are much more compact. Less handling you have to do...and they're mapped out in the BNLS protocol spec, which is available for anyone to see.

Umm...where do you define d, encryptvalue, a, b, and c? Without knowing what those are, it's hard to help you.
Title: Re: Old 0x36 packet [C++]
Post by: TruffleShuffle on November 24, 2002, 10:19 AM
a, b, c, d and encryptvalue are all unsigned longs.
Title: Re: Old 0x36 packet [C++]
Post by: TruffleShuffle on November 24, 2002, 04:54 PM
boo!  :'(
Title: Re: Old 0x36 packet [C++]
Post by: Skywing on November 25, 2002, 08:55 AM
QuoteWhich game are you doing this for?

I don't use this packet but I would assume the hash is the same as SID_AUTH_INFO's. if it is, you're hashing the wrong data - should be:

ClientToken
ServerToken
KeyProduct
KeyValue1
0
KeyValue2

But you should use new packets, nood is right :)
The hashing method is not the same.  You shouldn't use SID_AUTH_* for Mac Starcraft or Warcraft II.
Title: Re: Old 0x36 packet [C++]
Post by: Zakath on November 25, 2002, 12:37 PM
I use it for War2 because Bnet will accept it. If they change that, so will I, but until then I see no reason to put in old auth code, since every other client I'm interested in supporting uses the newer auth system.

Connection.cpp is already 800+ lines long, I don't wanna make it more complex than I absolutely have to at this point!
Title: Re: Old 0x36 packet [C++]
Post by: tA-Kane on November 27, 2002, 12:45 PM
QuoteWhich game are you doing this for?

I don't use this packet but I would assume the hash is the same as SID_AUTH_INFO's. if it is, you're hashing the wrong data - should be:

ClientToken
ServerToken
KeyProduct
KeyValue1
0
KeyValue2

But you should use new packets, nood is right :)

No, 0x36 uses this packet format:

DWORD: 0x00000000
DWORD: CDKeyStringLength
DWORD: ProductID (Not STAR/SEXP/etc; Look at BNLS's GetVersionByte sequence for valid product IDs)
DWORD: KeyValue1
DWORD: ServerKey
DWORD: ClientKey
5 DWORDS: KeyHash

You get the KeyHash value by hashing...
DWORD: ServerKey
DWORD: ClientKey
DWORD: ProductID
DWORD: KeyValue1
DWORD: KeyValue2

Title: Re: Old 0x36 packet [C++]
Post by: Arta on November 29, 2002, 03:12 PM
Well, i was just suggesting, since yours isn't working. As i said i've never used this packet, so I wasn't sure.