Valhalla Legends Forums Archive | Battle.net Bot Development | Sending chr(3) and chr(4)

AuthorMessageTime
haZe
OK. I know about chr(3) and chr(4) for chat bots but answer me two questions:
What IS chr(3) and chr(4) ? What do they represent?
Also, I'm pretty sure theres a special way of sending it or is it just like this:
[color=blue]
[code]
sckBnet.SendData chr(3) chr(4)
[/code]
[/color]
once again, help would be appreciated, and plz dont post unless your going to help
February 16, 2003, 9:01 AM
warz
Make a simple output program, and view the output of chr(3) and chr(4).
February 16, 2003, 2:24 PM
Yoni
Use the string concatenation operator (&):

[color=LightGreen]sckBnet.SendData Chr(3)[/color] [color=Red]&[/color] [color=LightGreen]Chr(4)[/color]
February 16, 2003, 2:39 PM
Arta
The first byte is the Protocol byte. It lets bnet know you're going to be using the chat protocol. If you were using a game, you'd send 0x01 instead.

I forget what the second byte does.
February 16, 2003, 3:47 PM
Kp
^D turns off foreign echo.
February 16, 2003, 4:52 PM
haZe
so chr(4) turns off echo? ya lost me =/
February 16, 2003, 6:10 PM
Ickypoopy
Anytime you send something, it will echo it back to you.  SO if you send "blah" it will send you "blah"

So you send ^D to turn that off ;)
February 16, 2003, 6:23 PM
haZe
[color=green]sckBnet.senddata [/color][color=red]^D[/color]

ok got it 8)
February 16, 2003, 6:24 PM
Noodlez
no.
sckBnet.SendData Chr(3) & Chr(4)
February 16, 2003, 6:39 PM
Yoni
^D is shorthand notation for Ctrl-D, which is expressed by the byte Chr(4).
February 16, 2003, 7:31 PM
haZe
thx yoni now i understand perfectly
February 16, 2003, 7:36 PM
Etheran
I thought I'd just add that chr(3) is ^C.
February 17, 2003, 12:03 AM
haZe
but..etheran...

[quote]
The first byte is the Protocol byte. It lets bnet know you're going to be using the chat protocol. If you were using a game, you'd send 0x01 instead.

I forget what the second byte does.
[/quote]

i thought chr(3) was 0x03..thats what arta made it sound like
February 17, 2003, 7:10 AM
Noodlez
chr(3) is 0x03. the post you quoted doesn't say otherwise
February 17, 2003, 5:32 PM
Etheran
[quote]but..etheran...



i thought chr(3) was 0x03..thats what arta made it sound like[/quote]
chr(3) translates as ascii 3(00000011), which (the last time I checked) is ctrl-C.
February 17, 2003, 5:42 PM
haZe
winsock1.senddata chr(3) & chr(4) & vbcrlf & username & vbcrlf & password
I THINK!! ::)
February 26, 2003, 6:08 PM
MesiaH
no vbcrlf after chr(4)
February 26, 2003, 6:09 PM
haZe
heh k but except for the & vbcrlf after chr(4), thats how u make a chat bot after u connect..i think! ::)
hehe
February 26, 2003, 6:34 PM
Etheran
It's not needed, although I think b.net allows you to do it.  Try opening telnet and connecting to [your favorite b.net server].  Press ctrl-C ctrl-D [Username] + Enter(CRLF) + [Password] + Enter(CRLF).  You'll see exactly what needs to be sent in order to establish a connection using the chat protocol.
February 26, 2003, 7:40 PM
MesiaH
no because in telnet, if you hit enter after you hit ctrl+d then it would assume that the crlf is the username, and skip onto the password, because youve just hit enter.

i dont even think it allows you to send ctrl+d...
February 26, 2003, 10:26 PM
Camel
[quote]no because in telnet, if you hit enter after you hit ctrl+d then it would assume that the crlf is the username, and skip onto the password, because youve just hit enter.

i dont even think it allows you to send ctrl+d...[/quote]
telnet sends data on a timer. if you send ^C and then wait five minutes before you type ^D, bnet is going to think  ^D is part of the username. but if you type it fast enough (it's really not very fast at all), it'll send them in the same packet
February 26, 2003, 11:46 PM
Skywing
[quote]
telnet sends data on a timer. if you send ^C and then wait five minutes before you type ^D, bnet is going to think  ^D is part of the username. but if you type it fast enough (it's really not very fast at all), it'll send them in the same packet[/quote]Uhm.. that's completely wrong.  For starters, telnet does not send data on a timer.  The Nagle algorithm, a feature of TCP/IP facilitates delaying a PSH until either a certain amount of data is backlogged locally or an ACK is received from the remote host.  This allows the TCP stack to concatenate small sends into a single, more efficient TCP packet.

TCP/IP applications must not make any assumptions about how data is delivered to them.  The application has no reliable way of knowing whether or not the data arrived in a single TCP packet; this is by design.  Thus, Battle.net won't "think it's part of the username" just because it received it "later".
February 27, 2003, 2:03 PM
Camel
i'm not wrong, i just dumbed it up
February 27, 2003, 5:54 PM
Skywing
[quote]i'm not wrong, i just dumbed it up[/quote]
You are wrong.  The amount of time delay between you sending things on a TCP connection does not change how the remote application processes them.  Any program which tries to make such assumptions will only work intermittantly at best.

The only time where it could possibly make a difference is if the remote application decides to drop the connection as dead if it gets no data for so long.  This is not the case with Chat connections to Battle.net...
February 27, 2003, 6:23 PM
Camel
[quote]Any program which tries to make such assumptions will only work intermittantly at best.[/quote]
i'm not arguing with you on that. any hacker who makes assumptions about the skill of the internal programmers will succeed intermittantly at best. i havn't opened a chat connection in a hell of a long time, but when i used it a long time ago it would allow about a second to send ^D before it replied with "Username: ". if you waited too long, the ^D would be part of your username (and obviously not work). if you didnt wait for the "Username: " before sending the username (not send ^D complicated this 1000-fold because bnet would never echo your password unless you send it before it sends you "Password: "), it would usually skrew up the connection.
but perhaps it has all changed and they are parsing the data correctly now. i dont really think it matters enough to open up telnet and try it. shall we call a truce? :)
February 28, 2003, 1:37 PM
Skywing
[quote]
i'm not arguing with you on that. any hacker who makes assumptions about the skill of the internal programmers will succeed intermittantly at best. i havn't opened a chat connection in a hell of a long time, but when i used it a long time ago it would allow about a second to send ^D before it replied with "Username: ". if you waited too long, the ^D would be part of your username (and obviously not work). if you didnt wait for the "Username: " before sending the username (not send ^D complicated this 1000-fold because bnet would never echo your password unless you send it before it sends you "Password: "), it would usually skrew up the connection.
but perhaps it has all changed and they are parsing the data correctly now. i dont really think it matters enough to open up telnet and try it. shall we call a truce? :)[/quote]
I've never observed that behavior.  By the way, Battle.net treats a ^D as a newline.

There is one quirk in their handling of ^D; they appear to only check for it once per TCP packet, which means if you keep disabling and reenabling it, you might get unexpected results.
February 28, 2003, 2:16 PM

Search