• Welcome to Valhalla Legends Archive.
 

File transfer and chat protocols

Started by Xmas-Bob, January 22, 2004, 11:14 AM

Previous topic - Next topic

Xmas-Bob

Sorry for asking this newbie question, but I just can't find out on my own. I want to access bnet using a chat client but the logon sequences and packets described here do not resemble them. Data received from the server is for example :

New connection to europe.battle.net:6112
Send(0x03) for chat client
Answer : (string) Connection from ... Enter your account name etc...
.. somewhen later ...
1018 INFO "This server is hosted by Telia."

What about the logon sequences specified in the docs ? And what are the file transfer specs ?

Thanks a lot for your help !


iago

There are various ways to connect to the battle.net servers:

The easiest is through chat, which means the first byte you send is 0x03 (or ctrl-c), and you get an ascii protocol.  That is the one that you are describing.

If the first byte you send is 0x01 (ctrl-a), it means you want a binary protocol, and things are much more complicated (as outlined in bnetdocs).

If the first byte you send is 0x02 (ctrl-b), it means you want a file transfer protocol, which I know nothing about.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Spht


Xmas-Bob

Ah great thanks a lot! Where can I find more info on the ASCII protocol for the chat clients ?

iago

#4
It should be fairly straight forward.  Just connect to useast.battle.net (using telnet), hit ctrl-c, and follow the instructions.  It should be obvious what the important stuff means, and the rest of the stuff (flags, etc.) aren't important (well, they are, just not critical to understand)

[ Edit by Skywing: Fixed spelling errors in useast.battle.net hostname ]
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Tuberload

#5
Quote from: Xmas-Bob on January 22, 2004, 02:15 PM
Ah great thanks a lot! Where can I find more info on the ASCII protocol for the chat clients ?

When you connect to battle.net send 0x3 (ctrl-c). You will then be prompted for a username/password. After you logon it should be pretty self explanatory from their. An example:
1005 TALK Tuberload 0010 "Hello, World!"

1005 is the packet ID, TALK is a string version of the ID, Tuberload is the name of the person sending the event, 0010 is the flags of the person, "Hello, World!" is pretty obvious.

Another Example:

1002 JOIN divinemorgan 0000 [D2XP]

[D2XP] is the client type, in this case it is a DiabloII Expansion user.

All packets will look like this, and contain the same pieces give or take a few depending on the packet. Please note that chat clients are restricted to channels starting with "Public Chat". A good example of how to program a chat client in C++ is GreetBot. A google search should find it fairly easily. A java example can be found in this thread: http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=display;threadid=4844;start=0. Just look through until you find iago's examples.

Here soon I will be releasing the first issue of The Bot Creator, which may, or may not help you in creating a bot.
Quote"Pray not for lighter burdens, but for stronger backs." -- Teddy Roosevelt
"Your forefathers have given you freedom, so good luck, see you around, hope you make it" -- Unknown

Xmas-Bob

Okay I read over the source code of another bot from Valhalla Legends and it sends 0x03 and 0x04 to the server.
What does code 0x04 stand for ?
And how about the chat flags etc. where can I find more info on them ?
thanks again for your help guys

iago

0x04 turns off local echoing.  It's good for a bot, but bad for telnet.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Kp

Quote from: iago on January 23, 2004, 11:23 AM
It's good for a bot, but bad for telnet.

That depends on whether your telnet client is already in local echo mode.  ^D turns off remote echo, not local echo. :)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

iago

Quote from: Kp on January 23, 2004, 03:23 PM
Quote from: iago on January 23, 2004, 11:23 AM
It's good for a bot, but bad for telnet.

That depends on whether your telnet client is already in local echo mode.  ^D turns off remote echo, not local echo. :)

Yeah, you're right, I meant remote.  And telnet doesn't echo when I'm connected to battle.net, I noticed.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Skywing

Quote from: iago on January 23, 2004, 04:52 PM
Quote from: Kp on January 23, 2004, 03:23 PM
Quote from: iago on January 23, 2004, 11:23 AM
It's good for a bot, but bad for telnet.

That depends on whether your telnet client is already in local echo mode.  ^D turns off remote echo, not local echo. :)

Yeah, you're right, I meant remote.  And telnet doesn't echo when I'm connected to battle.net, I noticed.
Because Battle.net does not send any telnet protocol commands, that's client-specific.

Kp

Quote from: Skywing on January 23, 2004, 04:55 PMBecause Battle.net does not send any telnet protocol commands, that's client-specific.

To clarify and extend, whether to echo locally is specific to your instance of the application; the default varies depending on what telnet you run.  The linux based telnet I use defaults to echo on and line buffering; Win32 telnet defaults to echo off (though at one time I had it turned on) and character mode buffering.  Note that even this may vary within the Windows families, as Win9x and Win2k seem to have completely different implementations of telnet relative to each other.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!