• Welcome to Valhalla Legends Archive.
 

opening port to receive/send packets

Started by Laff, September 17, 2004, 05:17 PM

Previous topic - Next topic

Laff

first a little history.  i'm a c++ programmer, and i know a lot of vb (although i hate it because it seems weak).  i had a class with a term project and i made one of those junky bots that can only go into public channels via a starcraft login/pw.  i've got another class coming up with a term project and i'd like to get a jumpstart and advance into a warcraftiii/tft bot that can go anywhere it wants.

my questions are about differences in connecting.  right now i've got a socket object that opens port 6112 via the socket object as defined in winsock2.h.  apparently (haven't looked at this code in a year) this object generates a windows message that i can catch and handle.  so when i try a connection and it succeeds i send out a 0x03, 0x04, username, carriage return, linefeed, password, carriage return, linefeed and then if it's successful i'm connected.  what do i have to do to connect as a warcraftiii or tft user?  hell, is this socket object even going to do the job i need to receive and parse these packets?

any help would be appreciated.  any source would be greatly appreciated.  once i get a connection down, i'm sure i can just read through the packet docs and parse them accordingly.  correct me if i'm wrong.  thanks.


MyndFyre

#2
Quote from: The-FooL on September 17, 2004, 08:05 PM
http://bnetdocs.valhallalegends.com/
http://www.valhallalegends.com/yoni/BNLSProtocolSpec.txt

Standard socket should accomplish it.

Giving him links without the purpose of those links does not help.

Why don't you try explaining to him some things?

Laff, I did not understand some of the concepts you'll run into when I first started.  Hopefully this will help you out.

There are two different (well, three, but only two enable you to chat) methods of connecting to Battle.net.  The first is the binary protocol, which is enabled by sending 0x01 (as opposed to 0x03) upon first connecting to the Battle.net Chat Server (BNCS).  This protocol is significantly more complicated than the chat gateway protocol which you've been using.

Essentially, putting together binary protocol connections involves sending and processing packets, which are (as opposed to the conventional networking term) a sequence of bytes that represent various values defined within the protocol.

These packet sequences are described in Bnetdocs, which is the link to bnetdocs.valhallalegends.com above.

Meat, I would suggest NOT point people to bot sources.  They'll learn better if they do it themselves.

Hope this helps.  If you have any questions, and are willing to work (you seem like it), I'll help you out.

Good luck!
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.

tA-Kane

#3
In addition to what they have said (Fool has provided the two best URLs when programming bots "to go into private channels", and MyndFyre has given you some excellent hints), I would like to add my own comments that should help prevent any confusion you might have with the CHAT connection which, from what I've read, is what you are using (sending 0x03).
Quote from: Laff on September 17, 2004, 05:17 PMi'd like to get a jumpstart and advance into a warcraftiii/tft bot that can go anywhere it wants. what do i have to do to connect as a warcraftiii or tft user?
It is currently not possible to use the CHAT protocol and login with a WarCraft III user, and the CHAT protocol cannot "go anywhere it wants", in terms of private channels.

To login with a WarCraft III account (let alone have the account "go anywhere it wants"), you will need to use the binary connection. BnetDocs accurately describes this connection, and BNLS makes this connection easy to use (and fast if you have a really slow computer). Note, however, that all of the information required to login under WarCraft III might not be available to you with BnetDocs. Instead, the BNLS specification has what BnetDocs would lack for you, which is simple documentation on packets 0x52 through 0x58.
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

UserLoser.

Quote from: tA-Kane on September 18, 2004, 01:13 AM
Instead, the BNLS specification has what BnetDocs would lack for you, which is simple documentation on packets 0x52 through 0x58.

Note that Warcraft III has no use and will never have use for BNCS packets 0x57 && 0x58

Laff

ha.  i guess my first post made me seem more of a noob than i am.  i totally understand the packet stuff and yes it is a lot more complex but still not overly difficult.  the hard part is trying to locate code or even help on c++ coding of hashing the cd key so i won't have to go through bnls.

me and the-fool were on aim for like 4 hours yesterday discussing things.

MyndFyre

Quote from: Laff on September 18, 2004, 11:41 AM
ha.  i guess my first post made me seem more of a noob than i am.  i totally understand the packet stuff and yes it is a lot more complex but still not overly difficult.  the hard part is trying to locate code or even help on c++ coding of hashing the cd key so i won't have to go through bnls.

me and the-fool were on aim for like 4 hours yesterday discussing things.

1.) Don't locate code.
2.) Use BNLS.  It doesn't require local files to hash, and it doesn't require the user to update his/her hashes.

That second "nugget of wisdom" only goes so far; I'm going to be incorporating the use of both BNLS and hashes, defaulting to BNLS at some point.
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.

Laff

no offense, but why should i do what you say?  i told you i don't want to use bnls.  let me do my own thing.  what gives you the right to tell me how i should be making a program anyway?

Kp

Quote from: Laff on September 19, 2004, 02:54 PM
no offense, but why should i do what you say?  i told you i don't want to use bnls.  let me do my own thing.  what gives you the right to tell me how i should be making a program anyway?

You wanted help.  You were given advice.  If you don't want to take it, that's fine - but generally you can only refuse good advice so many times before people stop advising you at all.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Laff

i'm just saying to stop posting redundant posts on "don't do it that way, because that's not how i do it" garbage.  i can easily get the bnls thing to work, but i don't want another server to depend on.  if you don't have APPLICABLE advice, don't post it.

tA-Kane

#10
Quote from: Laff on September 19, 2004, 05:30 PMi can easily get the bnls thing to work, but i don't want another server to depend on.  if you don't have APPLICABLE advice, don't post it.
APPLICABLE advice: Unless you have knowledge with disassembling programs (if you did, though, then would you be here asking these questions or rather disassembling one of Blizzards games, or even another bot, to answer the questions yourself?), look for CheckRevision on The Disclaimer (Battle.net Bot Development website): http://botdev.valhallalegends.com.

I think somewhere on there might also be CDKeyDecode(). You will be looking for that, too.

Edit: However, now that I think about it, the CDKeyDecode() that would likely be available there would not include code to decode a WarCraft 3 CD key. So, do a search for SRP on these forums, it should have the necessary code you seek (except the checkrevision that is required for version checking, I beleive the one available on the Bot Dev site does work for WarCraft 3).
Macintosh programmer and enthusiast.
Battle.net Bot Programming: http://www.bash.org/?240059
I can write programs. Can you right them?

http://www.clan-mac.com
http://www.eve-online.com

Laff

i have no intention of disassembling anything if someone has already done the work and is willing to share information.  btw, where did i mention checkrevision (this is where applicable advice comes in)?  

i've already looked and found examples of cd key decoding in both c# and java, and i'm trying to get in contact with the authors to get some help in what i don't understand.

yet i still fail to see what your post has to do with anything...

MyndFyre

#12
Quote from: Laff on September 19, 2004, 02:54 PM
no offense, but why should i do what you say?  i told you i don't want to use bnls.  let me do my own thing.  what gives you the right to tell me how i should be making a program anyway?

The right?  I'm not telling you that you *have* to do it a certain way.  However, using BNLS is extremely convenient and simple.  If you look at my post, I also said, "this only goes so far."  Experience and respect gives me the right to suggest what I did.

I'm not saying "don't do it that way because that's not how I do it."

By the way -- LMAO loser.  "I can't figure this Battle.net thing out but I can easily get BNLS working."

Finally, after having given you an EXTREMELY nice and informative post at the top, for you to counter with me, accusing me of doing something that I had no right to do, is pretty much a slap in the face.  *Notes Laff down next to NetNX as people MyndFyre doesn't want to help in the future*

If you want to know *why* I suggest you don't go for code, look at the threads related to NetNX around.
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.

Dyndrilliac

Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

UserLoser.

#14
Quote from: tA-Kane on September 19, 2004, 09:16 PM
APPLICABLE advice: Unless you have knowledge with disassembling programs (if you did, though, then would you be here asking these questions or rather disassembling one of Blizzards games, or even another bot, to answer the questions yourself?), look for CheckRevision on The Disclaimer (Battle.net Bot Development website): http://botdev.valhallalegends.com.

I think somewhere on there might also be CDKeyDecode(). You will be looking for that, too.

Edit: However, now that I think about it, the CDKeyDecode() that would likely be available there would not include code to decode a WarCraft 3 CD key. So, do a search for SRP on these forums, it should have the necessary code you seek (except the checkrevision that is required for version checking, I beleive the one available on the Bot Dev site does work for WarCraft 3).

Since it seems he doesn't want to rely on others, perhaps he should disassemble battle.snp and see how it calls CheckRevision :)

Also, yes, MBB, the CheckRevision function by Yobguls does work for Warcraft III, there are no differences since all products use the same versioning dlls.