Valhalla Legends Forums Archive | Battle.net Bot Development | help.how can i get the length of compress packet?

AuthorMessageTime
231131028705
:) i am a newer in this area.please help.thanks.
how can i get the length of compress packet?

after my client send join game request,i will receive a packet :
S->C:AE 01
Then response
C->S:67 9C 46 BC 49 1F 01 03  0A 00 00 00 00 66 66 .............
S->C:06 7A 09 2E EF 5C  /Ping
C->S:6C 10 3B C1 02 00 00 00  00
S->C:07 1F 7F FF FF FF C0   /sucess
Then i get some huge packet
S->C:EC 17 5F 9F 19 86 65 3F  FF F0 43 7E 64 AC 5D 0C   ............... AS Follow.
it's send by several packets and i need to piece them together,so i need know the lenght.

how can i get that?
[code]
00000000  EC 17 5F 9F 19 86 65 3F  FF F0 43 7E 64 AC 5D 0C   .._...e? ..C~d.].
00000010  CD 9D 0D F7 E0 44 8C FF  75 EE F7 09 77 09 97 09   .....D.. u...w...
00000020  B7 09 D7 3F 71 8E E5 8B  96 A4 A1 9A 4D 19 EE 3A   ...?q... ....M..:
00000030  D3 87 1B F0 56 F7 70 E3  7E 0B DE EE 1C C3 33 F0   ....V.p. ~.....3.
00000040  9D 1F 83 04 39 86 67 E1  32 0B 03 04 38 DF 8F BB   ....9.g. 2...8...
00000050  0E 1C 6F C7 DD 87 0E 37  E3 EE C3 87 1B F1 F7 61   ..o....7 .......a
00000060  C3 8D F8 FB B0 E1 EB BF  71 A4 FA E3 A2 5A 86 4C   ........ q....Z.L
00000070  0E 38 E2 18 DD 7A 86 4C  23 13 26 00 0C 4D 0E 8D   .8...z.L #.&..M..
00000080  CE 38 14 58 1F AD 27 E1  D5 FB 8C F6 DB 6D B0 EA   .8.X..'. .....m..
00000090  FE 33 5B 6D B6 C6 17 77  77 7B BB FB BB BD DF 77   .3[m...w w{.....w
000000A0  DD DF 77 E4 A4 3F 79 97  47 D0 4E 4D 1E F3 2B 9A   ..w..?y. G.NM..+.
000000B0  25 34 1E 0D 58 34 24 9A  3F D8 34 F4 A6 83 C2 67   %4..X4$. ?.4....g
000000C0  BD CD 1D 91 06 FF FF 0E  0B 8E 5C 47 CC 1C 60 41   ........ ..\G..`A
000000D0  FF F8 7D FF F5 BC EF E4  04 80 AD AD FE B7 E4 04   ..}..... ........
000000E0  80 FA DA DF FF FA DA DF  AD AD FF FC F1 AB 31 BF   ........ ......1.
...................................

00000A70  03 69 D8 CA 34 0C 85 83  D1 94 6C 3B 1A 46 83 B1   .i..4... ..l;.F..
00000A80  B5 52 B1 B0 EC 6C 19 46  B1 BC 65 1A C4 33 B0 04   .R...l.F ..e..3..
00000A90  A8 65 3B 2D 8C A3 91 DA  B1 B4 65 58 76 AC 6C 3B   .e;-.... ..eXv.l;
00000AA0  0E 40 12 A1 94 EC 5B 1B  46 91 A0 65 3B 1A 46 63   .@....[. F..e;.Fc
00000AB0  B1 60 69 1A CB 43 20 D0  1C 88 6D 96 49 90 08 58   .`i..C . ..m.I..X
00000AC0  BF 35 68 10 32 B4                                  .5h.2.
[/code]
March 14, 2009, 2:56 PM
Yegg
Count the bytes? You need to provide more details on this. By the way, what's up with your name?
March 14, 2009, 9:57 PM
231131028705
this 's my code.it 's too simple to handle GS packet.


Private Sub OnReadCompleted4(ByVal asyncResult As IAsyncResult)
        ' Check the read status
        Dim bytesRead As Integer
        Try
            SyncLock tcpClient4.GetStream
                bytesRead = tcpClient4.GetStream().EndRead(asyncResult)
            End SyncLock
            If bytesRead < 1 Then
                Me.status = "#4"
                Exit Sub
            ElseIf bytesRead > 1 Then
                Dim tmp(bytesRead - 1) As Byte
                System.Array.Copy(responseBytes, 0, tmp, 0, bytesRead)

                gamedate(tmp, tmp.Length, 4)
            End If
            tcpClient4.GetStream().BeginRead(responseBytes, 0, responseBytes.Length, AddressOf OnReadCompleted4, Nothing)
        Catch exception As Exception
            MsgBox(exception.Message)
        End Try
    End Sub
March 14, 2009, 11:17 PM
231131028705
Public Sub gamedate(ByRef apacket() As Byte, ByVal alen As Long, Optional ByVal tcp As Byte = 4)

        Select Case apacket(0)
            Case &HAE
                subae(apacket, alen)
            Case &H7
                sub407(apacket, alen)
            Case &H6
                sub06(apacket, alen)

            Case Else
//////////// here is the problem.
                If apacket.Length <> alen Then
                    Dim buffer() As Byte = {}
                    MsgBox(System.BitConverter.ToString(apacket, 0, alen))
                    D2Packets.D2Packets.D2GSCompression.DecompressData(apacket, 0, alen, buffer)
               
                End If

        End Select

    End Sub
March 14, 2009, 11:19 PM
Barabajagal
http://www.bnetdocs.com/?op=doc&did=16

[quote]D2GS Headers

D2GS stands for Diablo 2 Game Server. This constitutes the in-game protocol used by Diablo II. The D2GS protocol is somewhat more complicated than other Blizzard protocols - most D2GS messages have set lengths, and those that don't generally have some unique way of obtaining it. The headers are as follows (for decompressed messages):


(BYTE)      Message ID
(VOID)      Message Data


For compressed messages:

(BYTE)      Message Size
(BYTE)      Decompressed Message ID
(VOID)      Message Data[/quote]
March 14, 2009, 11:35 PM
BreW
您好231131028705 ,长度的压缩包等于不管所传回接收数据的功能。很抱歉我们没有人说你的语言,我在说什么听起来不可思议。请裸与我们联系!
March 15, 2009, 1:35 AM
231131028705
Public Shared Function DecompressData(ByVal data() As Byte, ByVal offset As Integer, ByVal length As Integer, ByVal outdata() As Byte) As Integer

what is the means of offset here?

i still did't get it.

here is my log
format:

income data
len:xx
decompress data
-------------

next
[pre]

00-5A-C0-A8-07-2A-86-6C
len: 8
54-00-00-6D-E4-A5-00-68-66-00-00
B
________________________________________________
AE-01
len: 2
00-02
2
________________________________________________
06-7A-09-2E-EF-5C
len: 6
BE-00-00-04-00-30-00-01-01-00-02
B
________________________________________________
07-1F-7F-FF-FF-FF-C0
len: 7
C5-00-00-00-00-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
25
________________________________________________
EA-17-5F-9F-19-86-65-3F-FF-F0-43-7E-64-AC-5D-0C-CD-9D-0D-F7-E0-44-8C-FF-75-EE-F7-09-77-09-97-09-B7-09-D7-3F-71-8E-E5-8B-96-A4-A1-9A-4D-19-EE-3A-D3-87-1B-F0-56-F7-70-E3-7E-0B-DE-EE-1C-C3-33-F0-9D-1F-83-04-39-86-67-E1-32-0B-03-04-38-DF-8F-BB-0E-1C-6F-C7-DD-87-0E-37-E3-EE-C3-87-1B-F1-F7-61-C3-8D-F8-FB-B0-E1-EB-BF-71-A4-FA-E3-A2-5A-8A-43-8E-38-86-37-5E-A2-92-31-52-14-45-E0-E8-DC-E3-81-45-81-FA-D2-7E-1D-5F-B8-CF-6D-B6-DB-0E-AF-E3-35-B6-DB-6C-61-77-77-77-BB-BF-BB-BB-DD-F7-7D-DD-F7-7E-4A-43-F7-99-74-7D-04-E4-D1-EF-32-B9-A2-53-41-E0-D5-83-42-49-A3-FD-83-4F-4A-68-3C-26-7B-DC-D1-D9-10-6F-FF-F0-E0-B8-E5-C4-7C-C1-C6-04-1F-FF-87-DF-FF-5B-CE-FE-40-48-0A-DA-DF-EB-7E-40-48-0F-AD-AD-FF-FF-AD-AD-FA-DA-DF-FF-C0
len: EA
00-00-00-1E-02-02-00-00-00-03-66-66-67-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-AA-00-01-00-00-00-0C-69-59-F9-FF-1F-76-00-01-00-00-00-94-0E-01-00-00-00-00-00-01-02-00-01-01-00-01-D9-00-01-DA-00-01-DB-00-01-DC-00-01-03-00-01-60-00-01-62-00-01-64-00-28-66-00-3B-6A-00-01-7D-00-15-21-00-00-01-00-00-00-B5-01-00-01-01-21-00-00-01-00-00-00-BA-01-00-01-01-22-00-F9-01-00-00-00-DC-00-93-F2-00-22-00-F9-01-00-00-00-DA-00-B6-F2-00-21-00-00-01-00-00-00-8F-00-00-05-01-21-00-00-01-00-00-00-8F-00-00-05-01-21-00-00-01-00-00-00-8F-00-00-05-01-21-00-00-01-00-00-00-8F-00-00-05-01-21-00-00-01-00-00-00-8F-00-00-05-01-27-01-01-00-00-00-01-6F-03-02-7C-0D-00-1E-00-0A-18-00-00-00-78-F5-01-02-00-1E-00-0A-00-5F-00-0A-4C-5A-23-17-18-00-00-00-9B-6D-2A-80-43-00-00-23-00-01-00-00-00-01-6A-00-FF-FF-FF-FF-23-00-01-00-00-00-00-66-00-FF-FF-FF-FF-5E-01-01-01-01-01-01-00-01-01-01-00-00-00-00-01-01-01-01-00-01-01-00-00-01-01-00-00-01-01-01-00-00-01-01-00-00-00-28-06-00-00-00-00-00-01-00-0C-00-00-00-08-00-00-00-04-00-1D-10-01-00-01-00-0C-00-01-10-0D-10-81-11-05-10-25-10-01-00-00-00-00-00-05-10-00-00-00-00-0D-10-81-12-01-00-01-00-01-10-01-13-2C-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-21-90-01-90-08-00-00-00-09-01-5D-04-00-00-00-00-00-00-00-00-00-00-00-00-00-00-29-00-00-00-00-00-00-00-00-00-00-00-00-00-80-00-00-00-20-00-00-00-00-00-A0-00-A0-00-80-00-80-00-00-00-00-00-00-00-80-00-00-00-00-00-A0-00-A0-00-00-00-00-00-80-00-80-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-80-00-80-00-00-00-00-00-80-00-80-00-00-00-00-00-00-00-00-00-00-00-00-00-00
203
________

[/pre]
March 15, 2009, 3:19 AM
231131028705
[quote author=brew link=topic=17846.msg181804#msg181804 date=1237080917]
您好231131028705 ,长度的压缩包等于不管所传回接收数据的功能。很抱歉我们没有人说你的语言,我在说什么听起来不可思议。请裸与我们联系!

[/quote]

难得有个会中文的。

事情是这样的。
我在编写进入游戏这段代码时遇到困难。
1.我的代码之前貌似没有办法区分前后数据包,可能将两个数据包连起来发给其他函数处理
例如先后有两个的数据包到达
A。xxxxxx
B.yyyyyyy
正常情况下getdata (xxxx)
getdata(yyyyyyy)
而我的可能出现getdata(xxxxxyyyyyy)
所以要依靠数据包长度定义把他们取出来。
2。
D2Packets.D2Packets.D2GSCompression.DecompressData(apacket, 0, apacket.Length, buffer)

Public Shared Function DecompressData(ByVal data() As Byte, ByVal offset As Integer, ByVal length As Integer, ByVal outdata() As Byte) As Integer
offset As Integer  这个在程序中如何确定?
March 15, 2009, 3:31 AM
fataly
First, are u sure u get AE 01? Because u should get af 01 what is not compressed, AF 01 tells  to the client that next packets must decompress.

Public Function GetPacketSize(Data As String) As Long
    Dim tmpData$, RetSize&, OffSet&
    tmpData = Data
    Call GamePacketSize(tmpData, RetSize, OffSet)
    Data = Mid(Data, 1 + OffSet) 'Remove Lengh header
    GetPacketSize = RetSize
End Function

Public Function DecodePacket(Data As String) As String
Dim Size&, OffSet&, OutSize&, outdata$
    GamePacketSize Data, Size, OffSet
    outdata = String((Size * 2) + 200, vbNullChar)
    GamePacketDecode Mid(Data, OffSet + 1), Size, outdata, Len(outdata), OutSize
    DecodePacket = outdata
End Function

Also, when u parse data from d2gs; handle that with boolean. Like:
Public Sub parseD2GS(ByRef Data As String)
    Dim PacketID As Byte
    If InGame = True Then
        Data = DecodePacket(Data)
        PacketID = Asc(Left$(Data, 1))
         Select Case PacketID
        Case &H67: Call modBNET.D2GShandle0x67(Data)
        Case &H6D: Call modBNET.D2GShandle0x6D(Data)
        Case &H15: Call modBNET.D2GShandle0x15(Data)
        Case &H96: Call modBNET.D2GShandle0x96(Data)
        Case &H95: Call modBNET.D2GShandle0x95(Data)
        Case Else
        ShowChat vbRed, "Unparsed Packet: 0x" & Hex(PacketID) & GetLog(Data)
        End Select
    Else
        PacketID = Asc(Left$(Data, 1))
        Select Case PacketID
        Case &HAF:   Call modBNET.D2GSsend0x68(hD2GShash, hD2GSToken)
        Case &H5:    Call modBNET.D2GSsend0x6B
        Case Else
        ShowChat vbRed, "Unparsed Packet: 0x" & Hex(PacketID) & GetLog(Data)
        End Select
    End If
End Sub

And last, u cant capture packets with packet log programs since packets are compressed - you must get decompressing code work and u can capture all right with:
ShowChat vbRed, "Unparsed Packet: 0x" & Hex(PacketID) & GetLog(Data)

I hope i told something what maybe helps you.
March 15, 2009, 8:40 AM
231131028705
;D
DONE.

thanks a lot.
March 16, 2009, 10:03 AM
Yegg
[quote author=231131028705 link=topic=17846.msg181824#msg181824 date=1237197838]
;D
DONE.

thanks a lot.
[/quote]

Post the solution if you found one? The purpose of forums like these is so that people (like yourself even) can find solutions to their problems.
March 16, 2009, 10:30 AM
fataly
[quote author=231131028705 link=topic=17846.msg181824#msg181824 date=1237197838]
;D
DONE.

thanks a lot.
[/quote]

Your wellcome.
March 16, 2009, 2:05 PM
231131028705
not totally as i want. just work out some packet.
when the heads =packet.lenght .it works fine.
you can see as follow.

[code][pre]

EF-17-5F-9F-19-86-65-3F-FF-F0-43-7E-64-AC-5D-0C-CD-9D-0D-F7-E0-44-8C-FF-75-EE-F7-09-77-09-97-09-B7-09-D7-3F-71-8E-E5-8B-96-A4-A1-9A-4D-19-EE-3A-D3-87-1B-F0-56-F7-70-E3-7E-0B-DE-EE-1C-C0-6B-F0-9D-1F-80-44-39-80-D7-E1-32-0B-00-44-38-DF-8F-BB-0E-1C-6F-C7-DD-87-0E-37-E3-EE-C3-87-1B-F1-F7-61-C3-8D-F8-FB-B0-E1-EB-BF-71-A4-FA-E3-A2-58-59-2A-22-38-E3-88-63-2E-BC-2C-95-11-46-21-89-08-69-0B-C2-B9-81-C7-02-8B-03-F5-A4-FC-3A-BF-71-9E-DB-6D-B6-1D-5F-C6-6B-6D-B6-D8-C2-EE-EE-EF-77-7F-77-77-BB-EE-FB-BB-EE-FC-94-87-EF-32-E8-FA-09-C9-A3-DE-65-73-44-A6-83-C1-AB-06-84-93-47-FB-06-9E-94-D0-78-4C-F7-B9-A3-B2-20-DF-FF-E1-C1-71-CB-88-F9-81-A8-C0-D7-FF-E1-F7-FF-D6-F3-BF-90-12-02-B6-B7-FA-DF-90-12-03-EB-6B-7F-FF-EB-6B-7E-B6-B7-FF-F0
len: EF
59-01-00-00-00-03-66-66-67-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-AA-00-01-00-00-00-0C-69-59-F9-FF-1F-76-00-01-00-00-00-94-0E-01-00-00-00-00-00-01-02-00-01-01-00-01-D9-00-01-DA-00-01-DB-00-01-DC-00-01-03-00-01-60-00-01-62-00-01-64-00-28-66-00-3B-6A-00-01-7D-00-15-21-00-00-01-00-00-00-B5-01-00-01-01-21-00-00-01-00-00-00-BA-01-00-01-01-22-00-8D-01-00-00-00-DC-00-93-86-00-22-00-8D-01-00-00-00-DA-00-B6-86-00-21-00-00-01-00-00-00-8F-00-00-05-01-21-00-00-01-00-00-00-8F-00-00-05-01-21-00-00-01-00-00-00-8F-00-00-05-01-21-00-00-01-00-00-00-8F-00-00-05-01-21-00-00-01-00-00-00-8F-00-00-05-01-27-01-01-00-00-00-01-6F-03-02-7C-0D-00-EA-52-07-18-00-00-00-78-F5-95-01-00-EA-52-07-00-5F-5F-06-FC-EF-49-09-18-00-00-00-9B-6D-2A-80-43-00-00-23-00-01-00-00-00-01-6A-00-FF-FF-FF-FF-23-00-01-00-00-00-00-66-00-FF-FF-FF-FF-5E-01-01-01-01-01-01-00-01-01-01-00-00-00-00-01-01-01-01-00-01-01-00-00-01-01-00-00-01-01-01-00-00-01-01-00-00-00-28-06-00-00-00-00-00-01-00-0C-00-00-00-08-00-00-00-04-00-1D-10-01-00-01-00-0C-00-01-10-0D-10-81-11-05-10-25-10-01-00-00-00-00-00-05-10-00-00-00-00-0D-10-81-12-01-00-01-00-01-10-01-13-2C-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-21-90-01-90-08-00-00-00-09-11-5D-14-00-00-00-00-00-00-00-00-00-00-00-00-00-00-29-00-00-00-00-00-00-00-00-00-00-00-00-00-80-00-00-00-20-00-00-00-00-00-A0-00-A0-00-80-00-80-00-00-00-00-00-00-00-80-00-00-00-00-00-A0-00-A0-00-00-00-00-00-80-00-80-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-80-00-80-00-00-00-00-00-80-00-80-00-00-00-00-00-00-00-00-00-00-00-00-00-00
1FF
________________________________________________
59-01-00-00-00-03-66-66-67-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
AA-00-01-00-00-00-0C-69-59-F9-FF-1F
76-00-01-00-00-00
94-0E-01-00-00-00-00-00-01-02-00-01-01-00-01-D9-00-01-DA-00-01-DB-00-01-DC-00-01-03-00-01-60-00-01-62-00-01-64-00-28-66-00-3B-6A-00-01-7D-00-15
21-00-00-01-00-00-00-B5-01-00-01-01
21-00-00-01-00-00-00-BA-01-00-01-01
22-00-8D-01-00-00-00-DC-00-93-86-00
22-00-8D-01-00-00-00-DA-00-B6-86-00
21-00-00-01-00-00-00-8F-00-00-05-01
21-00-00-01-00-00-00-8F-00-00-05-01
21-00-00-01-00-00-00-8F-00-00-05-01
21-00-00-01-00-00-00-8F-00-00-05-01
21-00-00-01-00-00-00-8F-00-00-05-01
27-01-01-00-00-00-01-6F-03-02-7C-0D-00-EA-52-07-18-00-00-00-78-F5-95-01-00-EA-52-07-00-5F-5F-06-FC-EF-49-09-18-00-00-00
9B-6D-2A-80-43-00-00
23-00-01-00-00-00-01-6A-00-FF-FF-FF-FF
23-00-01-00-00-00-00-66-00-FF-FF-FF-FF
5E-01-01-01-01-01-01-00-01-01-01-00-00-00-00-01-01-01-01-00-01-01-00-00-01-01-00-00-01-01-01-00-00-01-01-00-00-00
28-06-00-00-00-00-00-01-00-0C-00-00-00-08-00-00-00-04-00-1D-10-01-00-01-00-0C-00-01-10-0D-10-81-11-05-10-25-10-01-00-00-00-00-00-05-10-00-00-00-00-0D-10-81-12-01-00-01-00-01-10-01-13-2C-00-01-00-00-00-00-00-00-00-00-00-00-00-00-00-21-90-01-90-08-00-00-00-09-11-5D-14-00-00-00-00-00-00-00-00-00-00-00-00-00-00
29-00-00-00-00-00-00-00-00-00-00-00-00-00-80-00-00-00-20-00-00-00-00-00-A0-00-A0-00-80-00-80-00-00-00-00-00-00-00-80-00-00-00-00-00-A0-00-A0-00-00-00-00-00-80-00-80-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-80-00-80-00-00-00-00-00-80-00-80-00-00-00-00-00-00-00-00-00-00-00-00-00-00
[/pre][/code]
March 16, 2009, 4:01 PM
231131028705
some times i get a compressed packet which the heads <> packet.lenght.
it will fail. i don't know why and how to handle this.
still on try.
this copy form redvex.it will help u get the lenght for every type.
[code]
[pre]
  Public packetsize() As Int16 = { _
1, 8, 1, 12, 1, 1, 1, 6, 6, 11, 6, 6, 9, 13, 12, 16, _
16, 8, 26, 14, 18, 11, -1, -1, 15, 2, 2, 3, 5, 3, 4, 6, _
10, 12, 12, 13, 90, 90, -1, 40, 103, 97, 15, -1, 8, -1, -1, -1, _
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, 8, _
13, -1, 6, -1, -1, 13, -1, 11, 11, -1, -1, -1, 16, 17, 7, 1, _
15, 14, 42, 10, 3, -1, -1, 14, 7, 26, 40, -1, 5, 6, 38, 5, _
7, 2, 7, 21, -1, 7, 7, 16, 21, 12, 12, 16, 16, 10, 1, 1, _
1, 1, 1, 32, 10, 13, 6, 2, 21, 6, 13, 8, 6, 18, 5, 10, _
4, 20, 29, -1, -1, -1, -1, -1, -1, 2, 6, 6, 11, 7, 10, 33, _
13, 26, 6, 8, -1, 13, 9, 1, 7, 16, 17, 7, -1, -1, 7, 8, _
10, 7, 8, 24, 3, 8, -1, 7, -1, 7, -1, 7, -1, -1, -1, -1, _
1}

__________________________________________________
switch (packetId)
{
case 0x26:
return GetChatPacketSize(data, size);

case 0x5b:
return *reinterpret_cast<const short*>(bytes + 1);

case 0x94:
if (size >= 2)
{
return bytes[1] * 3 + 6;
}
break;

case 0xa8:
if (size >= 7)
{
return bytes[6];
}
break;

case 0xaa:
if (size >= 7)
{
return bytes[6];
}
break;

case 0xac:
if (size >= 13)
{
return bytes[12];
}
break;

case 0xae:
if (size >= 3)
{
return 3 + *reinterpret_cast<const short*>(bytes + 1);
}
break;

case 0x9c:
if (size >= 3)
{
return bytes[2];
}
break;

case 0x9d:
if (size >= 3)
{
return bytes[2];
}
break;

default:
if (packetId < sizeof(PacketSizes) / sizeof(int))
{
return PacketSizes[packetId];
}
break;
}
[/pre]
[/code]
March 16, 2009, 4:09 PM
231131028705
F1-AB-31-BF-18-9F-9C-C6-93-97-68-E5-72-9A-83-E1-45-CE-91-4F-10-D4-18-41-09-D1-8C-7A-5E-72-64-32-9D-19-9D-90-E1-C4-E8-22-01-F0-FD-24-E4-23-20-02-A8-03-D3-47-E6-95-B1-96-0A-17-44-11-50-8F-20-ED-C9-05-B1-9C-1F-12-02-78-D6-20-97-0C-C3-31-E8-2A-0E-07-....................................
7E-3E-EC-38-71-BF-1F-76-1C-56-DF-F8-BE-1D-DF-9F-19-86-65-3F-FF-19-6D-B7-FE-32-BF-C0-6B-F6-DB-12-17-97-41-F1-98-66-53-FF-F1-68-A0-54-3C-17-05-1F-FC
len: 991

how this happened?
F1 =991?
March 16, 2009, 4:17 PM
Spht
This is the most weird looking thread to scroll through
March 16, 2009, 6:59 PM
fataly
[quote author=Spht link=topic=17846.msg181830#msg181830 date=1237229980]
This is the most weird looking thread to scroll through
[/quote]
Im totally same with you.
March 16, 2009, 7:37 PM
231131028705
finally i get what i want and explaint how to work later.
it 's too long ,i do't know how make it short.

[pre]
19/03/2009 22:32:1259-01-00-00-00-03-66-66-67-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
19/03/2009 22:32:12AA-00-01-00-00-00-0C-69-59-F9-FF-1F
19/03/2009 22:32:1276-00-01-00-00-00
19/03/2009 22:32:1294-0E-01-00-00-00-00-00-01-02-00-01-01-00-01-D9-00-01-DA-00-01-DB-00-01-DC-00-01-03-00-01-60-00-01-62-00-01-64-00-28-66-00-3B-6A-00-01-7D-00-15
19/03/2009 22:32:1221-00-00-01-00-00-00-B5-01-00-01-01
19/03/2009 22:32:1221-00-00-01-00-00-00-BA-01-00-01-01
19/03/2009 22:32:1222-00-1A-01-00-00-00-DC-00-93-13-00
19/03/2009 22:32:1222-00-1A-01-00-00-00-DA-00-B6-13-00
19/03/2009 22:32:1221-00-00-01-00-00-00-8F-00-00-05-01
19/03/2009 22:32:1221-00-00-01-00-00-00-8F-00-00-05-01
19/03/2009 22:32:1221-00-00-01-00-00-00-8F-00-00-05-01
19/03/2009 22:32:1221-00-00-01-00-00-00-8F-00-00-05-01
19/03/2009 22:32:1221-00-00-01-00-00-00-8F-00-00-05-01
19/03/2009 22:32:1227-01-01-00-00-00-01-6F-03-02-7C-0D-00-EB-DF-06-18-00-00-00-78-F5-22-01-00-EB-DF-06-00-5F-96-08-DC-E9-5C-11-18-00-00-00
19/03/2009 22:32:129B-6D-2A-80-43-00-00
19/03/2009 22:32:1223-00-01-00-00-00-01-6A-00-FF-FF-FF-FF
.........................
[/pre]
March 20, 2009, 12:26 PM
231131028705
fisrt seperate  the compressed packets.


For compressed messages:

(BYTE)      Message Size
(BYTE)      Decompressed Message ID
(VOID)      Message Data

actually
(BYTE)      Message Size
or
(word)      Message Size

case by case.i don't know how it work.

[code]
Public Sub gamedate(ByRef apacket() As Byte, ByVal alen As Long, Optional ByVal tcp As Byte = 4)
        Select Case apacket(0)
            Case &HAE
                subae(apacket, alen)
            Case &H6
                sub06(apacket, alen)
            Case &H7
                sub407(apacket, alen)
                If Me.this_game Is Nothing Then
                    this_game = New game
                Else
                    'Me.this_game.ongamestart()
                End If
            Case 0
                If apacket(1) <> 90 Then
                    Me.status = "proxy unable connect to gs"
                End If
            Case Else
                Dim J, llen, buffer_len As Integer
                Dim buffer(1024 * 64) As Byte
                llen = alen
                Do While llen > 0
                    buffer_len = (apacket(J) << 4 >> 4) * 256 + apacket(J + 1)
                    If apacket(J) < llen And buffer_len <= llen Then

                        llen -= buffer_len
                    Else
                        buffer_len = apacket(J)
                        llen -= buffer_len

                    End If
                    System.Array.Copy(apacket, J, buffer, 0, buffer_len)
                    J += buffer_len
                    pop_packet(buffer, buffer_len)
                Loop
        End Select

    End Sub
[/code]
March 20, 2009, 12:51 PM
231131028705
sorry for my pool language.
[code]
Private Sub pop_packet(ByVal apacket() As Byte, ByVal alen As Integer)
        Dim buffer(1024 * 32) As Byte
        Dim result As Integer
        If alen = apacket(0) Then
            result = D2Packets.D2Packets.D2GSCompression.DecompressData(apacket, 1, alen - 1, buffer)
        Else
            result = D2Packets.D2Packets.D2GSCompression.DecompressData(apacket, 2, alen - 2, buffer)
        End If
        Dim i, len As Integer
        i = 0
        Do While i < result
            If buffer(i) < &HB4 Then
                If packetsize(buffer(i)) > 0 Then
                    len = packetsize(buffer(i))
                ElseIf packetsize(buffer(i)) = -1 Then
                    Select Case buffer(i)
                        Case &H26
                            Dim ll As Integer = 10
                            Dim xo As Byte = 0
                            Do Until xo = 2
                                ll = ll + 1
                                If buffer(i + ll) = 0 Then
                                    xo += 1
                                End If
                            Loop
                            len = ll + 1

                        Case &H5B
                            len = 36
                        Case &H94
                            len = buffer(i + 1) * 3 + 6
                        Case &HA8
                            len = buffer(i + 6)
                        Case &HAA
                            len = buffer(i + 6)
                        Case &HAC
                            len = buffer(i + 12)
                        Case &HAE
                            len = buffer(i + 6)
                        Case &H9C
                            len = buffer(i + 2)
                        Case &H9D
                            len = buffer(i + 2)
                        Case &HAC
                            len = buffer(i + 12)
                        Case &HAF
                            len = 2
                        Case Else
                            len = 2
                    End Select
                End If
                Dim tmp_packet(len - 1) As Byte
                System.Array.Copy(buffer, i, tmp_packet, 0, len)
                i = i + len
                this_game.onpacketreceive(tmp_packet, len)
            End If

        Loop
    End Sub
[/code]
March 20, 2009, 12:53 PM

Search