• Welcome to Valhalla Legends Archive.
 

bnls 0x09

Started by solidsnake, June 24, 2003, 10:01 PM

Previous topic - Next topic

solidsnake

my question is regarding s->c 0x09 BNLS_VERSIONCHECK
the version check string consists of exeinfo and some timestamp
Where do I make the split when parsing this string.  What is the exeinfo (needed in c->s 0x51 SID_AUTH_CHECK) ?  Is it the filename of the binary that bnls returns (ie. "Starcraft.exe") or is it the whole string including the timestamp?  I guess my question is .. exeinfo is what substring portion of the returned version check string from BNLS_VERSIONCHECK?

The reason Im asking this is because I feel that its this part that is giving me the error below:

Connecting to BNLS...
Connected to BNLS => bnls.valhallalegends.com/63.161.183.91:9367
Sent BNLS 0x0E
Recvd BNLS 0x0E
Sent BNLS 0x0F
Recvd BNLS 0x0F
BNLS Authorized.
Sent BNLS 0x00 [Keep_Alive]
Connecting to BNET...
Connected to BNET => uswest.battle.net/63.241.83.7:6112
Sent BNET:0x50
Sent BNET:0x25
Recvd BNET: 0x25
Recvd BNET: 0x50
Sent BNLS 0x09
Recvd BNLS 0x09
Sent BNLS 0x01
Recvd BNLS 0x01
Sent BNET: 0x51
Recvd BNET: 0x51
0x0101: Game version unrecognized.

Camel

post the 0x51 you sent

solidsnake

pb.startnew();
pb.putD(bnetclienttoken);
pb.putD(version);
pb.putD(checksum);
pb.putD((int)0x01);
pb.putD((int)0x00);
pb.putNS(cdkeyhash);
pb.putS(exeinfo);
pb.putS(cdkey_user);
pb.sendBNET(out,(byte)0x51);

solidsnake


Kp

Quote from: solidsnake on June 24, 2003, 11:45 PM
nvm i got it =)
Would you care to elaborate, that other new programmers may avoid the same mistake? :p
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

solidsnake

well I have to first say that making a mistake and then taking the time to learn how to do it right makes you feel better in the end, rather than just being lazy and asking someone to give you the source.  I would like to thank vL and BNetDocs and BNLS for making the community so much better!  Here are somethings that might help others who are trying to write a bot with BNLS support.  BNLS is a service that helps you connect to BNET, (ie. calculate password hash for logon).

I will speak of some common mistakes which I have made.  When I say that something means something I do not wish to be flamed by ppl saying no, that is only the case 99% of the time.  I do realize that not everything is perfect but the point of this post and this forum as a whole is to help beginners,  ... the point is not to confuse noobs with ego-centered techno babble in an attempt to make yourself look superior.  With that said .. let me begin.

Remember that there are many reasons for your code to not work and there are many ways to fix it.  
IF the server never sent back 0x50 that means u didnt send 0x50 correctly.  make sure you have the right number of bytes sent (check bnet docs for reference)
1)  Check that you have sent all numerical data (short,int,long,byte) in network order or most significant bit first order.  
That means that if you need to send a DWORD of the number 1 or the byte value 0x01 then your packetlog should hexdump 01 00 00 00.  Also know when to send a string and when not to.  For example, when sending the mpq version digit dont send the ascii value.. instead send the numerical value.  
2) make sure you send your strings properly.  check the length and check to make sure its not an array out of bounds situation.  That means that if you are using a char[] or byte[] to store a string then make sure it does not go beyond the defined length.  This may not be the case for slow VB dynamic strings.  Also if the server requires a string to be null terminated (ends with 0x00) then append a chr(0) at the end.  
3)  Make sure your using the correct hashing algorithms.  To logon to bnls you need to have the do a crc32 on ur password and the servertoken.
4) when you logon to bnet with 0x3a remember that it uses the bnet modified broken sha-1.  if you cant do the right hashing function you can use bnls to hash it (0x0b)  remember its the hash of the password then take that new hash and append the client and server token and then hash it again.. The hash will always give back a 20byte (5 dwords) data.
the client token is generated by you .. you can use a random function or a timestamp/gettickcount function or you can have bnls do it for you (0x09 then 0x01) .. the server token is what you got from bnet 0x50 (second dword in the data part .. the first in 0x50 is the logon type .. 0 for games like sc/bw/war2/d2 and then theres 1 and 2 for the nls new revisions logons .. reference the bnetdocs)  
5)  you might also get errors trying to check the version and the cd key(s) .. there are code out there (ie checkrevision.dll, hash.dll, etc )  once again, make sure you send the right hash.  I used bnls .. I know ppl will call me a noob for doing that but here is how I see it:  I am a beginner and making my first bot.  also I am taking advantage of a great resource.  Yes I will continue to learn and then I will use a non-third party based implementation.  Anyways, remember to send the right format to bnls inorder to get the right hash back.  You need to use the mpq and exe info from 0x50.  Check that the extra info that you send to bnls to do the version check has a the right length.  Also the cdkey that you send to be hashed by bnls cannot contain spaces or dashes and is null terminated.

There was much more but my computer crashed as I was writing this so Im sorry but I will post (again) the rest some other time.

Just remember to packetlog and make sure you are sending what you are suppose to be sending.  use a hex calculator to check the values of the data that you send.  

Also I would suggest you learn a language before trying to write a bot.  If you need help with vb strings check out http://www.aivosto.com/vbtips/stringopt.html
Also www.pscode.com helps and theres always google.
And of course the vL website. and its many resources.

Thank you for reading and I wish you all the best of luck.

Arta

#6
Glad to be of help.

btw...
Quote
Also I would suggest you learn a language before trying to write a bot.

That's just golden :)

Zakath

Well...he DOES have a point. :P
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

smoke

My god... what is amazing is that it only took his 6th post to reach that pinnacle moment proclaiming what it is that eveybody here dispises most, non-programmers proclaiming their desire to write a bot.

Oh, we're all guilty of it, but when I did it there wasn't much of an internet.  I was in my early teens, had gotten my hands on a res editor and disassembler.  I was like, I'm gonna make my own version of the OS.  Well, obviously that didn't go very far.

The point is, if you want to write a bot... GREAT!  More power to ya!

If you have no idea how to write a bot or how to write a program for that matter, find another programming forum, a good book, a geek friend, take a class, whatever... Just don't try taking on the world for your first project.

Programming is seriosly like learning a foriegn language... you're not going to understand it or speak it right away.  It takes time to learn, or you just have to completely submerse yourself in it to learn faster.  The only problem with that is that everybody else is going to just look at you funny (and probably associate your communcation/programming skills with your intelligence) until you actually start to pick stuff up.  Man, wouldn't it be nice that instead of taking spanish, french, german, latin, etc... you could just take a foreign language in C++?

That's it for me... l8r
Smoke

InVictuS

Having a geek friend to guide you really helps ;D