• Welcome to Valhalla Legends Archive.
 

A good place to start

Started by Lxir, August 11, 2008, 07:54 AM

Previous topic - Next topic

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,

MyndFyre

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.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Yegg

MyndFyre gave you all the info you do need. Just to confirm, what you're planning to do IS possible in Perl.

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,

Lxir

#4
It also seems that I have to learn more about assembling/disassembling TCP packets with Perl...

Quote from: MyndFyre[vL] on August 11, 2008, 08:45 AMit'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)
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 ?

Lxir

Hmmm... not easy.

I would need a simple example...

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:

from struct import *

x = pack('i', 500)


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.

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

???

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...