• Welcome to Valhalla Legends Archive.
 

Bnet connection help

Started by Toodles, June 11, 2004, 03:09 PM

Previous topic - Next topic

Toodles

Allo, I'm obviously new here thus this being my first post here. I have been reading around on the forums for some time now and have posted a bunch on other forums such as madzbots and stealth. I am trying to make a little bot yet I'm coming across a few problems. I am progging in C++ and I know how to use winsock2 and I am not having a problem with program anything really... I connected to bnet i think but that again eveyone is using bnls or local "hashing" to connect for somereason. Can't you just connect to it with winsock dirrectly? So if anyone can tell me how to connect to bnet, hopefully with out using bnls thad be very grateful. I am pretty sure once connected and everything  I could send packets to create text and shit with out using addchat and all that stuff. Thx

DeTaiLs

You need to use hashing or bnls to connect to b.net



BinaryzL

#2
Quote from: Toodles on June 11, 2004, 03:09 PM
Allo, I'm obviously new here thus this being my first post here. I have been reading around on the forums for some time now and have posted a bunch on other forums such as madzbots and stealth. I am trying to make a little bot yet I'm coming across a few problems. I am progging in C++ and I know how to use winsock2 and I am not having a problem with program anything really... I connected to bnet i think but that again eveyone is using bnls or local "hashing" to connect for somereason. Can't you just connect to it with winsock dirrectly? So if anyone can tell me how to connect to bnet, hopefully with out using bnls thad be very grateful. I am pretty sure once connected and everything  I could send packets to create text and shit with out using addchat and all that stuff. Thx

They do use winsock 2.0 but BNLS and local "hashing" are methods of logging onto battle.net/using battle.net. Someone else can probably post a better explanation.

Adron

#3
You use winsock to connect to it. 1.1, 2.0, either will work.

Then you need to know what to send to identify yourself, to talk, to whisper, to join games, etc. Depending on which of the available protocols you choose to use, you may have to use what is called "hashing" or BNLS. "Hashing" is just the procedure for producing some of the information you are required to send to battle.net at a particular place in the login procedure using a certain protocol. And if you don't want to do "hashing" yourself, you can ask BNLS to do it for you.



Oh, you asked about how to connect to b.net too. You make a tcp connection to a b.net server on port 6112. That's it, then you're connected. Perhaps you can then find a way to send packets to create text and shit without hashing. One idea would be to try sending a character with the ascii value of 3. You can find b.net server ips by resolving things like useast.battle.net, uswest.battle.net, asia.battle.net, europe.battle.net, ...

Toodles

Yea I have a clean connection to battle net i believe using the port: 6112 and server: 66.132.130.34
I had this a while ago, so if I'm connected to bnet... how would i now use hashing... I'm guessing I there are just general subs for the different things needed for bnet in storm.dll... I just don't know how to look at those subs and don't know what to send.

DeTaiLs

Just for a sidenote if you are trying to make wc3 bot u have to use bnls



hismajesty

Quote from: Twix on June 11, 2004, 03:15 PM
You need to use hashing or bnls to connect to b.net

No you don't.

QuoteJust for a sidenote if you are trying to make wc3 bot u have to use bnls

No you don't.

Adron

Quote from: hismajesty[yL] on June 11, 2004, 06:30 PM
Quote from: Twix on June 11, 2004, 03:15 PM
You need to use hashing or bnls to connect to b.net

No you don't.

QuoteJust for a sidenote if you are trying to make wc3 bot u have to use bnls

No you don't.

I already said that! :P

Adron

Quote from: Toodles on June 11, 2004, 05:38 PM
Yea I have a clean connection to battle net i believe using the port: 6112 and server: 66.132.130.34
I had this a while ago, so if I'm connected to bnet... how would i now use hashing... I'm guessing I there are just general subs for the different things needed for bnet in storm.dll... I just don't know how to look at those subs and don't know what to send.

If you try the idea I mentioned previously, you don't have to use hashing.

Other than that, it's a huge topic. You should read up on this by checking this forum and bnetdocs. Familiarize yourself with "packets". You can find an explanation of packets in one of the most recent threads in the AIM bot forum.

There aren't general subs for the b.net things in storm.dll. They are in battle.snp. To look at them, you could use a tool such as w32dasm or IDA.

But I don't think trying to use them would be a good idea. What most do is either use reverse-engineered and rewritten versions in their native language, called "local hashing", or use the BNLS interface to get the right processing performed for you.

You should definitely log b.net connections with a packet sniffer / network tracer / packet capture application / whatever you like to call it. Something that allows you to check what data a real client sends ;)

Eli_1

#9
Quote
Familiarize yourself with "packets". You can find an explanation of packets in one of the most recent threads in the AIM bot forum.

http://forum.valhallalegends.com/phpbbs/index.php?board=20;action=display;threadid=7100

Quote
A "packet" can be used in many places. A packet as used here just means "a group of data".

In a way, you are already using packets to communicate with battle.net for getting those statistics. Your packets are delimited by "\n", line-feeds. They are more commonly called "lines".

There's nothing magical about "packets".

What's different from what you're used to is that the packets here in the binary world contain data that can't be read as a sequence of characters, and that they may seem harder to separate.

In battle.net, for a binary connection, a packet could be any length between 4 and 65535 bytes. You don't find the end of a packet by looking for a line-feed, but by reading the start of the packet, looking at a value there that tells you how long the packet will be.

If you print out the contents of the incoming data from the server, a stream of textual, line-feed delimited data will be easy to read. The corresponding binary packets with a length field instead of a separator character, and using binary characters instead of text, will be harder to read. In an application, I personally think that packets with a length field at the start, and data that doesn't have to be translated into binary are easier to parse.

If "translated into binary" doesn't make sense to you, you're probably a high level programmer. In a language like C++, you're very aware of the difference between

char textvalue[] = "3.14159";

and

float floatvalue = 3.14159;

A textual "packet" (line) will contain the first representation, a string. A binary packet will contain the second representation, an actual number as the computer would write it.


I hope this will answer your first question about what packets are.


For the second one, how to send and receive them, it depends entirely on what language you will be using to do it. In c++, you'd probably use the "send" and "recv" functions to send and receive data from the server. You'd typically receive it into a char[] buffer, and then parse out packets from that depending on how the packets are delimited in your particular protocol.


For your third question, I don't know exactly how it works in AIM. I've never programmed for AIM. I think you'll be able to find definitions for what packets are in AIM in other posts on this forum. Read those. Knowing that "packet" isn't anything magical, you should be able to make sense of the specifications you find there.

Toodles

Yes i know exactly what packets are and such. I have looked through bnet docs multiple times. When you connect to bent do they send you certain packets instantly which u have to respawn to? Thats where I'm stuck. I did read the topic in AIM bots about packets, etc. I'm just wondering what to send send to login and stuff in order to get into a channel.

BaDDBLooD

You first tell bnet what Protocol you want to use

i think they're:

Chat
FTP
Game

I think game = Chr(1)

After that you send packet 0x50 to Bnet

Bnet responds by sending 0x50 and 0x25 Back to you... that should get you started nicely
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

GoSuGaMING

Quote from: Toodles on June 11, 2004, 09:56 PM
Yes i know exactly what packets are and such. I have looked through bnet docs multiple times. When you connect to bent do they send you certain packets instantly which u have to respawn to? Thats where I'm stuck. I did read the topic in AIM bots about packets, etc. I'm just wondering what to send send to login and stuff in order to get into a channel.

maby you should try packetlogging a bot... you dont just send one packet and your connected to battle.net or as you put it "bent" Bnet responds or "respawns" to only what you send it.

Eli_1

Quote from: GoSuGaMING on June 11, 2004, 10:00 PM
Quote from: Toodles on June 11, 2004, 09:56 PM
Yes i know exactly what packets are and such. I have looked through bnet docs multiple times. When you connect to bent do they send you certain packets instantly which u have to respawn to? Thats where I'm stuck. I did read the topic in AIM bots about packets, etc. I'm just wondering what to send send to login and stuff in order to get into a channel.

maby you should try packetlogging a bot... you dont just send one packet and your connected to battle.net or as you put it "bent" Bnet responds or "respawns" to only what you send it.

You're connected to b.net without doing much of anything, it's the logging in that requires packets to be sent.

Toodles

#14
you know your kool when you point out people typos but yea respawn was a reallly bad typo.

Yes, exactly Eli_1, I'm stuck at the logging in part.

And BaDDBLooD thx a lot, thats what i was looking for.   ;D