Author | Message | Time |
---|---|---|
LockesRabb | Was watching my bot's logs of all packets received. Noticed something. It doesn't receive PKT_SERVERPING. Was just wondering if this packet is still received by anyone else? [quote]Username set. Password set. GameCode set to SEXP. CDKey set. Default Home channel set to Op xDMx. UseLagPlug unset. Connecting to BNLS... 0x01 SID_EmuByte sent. 0x50 SID_AUTH_INFO packet sent. Received Packet: 0x25 (SID_PING) 0x25 SID_PING packet sent. Received Packet: 0x50 (SID_AUTH_INFO) 0x01 BNLS_CDKEY packet sent. Received Packet: 0x1 (BNLS_CDKEY) 0x1A BNLS_VERSIONCHECKEX2 packet sent. Received Packet: 0x1A (BNLS_VERSIONCHECKEX2) 0x51 SID_AUTH_CHECK packet sent. Received Packet: 0x51 (SID_AUTH_CHECK) 0x51 Response: Authenication information accepted. 0x0B BNLS_HASHDATA packet sent. Received Packet: 0x4C (SID_REQUIREDWORK) 0x4C (SID_REQUIREDWORK) disregarded. Received Packet: 0xB (BNLS_HASHDATA) 0x29 SID_LOGONRESPONSE packet sent. Received Packet: 0x29 (SID_LOGONRESPONSE) Successfully logged on Battle.net! 0x14 SID_ENTERCHAT packet sent. 0x0C SID_JOINCHANNEL packet sent. Received Packet: 0xA (SID_ENTERCHAT) Received Packet: 0xF (SID_CHATEVENT) Received Packet: 0xF (SID_CHATEVENT) Received Packet: 0xF (SID_CHATEVENT) Received Packet: 0x25 (SID_PING) 0x25 SID_PING packet sent.[/quote] | February 16, 2007, 6:57 PM |
HdxBmx27 | You must send 0x08, or 0x09 UDP To which the server responds with 3x the amount you sent. ~Hdx | February 16, 2007, 6:59 PM |
LockesRabb | which is preferable? [edited to avoid double posting] I've been perusing the BNETDocs, and from what it appears: 0x09 would be preferable mainly because: 0x50 includes UDP Token, which in turn is used with the 0x09 packet to send to BNET. Process done. while with 0x08, UDP token isn't used with it, which i would guess, would result in battle.net sending a 0x05, which would contain the udp token in which the client'd have to return back to bnet. From my guesses, it looks like the 0x08 route would be alot longer than the 0x09 route, that the 0x09 route would be quicker and more efficent. What do you think? Was my guesses wrong? | February 16, 2007, 7:04 PM |
l2k-Shadow | Actually server sends you 0x05 first, and if you bind a socket to 6112, watch for 0x05 and respond with 0x09. All data exchange for UDP can be safely ignored. The client sends data to the server on port 6112 no matter what... This way if the client cannot bind a socket to 6112 and uses another socket, the server knows that it is still capable of processing UDP packets and stores the socket that client is using for creating/joining starcraft games. | February 16, 2007, 7:16 PM |
LockesRabb | So I need to have two sockets; one for the TCP protocol, one for the UDP protocol, and bind both to the 6112 port? And by bind, you mean set the UDP socket to listen for incoming connections, accept connection from bnet, parse, and respond accordingly? | February 16, 2007, 7:21 PM |
l2k-Shadow | [quote author=Kyro link=topic=16329.msg164962#msg164962 date=1171653706] So I need to have two sockets; one for the TCP protocol, one for the UDP protocol, and bind both to the 6112 port? And by bind, you mean set the UDP socket to listen for incoming connections, accept connection from bnet, parse, and respond accordingly? [/quote] There is no connection/listening for connection in the UDP protocol, I suggest you read http://en.wikipedia.org/wiki/User_Datagram_Protocol | February 16, 2007, 7:25 PM |
LockesRabb | [quote]Wikipedia does not have an article with this exact name. Please search for User Diagram Protocol in Wikipedia to check for alternative titles or spellings.[/quote] Also, if that's the case, there's something I should mention. I'm using VB, I'm also using their Winsock, the Winsock's protocol is set to sckTCPProtocol. There's another setting in there (sckUDPProtocol). That's why I asked. [Edit] Does those PKT packets follow this protocol: [quote]Storm UDP Protocol This protocol is defined and processed by functions within Storm.dll and is used for numerous games - namely, Diablo 1, Warcraft II: BNE, Starcraft, and Starcraft: Brood War. (WORD) Checksum (WORD) Header Length (WORD) Seq1 (WORD) Seq2 (BYTE) CLS (BYTE) Command (BYTE) PlayerID (BYTE) Resend[/quote] Or does it follow the standard BNCS protocol: [quote](BYTE) Always 0xFF (BYTE) Message ID (WORD) Message length, including this header (VOID) Message Data[/quote] | February 16, 2007, 7:29 PM |
l2k-Shadow | The link works, I was on a stupid mac computer and didn't know how to copy paste so I mistyped but i edited it 5 minutes later. The packets are started with a PacketID DWORD followed by the data specified by bnetdocs. It is useless to have length of an UDP packet in the header, again I urge to read how it works. | February 16, 2007, 10:28 PM |
Barabajagal | You could always just send SID_UDPPINGRESPONSE when you receive SID_LOGONRESPONSE2 or before you send SID_LOGONRESPONSE, depending on which packet the game(s) you connect with use. | February 16, 2007, 10:38 PM |
LockesRabb | I already am sending SID_UDPPINGRESPONSE. I'll paste an example log: [quote][4:43:08 PM] Username set. [4:43:08 PM] Password set. [4:43:08 PM] GameCode set to SEXP. [4:43:08 PM] CDKey set. [4:43:08 PM] Default Home channel set to Op xDMx. [4:43:08 PM] UseLagPlug set. [4:43:13 PM] Connecting to BNLS... [4:43:13 PM] 0x01 SID_EmuByte sent. [4:43:13 PM] 0x50 SID_AUTH_INFO packet sent. [4:43:13 PM] Received Packet: 0x25 (SID_PING) [4:43:13 PM] 0x25 SID_PING packet sent. [4:43:13 PM] Received Packet: 0x50 (SID_AUTH_INFO) [4:43:13 PM] 0x01 BNLS_CDKEY packet sent. [4:43:14 PM] Received Packet: 0x1 (BNLS_CDKEY) [4:43:14 PM] 0x1A BNLS_VERSIONCHECKEX2 packet sent. [4:43:14 PM] Received Packet: 0x1A (BNLS_VERSIONCHECKEX2) [4:43:14 PM] 0x51 SID_AUTH_CHECK packet sent. [4:43:14 PM] Received Packet: 0x51 (SID_AUTH_CHECK) [4:43:14 PM] 0x51 Response: Authentication information accepted. [4:43:14 PM] 0x0B BNLS_HASHDATA packet sent. [4:43:14 PM] Received Packet: 0x4C (SID_REQUIREDWORK) [4:43:14 PM] 0x4C (SID_REQUIREDWORK) disregarded. [4:43:14 PM] Received Packet: 0xB (BNLS_HASHDATA) [4:43:14 PM] 0x29 SID_LOGONRESPONSE packet sent. [4:43:14 PM] Received Packet: 0x29 (SID_LOGONRESPONSE) [4:43:14 PM] Successfully logged on Battle.net! [4:43:14 PM] 0x14 SID_UDPPINGRESPONSE packet sent. [4:43:14 PM] 0x0A SID_ENTERCHAT packet sent. [4:43:14 PM] 0x0C SID_JOINCHANNEL packet sent. [4:43:14 PM] Received Packet: 0xA (SID_ENTERCHAT) [4:43:14 PM] Received Packet: 0xF (SID_CHATEVENT) [4:43:14 PM] Received Packet: 0xF (SID_CHATEVENT) [4:43:14 PM] Received Packet: 0xF (SID_CHATEVENT) [4:43:16 PM] Sockets closed.[/quote] The reason why is because I asked is because I'm working on trying to figure out if it is possible to have the bot join a game, stay in game, then when the game finishes, determine who the winner was. AFAIK, it's not possible to programatically tell who won via parsing replays. :\ | February 17, 2007, 12:45 AM |
BreW | Good luck to ya... The furthest anyone's ever gotten with that is PiaNKA and it can't start :p STAR/SEXP game protocol for the most part is undocumented, so if you do manage to even start a game, please do tell us. But that does sound like a good idea for a bot. Blizzard, however, might patch that as soon as you get it.... I'm sure they'll object to a "bot" starting a "game". And Kyro, I couldn't help to notice that you're using the 0x29... any specific reason for that? | February 17, 2007, 1:14 PM |
Barabajagal | you do realize there are quite a few bots that create games with two cd keys, wait, and then disconnect with a "win" state... they're called WinBots, and they've been around for a while. | February 17, 2007, 1:30 PM |
l2k-Shadow | [quote author=[RealityRipple] link=topic=16329.msg164991#msg164991 date=1171719026] you do realize there are quite a few bots that create games with two cd keys, wait, and then disconnect with a "win" state... they're called WinBots, and they've been around for a while. [/quote] Yeah but those bots don't use anything UDP, all they do is send the create/join game TCP packets that inform the server that a game has started.. then they wait two minutes and spoof a game result packet. | February 17, 2007, 2:52 PM |
BreW | True, shadow! All those winbots do is simpily send a join game packet, wait two minutes, then send a result packet. Kyro, on the other hand, is attempting to do what many people have failed. You have to give him a little credit. @Kyro, I recommend using Wireshark for packetlogs, so you can upload the .pcap somewhere and share your findings with the rest of us! thank you in advance. | February 17, 2007, 3:48 PM |
LockesRabb | [quote author=BreW link=topic=16329.msg164990#msg164990 date=1171718085]And Kyro, I couldn't help to notice that you're using the 0x29... any specific reason for that?[/quote] To log in. | February 17, 2007, 5:42 PM |
BreW | Haha, what about using the 0x3a? (SID_LOGONRESPONSE2) I believe. And because you're connecting with Starcraft, it would be a more accurate emulation to use the 0x3a instead. Check this out. | February 17, 2007, 6:35 PM |
LockesRabb | [quote] Message ID: 0x3A Message Name: SID_LOGONRESPONSE2 Direction: Client -> Server (Sent) [color=red]Used By: Diablo II, Diablo II LOD[/color][/quote] BNetDocs says it's not for Starcraft. Unless the BNetDocs aren't accurate? Have you verified that the Starcraft client uses the 0x3A packet via packet logging? | February 17, 2007, 6:41 PM |
rabbit | Diablo II and LoD were the only two clients which used the 0x3a system when it was first researched. Now StarCraft and Brood War also use it. Warcraft II can ALSO use it, although it's still supposed to use the 0x1e series. | February 17, 2007, 6:53 PM |
LockesRabb | Alright. I'll switch it over to 0x3A then. Thanks for the heads up, BreW, and thanks for the clarification, rabbit. It's most certainly appreciated. I posted at bnetdocs requesting that the info be updated. | February 17, 2007, 7:08 PM |