Author | Message | Time |
---|---|---|
Jaquio | Alright, I decided to add realm connection into my bot and am having alot of trouble with it. How exactly do connect to the realm? I have looked around the forums and seen people talking about extracting the IP from recv'd packet 0x3E then connecting to the realm with it.. I have no idea what I am doing wrong.. Here is my recv'd 0x3E case code. [code] Case &H3E 'Debug.Print "Recv'd:0x3E" Server = Mid(data, 17, 8) ServIP = Mid(Server, 5, 4) AddChat D2Green, "Current realm server: " & MakeServ(ServIP) Debug.Print "Server:" & Server Debug.Print "Server IP:" & ServIP frmMain.wsRealm.Close frmMain.wsRealm.Connect MakeServ(ServIP), 6112 [/code] Here is my MakeServ function. [code] Public Function MakeServ(data As String) As String Dim intIP1 As String, intIP2 As String, intIP3 As String, intIP4 As String intIP1 = CLng("&H" & ToHex(Mid(data, 1, 1))) Debug.Print "1:" & intIP1 intIP2 = CLng("&H" & ToHex(Mid(data, 2, 1))) Debug.Print "2:" & intIP2 intIP3 = CLng("&H" & ToHex(Mid(data, 3, 1))) Debug.Print "3:" & intIP3 intIP4 = CLng("&H" & ToHex(Mid(data, 4, 1))) Debug.Print "4:" & intIP4 MakeServer = intIP1 & "." & intIP2 & "." & intIP3 & "." & intIP4 End Function [/code] With that function I get "Run-time error '13': Type mismatch" at "intIP1 = CLng("&H" & ToHex(Mid(data, 1, 1)))" and every other ip. Any ideas as to what I am doing wrong? | March 2, 2006, 11:34 AM |
JoeTheOdd | [code]Public Function MakeServ(data as String) As String Dim IP(1 to 4) as String IP(1) = Asc(Mid(data, 1, 1)) IP(2) = Asc(Mid(data, 2, 1)) IP(3) = Asc(Mid(data, 3, 1)) IP(4) = Asc(Mid(data, 4, 1)) MakeServ = Join(IP, ".") End Function[/code] EDIT - Have you considered using a Packet Debuffer Class? | March 2, 2006, 1:16 PM |
Jaquio | Nope, never considered using one. When I get home I will try what you have posted and add that Packet Debuffer class to my bot, thanks. | March 2, 2006, 7:41 PM |
Jaquio | [quote author=Joe link=topic=14403.msg147435#msg147435 date=1141305369] EDIT - Have you considered using a Packet Debuffer Class? [/quote] How exactly do I use this class? I got errors on the 'GetWord' and 'GetDWord' functions. Anyidea why? Also, now that MakeServ function you gave me. Gives me an 'Invalid procedure call or argument(Run-time error '5')" at [code] strIP(1) = Asc(Mid(data, 1, 1)) [/code] And at all the other strings. | March 2, 2006, 8:59 PM |
JoeTheOdd | [quote]Also, now that MakeServ function you gave me. Gives me an 'Invalid procedure call or argument(Run-time error '5')"[/quote] Unfortunately I don't know for sure what's wrong with that, but I think using the packet debuffer will fix it. [quote]How exactly do I use this class? I got errors on the 'GetWord' and 'GetDWord' functions. Anyidea why?[/quote] http://www.javaop.com/~joe/VB6/modWORD.bas [hr] Remember, you need to call MakeDWORD on RemoveDWORD before you pass it to MakeServer. | March 2, 2006, 9:58 PM |
Jaquio | Alright Joe, I have the Debuffer class working now thanks. The problem is now, is that to remove multiple dwords, what would I need to do exactly? Or could you explain how to actually use this class? I understand how to use MakeDword and such.. Just removing them.. | March 3, 2006, 3:19 AM |
Myndfyr | [quote author=Jaquio link=topic=14403.msg147470#msg147470 date=1141355976] Alright Joe, I have the Debuffer class working now thanks. The problem is now, is that to remove multiple dwords, what would I need to do exactly? Or could you explain how to actually use this class? I understand how to use MakeDword and such.. Just removing them.. [/quote] .RemoveDword .RemoveDword ?? Duh... | March 3, 2006, 3:29 AM |
Jaquio | Ohh, so everytime I remove a dword or anything, it'll automaticly go onto the next dword or whatever I am removing? | March 3, 2006, 3:31 AM |
Myndfyr | That's pretty much the point of a "debuffer" class, or as it is more correctly called, a Reader. | March 3, 2006, 3:31 AM |
Jaquio | So, for the realms IP Address I would use the 4th DWord as the ip? Or is there something I am not understanding about ox3E? | March 3, 2006, 3:37 AM |
Myndfyr | [quote author=Jaquio link=topic=14403.msg147476#msg147476 date=1141357074] So, for the realms IP Address I would use the 4th DWord as the ip? Or is there something I am not understanding about ox3E? [/quote] Well, let's see: http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=15 [quote] (DWORD) Cookie (DWORD) Status (DWORD[2]) MCP Chunk 1 (DWORD) IP (DWORD) Port (DWORD[12]) MCP Chunk 2 (STRING) BNCS unique name (WORD) Unknown [/quote] ...so it'd be something like [code] Cookie = GetDWord() Status = GetDWord() MCPChunk1Part1 = GetDWord() MCPChunk1Part2 = GetDWord() IPAddress= GetDWord() Port = GetDWord() [/code] ..... Is that somehow unclear? | March 3, 2006, 3:48 AM |
Jaquio | Why does it return numbers like this? "892481592" or "942683958"? :( All the other clients connect just fine to BNet it's D2DV and D2XP I am having trouble with.. Nevermind, I cannot get this to work at all.. I guess having D2 enabled in my bot isn't a must.. I could just say forget it and try again some other time when I can figure out how to exact all I need from the recv'd data in 0x3E thanks for your help guys. | March 3, 2006, 3:55 AM |
bethra | [quote author=MyndFyre[vL] link=topic=14403.msg147474#msg147474 date=1141356701] That's pretty much the point of a "debuffer" class, or as it is more correctly called, a Reader. [/quote]Haha. Don't know who originally came up with "debuffer", but when I was thinking of a name to call the packet reader class that I wrote in VB6 a long time ago to do the opposite of what a packet buffer class does, I came up with calling it "debuffer" simply by the fact that "de" is a prefix meaning: [quote] 1. Do or make the opposite of; reverse: decriminalize. 2. Remove or remove from: delouse; deoxygenate. 3. Out of: deplane; defenestration. 4. Reduce; degrade: declass. 5. Derived from: deverbative. [/quote] | March 3, 2006, 5:40 AM |
LordNevar | [code] Case &H3E String1 = Mid$(Data, 5, 16) Server = MakeServer(Mid$(Mid$(Data, 17, 8), 5, 4)) String2 = Mid$(Data, 29, 48) Username = Mid$(Data, 77, Len(Data) - 79)[/code] This code seems like it should work with your MakeServer function, and should coincide with the rest of your buffer class. | March 3, 2006, 6:14 AM |
Myndfyr | [quote author=Jaquio link=topic=14403.msg147479#msg147479 date=1141358107] Why does it return numbers like this? "892481592" or "942683958"? :( All the other clients connect just fine to BNet it's D2DV and D2XP I am having trouble with.. [/quote] Because an IP adress is a 32-bit number. Separating it into the dotted-quad notation is simply a somewhat-more-human-readable method of thinking about it. But figure, any part of an IP address can range from 0 to 255. Those are byte values. Look at it this way too: vL forums are hosted at 64.5.42.38. That's 0x40.0x05.0x2a.0x26 Written in network byte order: 0x40052a26 That translates to: 1074080294 If you go to http://1074080294/, you'll get this server, but Apache doesn't like that HTTP GET request. Google is 66.102.7.99. 0x42.0x66.0x07.0x63 -> 0x42660763 -> 1113982819 -> http://1113982819/ = Google.com. There ya go. | March 3, 2006, 6:40 AM |
JoeTheOdd | Hah, I never knew you could do that. | March 3, 2006, 1:05 PM |
Jaquio | [quote author=LordNevar link=topic=14403.msg147494#msg147494 date=1141366489] [code] Case &H3E String1 = Mid$(Data, 5, 16) Server = MakeServer(Mid$(Mid$(Data, 17, 8), 5, 4)) String2 = Mid$(Data, 29, 48) Username = Mid$(Data, 77, Len(Data) - 79)[/code] This code seems like it should work with your MakeServer function, and should coincide with the rest of your buffer class. [/quote] Erm, "Mid$(Data, 77, len(data) - 79)" I am not receiving enough data to even start that far.. maybe I am sending a packet wrong before that and am not receiving enough data back to pharse all the information.. Because even using everyones help I understand what everyone is saying and it's still not working at all.. What is the exact Logon Sequence for realm connection anyone know? Because it's not on BNetDocs. | March 3, 2006, 4:58 PM |
HdxBmx27 | C->S BNCS: Protocol Byte (0x01) C->S BNCS: (0x50) SID_AUTH_INFO S->C BNCS: (0x25) SID_PING C->S BNCS: (0x25) SID_PING S->C BNCS: (0x50) SID_AUTH_INFO C->S BNCS: (0x51) SID_AUTH_CHECK S->C BNCS: (0x51) SID_AUTH_CHECK C->S BNCS: (0x33) SID_GETFILETIME (Optional: bnserver-D2DV.ini) S->C BNCS: (0x33) SID_GETFILETIME (Optional) C->S BNCS: (0x3A) SID_LOGONRESPONSE S->C BNCS: (0x3A) SID_LOGONRESPONSE C->S BNCS: (0x40) SID_QUERYREALMS2 S->C BNCS: (0x40) SID_QUERYREALMS2 C->S BNCS: (0x3E) SID_LOGONREALMX S->C BNCS: (0x3E) SID_LOGONREALMX C->S MCP: Protocol Byte (0x01) C->S MCP: (0x01) MCP_STARTUP S->C MCP: (0x01) MCP_STARTUP C->S MCP: (0x19) MCP_CHARLIST2 S->C MCP: (0x19) MCP_CHARLIST2 C->S MCP: (0x07) MCP_CHARLOGON S->C MCP: (0x07) MCP_CHARLOGON C->S MCP: (0x12) MCP_MOTD (Optional) C->S BNCS: (0x0B) SID_GETCHANNELLIST (Optional) C->S BNCS: (0x0A) SID_ENTERCHAT S->C MCP: (0x12) MCP_MOTD (Optional) S->C BNCS: (0x0B) SID_GETCHANNELLIST (Optional) S->C BNCS: (0x0A) SID_ENTERCHAT ~-~(HDX)~-~ | March 3, 2006, 10:18 PM |
Jaquio | Still isn't working even after I made sure I was sending everything correctly.. What is the difference between 0x34 and 0x40? They both seem to return what you need.. Is there anything at all I can do to help my Realm connection? I cannot seem to get it no matter how many times I try. | March 3, 2006, 11:11 PM |
HdxBmx27 | SID_QUEREYREAMS2 is how the official client does it now. The clients USED to use SID_QUEREYREALMS but they moved up. Also post a packet log so we can see what your doing. ~-~(HDX)~-~ | March 4, 2006, 12:24 AM |
Jaquio | Could you recommend a good packet logger? And is there a certain fliter I should use to fliter out the packets you need to see? | March 4, 2006, 2:04 AM |
Myndfyr | [quote author=Jaquio link=topic=14403.msg147557#msg147557 date=1141437844] Could you recommend a good packet logger? And is there a certain fliter I should use to fliter out the packets you need to see? [/quote] Ethereal. Filter: port 6112 | March 4, 2006, 4:34 AM |
HdxBmx27 | WPE ~-~(HDX)~-~ | March 4, 2006, 4:45 AM |
Jaquio | [quote author=MyndFyre[vL] link=topic=14403.msg147565#msg147565 date=1141446849] [quote author=Jaquio link=topic=14403.msg147557#msg147557 date=1141437844] Could you recommend a good packet logger? And is there a certain fliter I should use to fliter out the packets you need to see? [/quote] Ethereal. Filter: port 6112 [/quote] Using the filter "port 6112" isn't doing anything at all. Keeps saying invalid, I don't know how to work the filters on here and the online docs don't help much either. | March 4, 2006, 4:47 AM |
HdxBmx27 | filter: tcp.port == 6112 Thats why I sugested WPE, it's 'easier' to use. ~-~(HDX)~-~ | March 4, 2006, 4:50 AM |
Jaquio | Alright, got the log with WPE.. What do I do about my Accountname and CDKey? If I post the log people will have it. ??? | March 4, 2006, 4:52 AM |
HdxBmx27 | PM it to me and i'll take out all that info. Or, simply X out the private info like exeryone else does... ~-~(HDX)~-~ | March 4, 2006, 5:10 AM |
Jaquio | Lol, I never thought of that. Here is the log [code] 1 192.168.1.47:1599 63.161.183.205:9367 17 Send 0000 11 00 0E 4A 61 71 20 42 6F 74 20 76 31 2E 30 30 ...Jaq Bot v1.00 0010 00 . 2 63.161.183.205:9367 192.168.1.47:1599 7 Recv 0000 07 00 0E 47 BD BB B4 ...G... 3 192.168.1.47:1599 63.161.183.205:9367 7 Send 0000 07 00 0F 2A F0 16 3F ...*..? 4 63.161.183.205:9367 192.168.1.47:1599 7 Recv 0000 07 00 0F 01 00 00 00 ....... 5 192.168.1.47:1599 63.161.183.205:9367 7 Send 0000 07 00 10 04 00 00 00 ....... 6 63.161.183.205:9367 192.168.1.47:1599 11 Recv 0000 0B 00 10 04 00 00 00 0B 00 00 00 ........... 7 192.168.1.47:1600 63.240.202.128:6112 59 Send 0000 01 FF 50 3A 00 00 00 00 00 36 38 58 49 56 44 32 ..P:.....68XIVD2 0010 44 0B 00 00 00 00 00 00 00 00 00 00 00 80 04 00 D............... 0020 00 33 10 00 00 33 10 00 00 55 53 41 00 55 6E 69 .3...3...USA.Uni 0030 74 65 64 20 53 74 61 74 65 73 00 ted States. 8 63.240.202.128:6112 192.168.1.47:1600 8 Recv 0000 FF 25 08 00 DF 5D 75 31 .%...]u1 9 63.240.202.128:6112 192.168.1.47:1600 100 Recv 0000 FF 50 64 00 00 00 00 00 E0 28 FA 11 86 26 07 00 .Pd......(...&.. 0010 00 AC 41 43 25 0B C5 01 49 58 38 36 76 65 72 33 ..AC%...IX86ver3 0020 2E 6D 70 71 00 41 3D 31 35 34 34 30 36 37 32 39 .mpq.A=154406729 0030 20 42 3D 32 30 32 38 30 33 39 34 34 20 43 3D 31 B=202803944 C=1 0040 30 36 38 33 35 37 37 37 39 20 34 20 41 3D 41 2D 068357779 4 A=A- 0050 53 20 42 3D 42 2D 43 20 43 3D 43 5E 41 20 41 3D S B=B-C C=C^A A= 0060 41 5E 42 00 A^B. 10 192.168.1.47:1599 63.161.183.205:9367 75 Send 0000 4B 00 09 04 00 00 00 03 00 00 00 41 3D 31 35 34 K..........A=154 0010 34 30 36 37 32 39 20 42 3D 32 30 32 38 30 33 39 406729 B=2028039 0020 34 34 20 43 3D 31 30 36 38 33 35 37 37 37 39 20 44 C=1068357779 0030 34 20 41 3D 41 2D 53 20 42 3D 42 2D 43 20 43 3D 4 A=A-S B=B-C C= 0040 43 5E 41 20 41 3D 41 5E 42 00 00 C^A A=A^B.. 11 63.161.183.205:9367 192.168.1.47:1599 50 Recv 0000 32 00 09 01 00 00 00 00 0B 00 01 70 8F 67 91 47 2..........p.g.G 0010 61 6D 65 2E 65 78 65 20 30 38 2F 31 37 2F 30 35 ame.exe 08/17/05 0020 20 30 31 3A 31 31 3A 34 33 20 32 31 32 35 38 32 01:11:43 212582 0030 34 00 4. 14 192.168.1.47:1600 63.240.202.128:6112 113 Send 0000 FF 25 08 00 00 00 00 00 FF 51 69 00 81 E0 56 2D .%.......Qi...V- 0010 00 0B 00 01 70 8F 67 91 01 00 00 00 00 00 00 00 ....p.g......... 0020 10 00 00 00 06 00 00 00 08 7B C1 00 00 00 00 00 .........{...... 0030 97 07 1E EF 8C CD 21 DB DD 4A 4C 67 FA E5 F6 79 ......!..JLg...y 0040 EE 3F F1 6E 47 61 6D 65 2E 65 78 65 20 30 38 2F .?.nGame.exe 08/ 0050 31 37 2F 30 35 20 30 31 3A 31 31 3A 34 33 20 32 17/05 01:11:43 2 0060 31 32 35 38 32 34 00 4C 57 2D 4A 61 71 75 69 6F 125824.LW-Jaquio 0070 00 . 15 63.240.202.128:6112 192.168.1.47:1600 9 Recv 0000 FF 51 09 00 00 00 00 00 00 .Q....... 16 192.168.1.47:1599 63.161.183.205:9367 20 Send 0000 14 00 0B 09 00 00 00 00 00 00 00 XX XX XX XX XX ...........XXXXX 0010 XX XX XX XX XXXX 17 63.161.183.205:9367 192.168.1.47:1599 23 Recv 0000 17 00 0B 12 19 01 03 52 7C DD 5A 65 BD FC AC 7B .......R|.Ze...{ 0010 95 B5 40 74 6A 6D 89 ..@tjm. 18 192.168.1.47:1599 63.161.183.205:9367 39 Send 0000 27 00 0B 1C 00 00 00 01 00 00 00 81 E0 56 2D E0 '............V-. 0010 28 FA 11 12 19 01 03 52 7C DD 5A 65 BD FC AC 7B (......R|.Ze...{ 0020 95 B5 40 74 6A 6D 89 ..@tjm. 19 63.161.183.205:9367 192.168.1.47:1599 23 Recv 0000 17 00 0B 41 E1 58 75 FC B1 98 79 A4 28 F6 2F B8 ...A.Xu...y.(./. 0010 B5 CD B0 46 1F E0 8B ...F... 20 192.168.1.47:1600 63.240.202.128:6112 54 Send 0000 FF 14 08 00 74 65 6E 62 FF 2D 04 00 FF 3A 2A 00 ....tenb.-...:*. 0010 81 E0 56 2D E0 28 FA 11 41 E1 58 75 FC B1 98 79 ..V-.(..A.Xu...y 0020 A4 28 F6 2F B8 B5 CD B0 46 1F E0 8B 4C 57 2D 4A .(./....F...LW-J 0030 61 71 75 69 6F 00 aquio. 21 63.240.202.128:6112 192.168.1.47:1600 22 Recv 0000 FF 2D 16 00 00 08 16 BF E9 50 C3 01 69 63 6F 6E .-.......P..icon 0010 73 2E 62 6E 69 00 s.bni. 22 63.240.202.128:6112 192.168.1.47:1600 8 Recv 0000 FF 3A 08 00 00 00 00 00 .:...... 23 192.168.1.47:1600 63.240.202.128:6112 4 Send 0000 FF 40 04 00 .@.. 24 63.240.202.128:6112 192.168.1.47:1600 51 Recv 0000 FF 40 33 00 00 00 00 00 01 00 00 00 01 00 00 00 .@3............. 0010 55 53 45 61 73 74 00 52 65 61 6C 6D 20 66 6F 72 USEast.Realm for 0020 20 74 68 65 20 55 53 20 45 61 73 74 20 43 6F 61 the US East Coa 0030 73 74 00 st. 25 192.168.1.47:1599 63.161.183.205:9367 19 Send 0000 13 00 0B 08 00 00 00 00 00 00 00 70 61 73 73 77 ...........passw 0010 6F 72 64 ord 26 63.161.183.205:9367 192.168.1.47:1599 23 Recv 0000 17 00 0B EC C8 0D 1D 76 E7 58 C0 B9 DA 8C 25 FF .......v.X....%. 0010 10 6A FF 8E 24 29 16 .j..$). 27 192.168.1.47:1599 63.161.183.205:9367 39 Send 0000 27 00 0B 1C 00 00 00 01 00 00 00 81 E0 56 2D E0 '............V-. 0010 28 FA 11 EC C8 0D 1D 76 E7 58 C0 B9 DA 8C 25 FF (......v.X....%. 0020 10 6A FF 8E 24 29 16 .j..$). 28 63.161.183.205:9367 192.168.1.47:1599 23 Recv 0000 17 00 0B 5C D1 40 AF CD 84 C8 61 9A 99 B4 87 F5 ...\.@....a..... 0010 D8 9A B9 59 C1 A6 D0 ...Y... 29 192.168.1.47:1600 63.240.202.128:6112 45 Send 0000 FF 3E 2D 00 81 E0 56 2D 5C D1 40 AF CD 84 C8 61 .>-...V-\.@....a 0010 9A 99 B4 87 F5 D8 9A B9 59 C1 A6 55 53 45 61 73 ........Y..USEas 0020 74 2E 42 61 74 74 6C 65 2E 4E 65 74 00 t.Battle.Net. 30 63.240.202.128:6112 192.168.1.47:1600 12 Recv 0000 FF 3E 0C 00 81 E0 56 2D 01 00 00 80 .>....V-.... [/code] | March 4, 2006, 5:17 AM |
HdxBmx27 | Found your problem: [code] 17 00 0B ... 5C D1 40 AF \.@. CD 84 C8 61 ...a 9A 99 B4 87 .... F5 D8 9A B9 .... 59 C1 A6 D0 Y... FF 3E 2D 00 .>-. 81 E0 56 2D ..V- 5C D1 40 AF \.@. CD 84 C8 61 ...a 9A 99 B4 87 .... F5 D8 9A B9 .... 59 C1 A6 Y.. 55 53 45 61 73 74 2E 42 61 74 74 6C 65 2E 4E 65 74 00 USEast.Battle.Net.[/code] 2 things you're missing the vary last byte of the password hash. You're using the wrong realm title. (use the one from 0x40) Also, why are you doing the double hashes sepratly? BNLS_HASHDATA has the 0x02 flag for double hashing.. Save a few RTT hits.. and make your program run faster. ~-~(HDX)~-~ | March 4, 2006, 6:10 AM |
Jaquio | Use the whole [code] 0010 55 53 45 61 73 74 00 52 65 61 6C 6D 20 66 6F 72 USEast.Realm for 0020 20 74 68 65 20 55 53 20 45 61 73 74 20 43 6F 61 the US East Coa 0030 73 74 00 st. [/code] As realm title? Or only USEast? Or what exactly.. Also, the last byte on the password hash. Would this be right?(I am ipbanned from bent atm and not sure about realm title) "Mid(Data, 4, Len(Data) - 4)" instead of "Mid(Data, 3, Len(Data) - 4)"? | March 4, 2006, 6:31 AM |
HdxBmx27 | Use the realm name ( "USEast" ) ~-~(HDX)~-~ | March 4, 2006, 6:34 AM |
Jaquio | OMG! It worked. I LOVE YOU HDX!.. Erm, ok that is out of the way. So from here I remove the MPC Chunk 1 & 2 for MCP_STARTUP? As well as my BNCS Unique Name? | March 4, 2006, 6:42 AM |
HdxBmx27 | March 4, 2006, 6:59 AM |