Author | Message | Time |
---|---|---|
Augural Sentinel | I'm trying to make a PHP script that connects to the Battle.net servers to do various actions. On this page, how would I go about sending all those values? Right now, I'm just using [code]$end = chr(10).chr(13); fputs($conn, "0"); fputs($conn, "68XI"); fputs($conn, "PXES"); fputs($conn, chr(205)); fputs($conn, "0"); fputs($conn, "0"); fputs($conn, "0"); fputs($conn, "0"); fputs($conn, "0"); fputs($conn, "USA"); fputs($conn, "United States".$end);[/code] When I use Ethereal, the packet where all this information is sent contains the following: [quote]..8.9... .....E. .H..@... .,....?. .~.....= Z.....P. ..3...68 XIPXES.0 0000USAU nited St ates.. [/quote] StealthBot sends this in a packet: [quote]..8.9... .....E. .b..@... ......?. .~.,.... ....d.P. ..`....P :.....68 XIPXES.. ........ ........ .....|US A.United States.[/quote] StealthBot doesn't even half of the variables listed for SID_AUTH_INFO. Do I even need to bother sending the 0's? Also, how do I know Battle.net accepted what I sent it? All the packets I receive from it are just random characters that don't contain any message from Battle.net telling me whether or not my login was accepted (unless Battle.net sends a hex code and Starcraft itself interprets this ) because I'm not getting a packet with this information. | December 14, 2005, 2:05 AM |
JoeTheOdd | [code]fputs($conn, chr(205));[/code] Much easier to just use hex. [code]fputs($conn, chr(0xCD));[/code] [code]fputs($conn, "0");[/code] 1) Thats a DWORD, not a BYTE. 2) You're inserting that 0x30 bytes too high. It should be 0x0, not 0x30. [code]fputs($conn, chr(0) . chr(0) . chr(0) . chr(0));[/code] Also, you're going to have one hell of a hard time doing anything without GetDWORD and MakeDWORD, and their WORD counterparts. You'll never send CRLF (which you have as LFCR) to Battle.net in the binary protocol. Never. Last but not least, make a packet buffer. You didn't send your sanity byte, packetID, nor packet length. In short, you violated the protocol about 30 times. If you need any help, I'm usually sitting in front of my computer except for sleep, getting food (I eat in my room =p), or at school. I'm headed to bed right now, but I think I'm going to have a snow day tomorrow. EDIT - Two things I forgot. 1) Null terminate your strings. [code]fputs($conn, "USA" . chr(0));[/code] 2) Don't send CRLF after the packet. [code]fputs($conn, "United States" . chr(0));[/code] | December 14, 2005, 2:14 AM |
Augural Sentinel | [quote author=Joe link=topic=13509.msg137550#msg137550 date=1134526459] [code]fputs($conn, chr(205));[/code] Much easier to just use hex. [code]fputs($conn, chr(0xCD));[/code][/quote] I haven't used chr() in the past, so I wasn't sure if it accepted hex values. [quote]You'll never send CRLF (which you have as LFCR) to Battle.net in the binary protocol. Never.[/quote] I was basing what I was doing off a opensource bot (made in 1998, as I just found out) and what someone else was doing. [quote]Two things I forgot. 1) Null terminate your strings. [code]fputs($conn, "USA" . chr(0));[/code] 2) Don't send CRLF after the packet. [code]fputs($conn, "United States" . chr(0));[/code] [/quote] Like I said earlier, I was basing what I was doing off two other clients. I'm fairly new to using sockets with PHP. All of the problems seem to be my own ineptness at using sockets with PHP :-\ Thanks for pointing out all my problems :) | December 14, 2005, 3:18 AM |
JoeTheOdd | Not a problem. If anything sounded harsh, it wasn't meant to be. As for your CRLF problem, you're probably looking at a telnet bot, which does send that. I'm pretty sure that chr() will accept hex, because hex is just another part of the PHP language, not a different class of integer or anything. I'm actually interested in making a PHP bot, but I'll have to do a telnet bot, because I'm don't feel like reinventing the wheel, reimplementing X-SHA-1, checkrevision, etc, in PHP. | December 14, 2005, 4:02 AM |
JoeTheOdd | Augural Sentinel, contact me (information is to the left). | December 14, 2005, 8:11 PM |
Kp | [quote author=Joe link=topic=13509.msg137550#msg137550 date=1134526459]You'll never send CRLF (which you have as LFCR) to Battle.net in the binary protocol. Never.[/quote] Not even when setting the contents of profile\description? ;) | December 14, 2005, 8:19 PM |
JoeTheOdd | I don't think its allowed in descriptions, but it could be. | December 14, 2005, 10:47 PM |
Augural Sentinel | [quote author=Joe link=topic=13509.msg137652#msg137652 date=1134591098] Augural Sentinel, contact me (information is to the left). [/quote] Will do. | December 14, 2005, 11:48 PM |
JoeTheOdd | You may have forgotten the protocol byte as well, now that I think about it. When you first connect, send a chr(1). | December 15, 2005, 7:30 AM |
Augural Sentinel | [quote author=Joe link=topic=13509.msg137787#msg137787 date=1134631830] You may have forgotten the protocol byte as well, now that I think about it. When you first connect, send a chr(1).[/quote] It appears that I have to send this as a seperate packet. Are my assumptions correct? Blizzard made an opensource C++ bot in 1998, and in that, you have to send chr(03) and chr (04) together in one packet to tell the server you want to connect, then you had to put your login information after it in the same packet. That's why I was trying to send CRLF to the server. Would I use socket_recv() to accept the ping from Battle.net (and later any other packets)? I think that this would be much easier with C++'s networking library :-\ | December 15, 2005, 11:06 PM |
JoeTheOdd | Receiving packets is not fun. I'm still struggling with that. | December 17, 2005, 7:48 AM |