Valhalla Legends Forums Archive | Battle.net Bot Development | Need help getting started

AuthorMessageTime
winhog
Hi, I have never made a bot before but I know a decent amount of winsock and c++ and I was wondering if anyone could help me get started.  I'm trying to make a bot that will connect as warcraft 3 (or the expansion).

What should I send (and to what server) in order to just get logged on? I looked around and I saw lists of bytes to send, but I didn't see anywhere that mentioned the username or password or cd-key. 

Sorry...I know very little about this. Thanks for any help.
October 18, 2004, 1:30 AM
TangoFour
Are you going to use BNLS or local hashing?

If the former:

http://www.valhallalegends.com/yoni/BNLSProtocolSpec.txt

To initiate a binary connection to Battle.net, send the byte 0x01, and then follow this login sequence (the following are packets, most of them documented either in the above link, or at http://bnetdocs.valhallalegends.com )

C->S: 0x50
S->C: 0x25
S->C: 0x50
C->S: 0x25 (optional)
C->S: 0x51
S->C: 0x51

After this, it all depends on what you want to do (create an account, log in to an account - or upgrade your account - if I'm correct you'll never be doing the latter with WarCraft 3)
October 18, 2004, 12:06 PM
winhog
Thanks, the documentation and sequence should be enough to get me started.

Can you recommend any tutorials/documention on how I could do local hashing instead of BNLS?
October 18, 2004, 4:57 PM
iago
There is no publicly released sourcecode for War3 in C++.  There is a C# version, and a Java version, both opensource, and supported by their authors (the Java one being mine).  There is a stolen, unsupported C++ along with a .dll, but I'll cry if you use it :). 

There is also a server something like BNLS written in Java that can be run locally that does it, but I don't think it has been released yet.
October 18, 2004, 5:05 PM
winhog
Hmmm. I'm guessing I'll use bnls for now...but what's a link to your java version?
October 18, 2004, 5:26 PM
iago
It's on "iago's forum" on this board, stickied.
October 18, 2004, 11:51 PM
winhog
Wow that may be a bit above my head  ;D .

Anyway, I think I'm making some progress with my program but I can't really be sure. I've only made it to message 0x50 to battle.net. Can anyone confirm that the values I'm getting back aren't way out of whack?

NLSRevision is 2
MPQName is IX86ver4.mpq
SessionKey is seemingly random
Checksum value some strange string with A = something, B = something, A = A^S...I really have no idea what it means.

Those values seem reasonable to me...but hey some encouragement that I'm at least on the right track would be nice too.
October 19, 2004, 1:43 AM
winhog
Hit a major snag with 0x51...

I'm not sure if you can figure out what's wrong just by looking at the packet but here it is

12  129.170.218.196:1691  213.248.106.66:6112  99  Send 
0000  FF 51 63 00 01 00 00 00 00 00 00 64 11 00 01 12    .Qc........d....
0010  01 00 00 00 95 71 E2 95 1A 00 00 00 0E 00 00 00    .....q..........
0020  68 45 1B 00 00 00 00 00 05 AC B5 49 AE D3 7F BC    hE.........I....
0030  34 8E A3 10 A3 EF 74 57 AC A0 50 57 61 72 33 2E    4.....tW..PWar3.
0040  65 78 65 20 30 39 2F 31 35 2F 30 34 20 32 32 3A    exe 09/15/04 22:
0050  34 32 3A 31 36 20 31 35 36 38 32 31 31 00 54 6F    42:16 1568211.To
0060  6D 00 00                                          m..


while the one sent by war3 looks like

7  129.170.218.196:1662  211.233.0.56:6112  135  Send 
0000  FF 51 87 00 4D 75 40 02 64 11 00 01 00 42 8B 24    .Q..Mu@.d....B.$
0010  02 00 00 00 00 00 00 00 1A 00 00 00 0E 00 00 00    ................
0020  68 45 1B 00 00 00 00 00 5A 74 84 B1 35 C8 74 90    hE......Zt..5.t.
0030  B0 E0 2A 55 50 91 8B E1 97 37 E9 38 1A 00 00 00    ..*UP....7.8....
0040  12 00 00 00 AC 08 22 00 00 00 00 00 26 17 4F 90    ......".....&.O.
0050  9F 66 33 38 30 1D 09 97 62 3A F1 DA C3 F2 42 B6    .f380...b:....B.
0060  77 61 72 33 2E 65 78 65 20 30 39 2F 31 35 2F 30    war3.exe 09/15/0
0070  34 20 32 32 3A 34 32 3A 31 36 20 31 35 36 38 32    4 22:42:16 15682
0080  31 31 00 54 6F 6D 00                              11.Tom.


Edited:  Some weirdness with my send/recv was causing problems...so it's looking better now but still not quite right


Edit #2...wow, one extra 00 at the end can cause a lot of problems.  ::) Sorry for my noobness, I can get authenticated by b.net now.
October 19, 2004, 3:25 AM
iago
Session key is indeed random.
NLSRevision is right.
MPQName is right.

And that version string is a mini-program to verify your files.
October 19, 2004, 5:02 PM
winhog
Thanks very much!!  ;D I've got a working chat client now! The problem is i seem to be able to do a LOT of things that get me banned from b.net for a few minutes...but I'll figure that out soon enough I suppose. 

An EditBox control also doesn't seem to be a good chat window since it scrolls to the very top everytime i setwindowtext on it. Do most people make their own sort of chat window class, or is there something about EditBox that I'm missing?
October 21, 2004, 4:32 AM
iago
I think most use a RichTextbox (RTB).  Just make sure you filter out RTB Control Codes (I don't know what they are).
October 21, 2004, 4:30 PM
R.a.B.B.i.T
When parsing messages to be displayed, always just flip the backslash in "{\rtf", or get rid of it, because "\rtf" is required before any RichText control code (as iago puts it) can be used, like a type identifier, I suppose.
October 25, 2004, 2:45 AM
Skywing
The proper way to do that is to insert text with RTF parsing off (look up the EM_STREAMIN message).
October 25, 2004, 2:50 AM
R.a.B.B.i.T
[quote author=Skywing link=topic=9207.msg86021#msg86021 date=1098672647]
The proper way to do that is to insert text with RTF parsing off (look up the EM_STREAMIN message).
[/quote]And who here besides you uses "the proper way" to do anything?  We all half-assishly create most of our code.  Silly Skywing.

But yes, that's the way you should do it if you want good code, otherwise you can just be lazy like 90% of the other programmers and simply flip the backslash.
October 26, 2004, 1:08 AM
UserLoser.
[quote author=R.a.B.B.i.T link=topic=9207.msg86128#msg86128 date=1098752898]
[quote author=Skywing link=topic=9207.msg86021#msg86021 date=1098672647]
The proper way to do that is to insert text with RTF parsing off (look up the EM_STREAMIN message).
[/quote]And who here besides you uses "the proper way" to do anything?  We all half-assishly create most of our code.  Silly Skywing.

But yes, that's the way you should do it if you want good code, otherwise you can just be lazy like 90% of the other programmers and simply flip the backslash.
[/quote]

Me
October 26, 2004, 1:11 AM
Arta
[quote author=R.a.B.B.i.T link=topic=9207.msg86128#msg86128 date=1098752898]
[quote author=Skywing link=topic=9207.msg86021#msg86021 date=1098672647]
The proper way to do that is to insert text with RTF parsing off (look up the EM_STREAMIN message).
[/quote]And who here besides you uses "the proper way" to do anything?  We all half-assishly create most of our code.  Silly Skywing.

But yes, that's the way you should do it if you want good code, otherwise you can just be lazy like 90% of the other programmers and simply flip the backslash.
[/quote]

Writing half-assed crap when a good solution is available is a rather telling mark of inexperience.
October 26, 2004, 9:03 PM
Minux
Not really, it's just the same as for example:

A good programmer uses CSB to save effort
vs
A not-so-good programmer uses CSB to save learning.
October 26, 2004, 11:20 PM
Myndfyr
[quote author=Minus link=topic=9207.msg86244#msg86244 date=1098832859]
Not really, it's just the same as for example:

A good programmer uses CSB to save effort
vs
A not-so-good programmer uses CSB to save learning.
[/quote]

Your example is correct, but you're applying it incorrectly.  A good programmer who uses CSB to save effort will still use proper coding practices, such as the utilization of Skywing's EM_STREAMIN example.  I use good coding practices in most of my work (unless I let myself get sloppy), and I pride myself on being consistent and generating clean code.  Therefore, using CSB in a bot application wouldn't make me a bad programmer.  Code reuse has been around since before the dawn of personal computing, and it will continue to be an important practice in the years to come.

But, doing something a certain way because 90% of the rest of the people do it that way is assinine.
October 28, 2004, 6:56 PM

Search