• Welcome to Valhalla Legends Archive.
 

Need help getting started

Started by winhog, October 17, 2004, 08:30 PM

Previous topic - Next topic

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.

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)

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?

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.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


winhog

Hmmm. I'm guessing I'll use bnls for now...but what's a link to your java version?

iago

It's on "iago's forum" on this board, stickied.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


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.

winhog

#7
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    [email protected].$
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.

iago

Session key is indeed random.
NLSRevision is right.
MPQName is right.

And that version string is a mini-program to verify your files.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


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?

iago

I think most use a RichTextbox (RTB).  Just make sure you filter out RTB Control Codes (I don't know what they are).
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


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.

Skywing

The proper way to do that is to insert text with RTF parsing off (look up the EM_STREAMIN message).

R.a.B.B.i.T

Quote from: Skywing on October 24, 2004, 09:50 PM
The proper way to do that is to insert text with RTF parsing off (look up the EM_STREAMIN message).
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.

UserLoser.

Quote from: R.a.B.B.i.T on October 25, 2004, 08:08 PM
Quote from: Skywing on October 24, 2004, 09:50 PM
The proper way to do that is to insert text with RTF parsing off (look up the EM_STREAMIN message).
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.

Me