• Welcome to Valhalla Legends Archive.
 

BNet Chat bot?

Started by Ozzapoo, November 05, 2008, 02:35 AM

Previous topic - Next topic

Ozzapoo

Hi, is there any working tutorial on how to create a simple chat bot using VB.NET/VB6?

Also,

Warcraft III
SEND -> SID_AUTH_INFO (0x50)
RECV <- SID_PING (0x25)
RECV <- SID_AUTH_INFO (0x50)
SEND -> SID_PING (0x25) (Optional)
SEND -> SID_AUTH_CHECK (0x51)
RECV <- SID_AUTH_CHECK (0x51)
SEND -> SID_AUTH_ACCOUNTLOGON (0x53)
RECV <- SID_AUTH_ACCOUNTLOGON (0x53)
SEND -> SID_AUTH_ACCOUNTLOGONPROOF (0x54)
RECV <- SID_AUTH_ACCOUNTLOGONPROOF (0x54)
SEND -> SID_NETGAMEPORT (0x45)
SEND -> SID_ENTERCHAT (0x0A)

In order to send the 'SID_AUTH_INFO' packet, for example, do I simply send a buffer with the information? Or do I have to send something like 0x50 first?

MyndFyre

There's a packet header format described here for sending messages - yes, you need to send the packet ID as part of the header.

If you're using VB.NET and aren't married to doing the packet processing yourself, you can grab BN#, which is a library I've been working on (documentation's here, and tutorial).  It's not quite complete but it's very usable for .NET developers.  It's not supported for VB6.

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.

Ozzapoo

Well if I wanted to send SID_AUTH_INFO, then which type of header would I use? 'BNCS', Realm, D2GS, Botnet, BNLS, WC3 Ingame or Storm?

Hdx

Seince you're connecting to the Battle.Net Chat Server...... I don't know.
Anything SID_ is BNCS

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Ozzapoo

How do I send 'IX86' as a DWORD? Isn't it a string?

brew

Quote from: Ozzapoo on November 09, 2008, 11:53 PM
How do I send 'IX86' as a DWORD? Isn't it a string?
no?
isn't it 'IX86' (single quote marks intended) for a reason?
insert it as you would any other 32 bit value: InsertDWORD('IX86');
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Ozzapoo

InsertDword()?

I'm using VB.Net for this.. =/
I'm not sure what is meant by the single-quotes, so do you care to explain?

brew

Yeah, i was just showing you some example usage.
Also, sorry about the single quotes thing, since you're using VB .NET i'm not sure if single quotes work for numerical constants. try converting the value IX86 to hexidecimal and insert it into your packet as you would a 32 bit number such as 1, or 40.
<3 Zorm
Quote[01:08:05 AM] <@Zorm> haha, me get pussy? don't kid yourself quik
Scio te esse, sed quid sumne? :P

Barabajagal


Ozzapoo

Andy, is there a way I can get the using VB.NET?

Barabajagal

uh... 0x49583836? I don't know how .NET denotes hex.

Ozzapoo

#11
Nevermind, I figured it out anyway. Uh...

(DWORD) Product language
(DWORD) Local IP for NAT compatibility*
(DWORD) Time zone bias*
(DWORD) Locale ID*
(DWORD) Language ID*


Can these fields really safely be set to zero? I tried send a packet and had all thse fields as 0, but I didn't get a response from Battle.Net. However, when I connected using Stealthbot and captured the packets, some of the fields weren't 0 and it DID receive a response from Battle.net. Here is the captured data for comparison between my packet and the one sent by StealthBot.

EDIT: I tried to match it even more, but Battle.Net still won't give me a response
My Packet
0000  00 17 9a 1d e6 67 00 1d  e0 52 ca 73 08 00 45 00   .....g.. .R.s..E.
0010  00 62 6f 7c 40 00 80 06  ed 1c 0a 01 01 03 3f f1   .bo|@... ......?.
0020  53 08 ee 66 17 e0 22 1d  9b f4 5b a2 e3 82 50 18   S..f..". ..[...P.
0030  42 30 c3 a0 00 00 ff 50  3a 00 00 00 00 00 36 38   B0.....P :.....68
0040  58 49 33 52 41 57 16 00  00 00 00 00 00 00 00 00   XI3RAW.. ........
0050  00 00 6c fd ff ff 09 0c  00 00 09 0c 00 00 55 53   ..l..... ......US
0060  41 00 55 6e 69 74 65 64  20 53 74 61 74 65 73 00   A.United  States.

SB Packet

0000  00 17 9a 1d e6 67 00 1d  e0 52 ca 73 08 00 45 00   .....g.. .R.s..E.
0010  00 62 70 14 40 00 80 06  ec 84 0a 01 01 03 3f f1   .bp.@... ......?.
0020  53 08 ee 73 17 e0 87 b5  09 f4 a6 cf ec c8 50 18   S..s.... ......P.
0030  42 30 9b 88 00 00 ff 50  3a 00 00 00 00 00 36 38   B0.....P :.....68
0040  58 49 33 52 41 57 16 00  00 00 00 00 00 00 00 00   XI3RAW.. ........
0050  00 00 6c fd ff ff 09 0c  00 00 09 0c 00 00 55 53   ..l..... ......US
0060  41 00 55 6e 69 74 65 64  20 53 74 61 74 65 73 00   A.United  States.


EDIT: Here's the full info:

http://pastebin.com/f7431517d <-My packet
http://pastebin.com/f57167bd4 <-SB Packet

MyndFyre

#12
Did you initiate the connection with a binary byte of 1?

Dim protocolID() As New Byte(1)
protocolID(0) = 1
sck.Send(protocolID)


I'm going to throw this out there - and you can ignore it if you like, but it'll save you a lot of headache.  If you're going to push through writing your own binary connection, I'd highly suggest utilizing MBNCSUtil.  It's written in C#, so it's completely compatible with your VB.NET code, it uses the standards set within the .NET runtime, and it's going to save you headache (for example, for converting those strings/32-bit integer values such as 'IX86').  It's also highly optimized for memory and does all the authentication math, as you opt-in to its features.

At the very least, consider using or porting its DataBuffer and DataReader classes - these will let you create outgoing data and read incoming data packets much more easily than doing the binary operations by hand or by rolling your own.  And I guarantee they're a lot more correct than some of the other stuff you might find here (and yes, I'm aware that two of those were my own).  It's open-source under the BSD license (generally).

Do what you will, I'm not trying to advertise a product.  I'm just trying to avoid headache for you and for the rest of us. :)
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.

Ozzapoo

#13
Thanks! I completely forgot to send the first byte >.<
I'll try that. And I'll also try your library if I have any more headaches :P

EDIT: W00T! It worked!

EDIT: o.o The MBNCSUtil is pretty nice, I'm gonna use it :D

EDIT: Uh...How can I get the Client token? Do I have to use BNLS or can MBNCSUtil generate it for me? Oh wait...Can ClientToken be any random value?

Barabajagal

Client token is generated by the client.