Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: idiat on March 27, 2007, 06:06 PM

Title: Finding Realm IP/Port
Post by: idiat on March 27, 2007, 06:06 PM
How does the official Diablo II LoD client find the IP/Port of the MCP server? I've tried packet logging it and could find no instance of SID_LOGONREALMEX being sent or received.

I'm working on a Battle.net proxy server and trying to add Diablo support, but I suspect the client is trying to connect to the actual server rather than my proxy (the game freezes up and there are no records of a connection request), so I need to find where the IP is specified.
Title: Re: Finding Realm IP/Port
Post by: Barabajagal on March 27, 2007, 06:58 PM
The game receives the MCP server's info from SID_LOGONREALMEX, it's the 5th DWORD. If you replace it with your proxy server's IP and send that to the client, it should work fine.
Title: Re: Finding Realm IP/Port
Post by: idiat on March 27, 2007, 08:05 PM
I still can't find it. Searches for "3E" came up with nothing in the packet logs.

Here's what I got. FTP stuff was edited out along with sensitive information.

[7:42:43 PM] [1] From client  ()
0000:  01 FF 50 3A 00 00 00 00 00 36 38 58 49 50 58 32   ÿP:.....68XIPX2
0010:  44 0B 00 00 00 53 55 6E 65 C0 A8 01 65 2C 01 00   D ...SUneÀ¨e,.
0020:  00 09 04 00 00 09 04 00 00 55 53 41 00 55 6E 69   .......USA.Uni
0030:  74 65 64 20 53 74 61 74 65 73 00                  ted States......
[7:42:43 PM] [1] From server  (SID_PING)
0000:  FF 25 08 00 60 17 03 C7 FF 50 68 00 00 00 00 00   ÿ%.`ÇÿPh.....
0010:  9A 07 BE 06 84 0C 7C 00 00 20 58 7D 99 CB C6 01   š¾,, |.. X}™ËÆ
0020:  76 65 72 2D 49 58 38 36 2D 32 2E 6D 70 71 00 41   ver-IX86-2.mpq.A
0030:  3D 32 31 38 39 39 31 33 34 32 31 20 43 3D 31 36   =2189913421 C=16
0040:  33 31 31 31 31 39 37 31 20 42 3D 31 32 38 34 39   31111971 B=12849
0050:  35 30 31 32 32 20 34 20 41 3D 41 2D 53 20 42 3D   50122 4 A=A-S B=
0060:  42 2D 43 20 43 3D 43 2B 41 20 41 3D 41 5E 42 00   B-C C=C+A A=A^B.
[7:42:43 PM] [1] From client  (SID_PING)
0000:  FF 25 08 00 60 17 03 C7                           ÿ%.`Ç........
[7:42:44 PM] [1] From client  (SID_AUTH_CHECK)
0000:  FF 51 90 00 E6 B1 B9 C8 00 0B 00 01 BB 19 02 72   ÿQ?.æ±¹È. .»r
0010:  02 00 00 00 00 00 00 00 10 00 00 00 06 00 00 00   .............
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
0060:  47 61 6D 65 2E 65 78 65 20 30 38 2F 31 37 2F 30   Game.exe 08/17/0
0070:  35 20 30 31 3A 31 32 3A 33 37 20 32 31 32 39 39   5 01:12:37 21299
0080:  32 30 00 4D 61 72 79 20 4E 61 69 76 65 74 65 00   20.Mary Naivete.
[7:42:44 PM] [1] From server  (SID_AUTH_CHECK)
0000:  FF 51 09 00 00 00 00 00 00 FF 4C 16 00 49 58 38   ÿQ.......ÿL.IX8
0010:  36 4D 69 6E 64 53 69 67 68 74 2E 6D 70 71 00      6MindSight.mpq..
[7:42:44 PM] [1] From client  (SID_GETFILETIME)
0000:  FF 33 1E 00 06 00 00 80 00 00 00 00 49 58 38 36   ÿ3...€....IX86
0010:  4D 69 6E 64 53 69 67 68 74 2E 6D 70 71 00         MindSight.mpq...
[7:42:44 PM] [1] From client  (SID_GETFILETIME)
0000:  FF 33 1E 00 04 00 00 80 00 00 00 00 62 6E 73 65   ÿ3...€....bnse
0010:  72 76 65 72 2D 44 32 44 56 2E 69 6E 69 00         rver-D2DV.ini...
[7:42:45 PM] [1] From server  (SID_GETFILETIME)
0000:  FF 33 26 00 06 00 00 80 00 00 00 00 00 80 AC 03   ÿ3&...€.....€¬
0010:  18 6C C7 01 49 58 38 36 4D 69 6E 64 53 69 67 68   lÇIX86MindSigh
0020:  74 2E 6D 70 71 00                                 t.mpq...........
[7:42:45 PM] [1] From server  (SID_GETFILETIME)
0000:  FF 33 26 00 04 00 00 80 00 00 00 00 00 E5 EF E6   ÿ3&...€.....åïæ
0010:  6B E8 C0 01 62 6E 73 65 72 76 65 72 2D 44 32 44   kèÀbnserver-D2D
0020:  56 2E 69 6E 69 00                                 V.ini...........
[7:42:45 PM] [1] From client  (SID_EXTRAWORK)
0000:  FF 4B 0C 00 03 00 04 00 00 00 00 4E               ÿK ......N....
[7:42:48 PM] [1] From client  (SID_LOGONRESPONSE2)
0000:  FF 3A 2B 00 F7 89 E4 0A 9A 07 BE 06 88 BD 8E 3E   ÿ:+.÷‰ä.š¾ˆ½Ž>
-------------------------------------------------------------------------
0020:  66 61 6B 65 32 2D 6B 6F 64 2D 00                  fake2-kod-......
[7:42:48 PM] [1] From server  (SID_LOGONRESPONSE2)
0000:  FF 3A 08 00 00 00 00 00                           ÿ:.............
[7:43:11 PM] [1] From server  (SID_NULL)
0000:  FF 00 04 00 FF 25 08 00 7C B7 F0 13               ÿ..ÿ%.|·ð....
[7:43:11 PM] [1] From client  (SID_PING)
0000:  FF 25 08 00 7C B7 F0 13                           ÿ%.|·ð........
Title: Re: Finding Realm IP/Port
Post by: l2k-Shadow on March 27, 2007, 08:31 PM
and you're not connecting to open battle.net?
Title: Re: Finding Realm IP/Port
Post by: idiat on March 27, 2007, 08:38 PM
Correct. Open Battle.net works without error.
Title: Re: Finding Realm IP/Port
Post by: MyndFyre on March 27, 2007, 08:43 PM
Any chance it's in bnserver-d2dv.ini?


[Server List Version]
VER=1001

[Server Gateways]
1=uswest.battle.net
2=useast.battle.net
3=asia.battle.net
4=europe.battle.net

[uswest.battle.net]
ZONE=8
ENU=U.S. West
FRA=U.S. Ouest

[useast.battle.net]
ZONE=6
ENU=U.S. East
FRA=U.S. Est

[asia.battle.net]
ZONE=-9
ENU=Asia
FRA=Asie

[europe.battle.net]
ZONE=-1
ENU=Europe
FRA=Europe
Title: Re: Finding Realm IP/Port
Post by: Barabajagal on March 27, 2007, 09:27 PM
Just did a packet log. 0x3E is sent by the game right after 0x40 (queryrealms2) is received. It looks like you're not sending or receiving that either.

After you receive 0x3A, you should send 0x40 and 0x3E. For some reason, you aren't.
Title: Re: Finding Realm IP/Port
Post by: idiat on March 27, 2007, 09:45 PM
Editing bnserver-D2DV.ini as suggested to include my IP address did not work. (I'm certain this part was done correctly because the changes show up as desired in bncache.dat)

I'm going to set up a packet logger for a second opinion to my DebugOutput function and also to see it working correctly on the normal server. :-/
Title: Re: Finding Realm IP/Port
Post by: Barabajagal on March 27, 2007, 09:50 PM
The realm server to connect to is sent in 3E. I'm 100% sure of that. I've already done what you're doing, and I got it to work fine.
Title: Re: Finding Realm IP/Port
Post by: idiat on March 27, 2007, 10:21 PM
nm fixed
Title: Re: Finding Realm IP/Port
Post by: UserLoser on March 27, 2007, 11:11 PM
You have to request a realm list to get their IP/port/name
Title: Re: Finding Realm IP/Port
Post by: Barabajagal on March 27, 2007, 11:39 PM
He's not the one sending the request, he's making a proxy system for the game to go through. The game's the one not sending the realm list, not him.
Title: Re: Finding Realm IP/Port
Post by: UserLoser on March 28, 2007, 01:00 PM
Quote from: [RealityRipple] on March 27, 2007, 11:39 PM
He's not the one sending the request, he's making a proxy system for the game to go through. The game's the one not sending the realm list, not him.

Reading > me.  Made an assumption that this was another one of those threads, if you get what I mean.
Title: Re: Finding Realm IP/Port
Post by: Barabajagal on March 28, 2007, 03:42 PM
Of course, especially since it's in the bot dev forum.