Valhalla Legends Forums Archive | Battle.net Bot Development | A good place to start

AuthorMessageTime
Lxir
Hi !

I would want to make a simple script, in Perl, which would send a message to a player, like the /whisper command (and get server reply).
I already know a few about socket programming (in Perl and Java) so I'm trying to learn how BN servers communicate... and here seems a good place to start !

So first, I have a couple of questions:
- Can you confirm that what I'm trying to do is possible ?
- Should I use my own account/password or is there a way to connect as "guest/anonymous" ?
- Is there a risk to be banned (by account or IP) ?

Also, I'm a bit lost in things to send.
First, can you confirm that server must be, for example, europe.battle.net, port 6112 and tcp protocol ?
Then, I've read that the login protocol was ^C^D characters then username\r\n then password\r\n. I've also seen something about 0x01 then 0x50...
Finally, can I simply send commands like /time or /w *toto to get it work ? Will I receive anything from server like that ? Or is there some particular packets codes ?

I guess it's more complicated, so I would need help to start.
Sorry for the newbie attitude...

Thanks,
August 11, 2008, 12:54 PM
Myndfyr
Straight away, I don't know whether what it is you want to do is possible in Perl.  I imagine it is, but I'm not sure.

There is no guest or anonymous account; you can create an account on the fly if necessary, though.

IP banning typically occurs for a brief duration if you've got the protocol incorrect.  It progressively gets longer but is pretty short to start.

Most people start out by creating what we typically call "packet buffers."  If you're not aware, the Battle.net Chat Server (BNCS) protocol is binary; it's not just a matter of connecting and sending text over the wire anymore.  (They shut down access via the chat protocol about two years ago, IIRC).

You should certainly read the stickied Information for Newcomers thread.  Also, Arta's Bnetdocs has been offline for a while now; you might consider looking at a mirror.
August 11, 2008, 1:45 PM
Yegg
MyndFyre gave you all the info you do need. Just to confirm, what you're planning to do IS possible in Perl.
August 11, 2008, 3:09 PM
Lxir
Thanks for your reply.

I'm almost sure it's possible to use Perl for this kind of job, but my problem is to know what to send and what I'm supposed to receive.
The first thing should be to know which options and parameters to use with nmap in view to sniff packets traffic...

Then I would want to run the logon sequence without problem... It would be a good start.
Finally, I'll need to find details about the protocol for whispering.

I've already had a look at the "Information for newcomers" topic but I don't really want to learn all while I'm not totally new in programming (working as programmer since years).
And it's a bit hard to find good information/examples for Linux but not C++ users.

I'll try to post some code examples soon but any more help at this stage will be appreciated.

Regards,
August 11, 2008, 3:18 PM
Lxir
It also seems that I have to learn more about assembling/disassembling TCP packets with Perl...

[quote author=MyndFyre[vL] link=topic=17601.msg179275#msg179275 date=1218462352]it's not just a matter of connecting and sending text over the wire anymore.  (They shut down access via the chat protocol about two years ago, IIRC)[/quote]
That's the first good thing to know; it's probably why the source of gbnbot didn't help me so much :P

I'm also still wondering how the CD-Key is handled... Is it possible to connect a server with username/password without doing anything about it ?
August 11, 2008, 3:29 PM
Lxir
Hmmm... not easy.

I would need a simple example...
August 11, 2008, 4:40 PM
Yegg
Perl should have some kind of pack() and unpack() function that can handle much of what you need to do. Python also has these functions. For example in Python:

[code]from struct import *

x = pack('i', 500)[/code]

pack() creates a DWORD result in this case. It converts 500 according to the first argument of pack(). In our case, we have 'i' (for integer). IIRC, lowercase 'i' is signed and uppercase 'I' is unsigned but it could be the other way around. Regardless, it's quite simple and Perl's docs should have this in there.
August 11, 2008, 5:47 PM
Lxir
I have to do it step by step, hoping I'll find enough help to success...

First, I would like to capture packets communication.

But when I launch LoD then run:
sudo nmap -p T:6112 192.168.254.1

It just returns:
PORT    STATE  SERVICE
6112/tcp closed dtspc

???
August 11, 2008, 7:10 PM
Lxir
Ok, so thanks to Explicit[nK], now I know that nmap isn't the appropriate tool to capture TCP packets.
I'm having a look to wireshark...
August 11, 2008, 9:21 PM

Search