• Welcome to Valhalla Legends Archive.
 

D2GS Packet Research

Started by Ringo, June 02, 2005, 07:09 PM

Previous topic - Next topic
|

l2k-Shadow

If you mean the length of the packet of 0xAE the format for it is:

(BYTE) ID (0xAE)
(WORD) Length EXCLUDING header
(VOID) Data
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

dxoigmn

#91
Hmm I might have to retract my statement that they only go up to 0xAE. When the client disconnects, the server sends packet 0xB0. This doesn't looked to be handled by D2Client, which I have been working from. Perhaps it is something only handled by D2Net then?

LivedKrad

That's the packet the server sends you to tell you you were forcefully dropped from the game. I don't think there are any packet above 0xB0, and the packets should go up to there anyway because packet 0xAF exists (first packet in the D2GS connection).

LivedKrad

Something is still wrong with my parser even with the new table I put in. I'm still getting this strange packet "0xC0", which is invalid. This is because I'm splitting the packets up incorrectly.

Ringo

Packets exist higher than 0xB0.
Last patch's AF was droped due to time out, witch has been shifted up a-byte to 0xB0.
AFAIK, 0xB3 still means ip banned.

LivedKrad


Dim newClump$, compressedPacket$, decompressedPacket$, compLength&, decompLength&, decompMax&, packetID As Byte
Dim offset As Integer, indLength As Integer, indPacket As String
newClump = data

While Len(newClump) > 0

compLength = GPSize(newClump, offset)
compressedPacket = Mid(newClump, offset, compLength)
decompressedPacket = String$(compLength * 2 + 150, Chr$(0))
decompMax = Len(decompressedPacket)
Call GamePacketDecode(compressedPacket, compLength, decompressedPacket, decompMax, decompLength)
decompressedPacket = Mid(decompressedPacket, 1, decompLength)

  packetID = Asc(Mid$(decompressedPacket, 1, 1))
  indLength = D2Parse.GetSize(packetID, decompressedPacket)
 
   If packetID = &HAE Then
    AddChat vbRed, "WARDEN 0x" & Hex(packetID) & ": " & DebugOutput(decompressedPacket)
    Exit Sub
   End If
   
    If indLength = -2 Then
   AddChat vbRed, "What the hell " & Hex(packetID) & " : " & DebugOutput(decompressedPacket)
   Exit Sub
  End If
 
  indPacket = Mid(decompressedPacket, 1, indLength)
  'Call D2Parse.ParseD2GS(packetID, indLength, Mid$(indPacket, 2))
  AddChat vbWhite, "New decompressed packet 0x" & Hex(packetID) & ": " & DebugOutput(indPacket)

newClump = Mid$(newClump, compLength + offset)
Wend


I still don't get it. This code looks fine to me, I just don't get it.

LivedKrad

I think I might have fixed it, but I still get some weird things going on. Are you positive the length is the first two bytes after the packet ID?

l2k-Shadow

Quote from: LivedKrad.fe on September 17, 2005, 04:12 PM
I think I might have fixed it, but I still get some weird things going on. Are you positive the length is the first two bytes after the packet ID?

Yes, the length is the two bytes after the packet ID, excluding the header. So two bytes after packet id + 3 = length of packet.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

LivedKrad

Shadow, mind getting on MSN? I need to talk to you. Anyway, my separater is still having issues.

dxoigmn

Quote from: LivedKrad.fe on September 17, 2005, 05:11 PM
Shadow, mind getting on MSN? I need to talk to you. Anyway, my separater is still having issues.

Are you parsing all the other variable length packets correctly? Or is it just 0xAE?

LivedKrad

How should I know? The parser interprets invalid packets every time I get into a game. Always different.

Ringo

Quote from: LivedKrad.fe on September 17, 2005, 07:55 PM
How should I know? The parser interprets invalid packets every time I get into a game. Always different.
Try think about how the compressed data's incoming to you..


Do
    'get the compressed packets size
    'cut out that lengh of data (compressed packet)
    'decompress it
    Do
        'get the decompressed packets size from your table
        'cut it out the decompressed data
        'send that bit of data to a parser (D2GS Packet)
        'set DecomData as decompressed packet lengh + 1
    Loop Untill Len(DecomData) < 1
    'set  ComData as compressed packet lengh + 1
Loop Untill Len(ComData) < 1

Hope this helps

LivedKrad

Not really. Here's what I have, still broken:


Dim newClump$, compressedPacket$, decompressedPacket$, compLength&, decompLength&, decompMax&, packetID As Byte
Dim offset As Integer, indLength As Integer, indPacket As String
newClump = data

'Process data begin---
While Len(newClump) > 1

  compLength = GPSize(newClump, offset) 'get the size of the new message
  compressedPacket = Mid$(newClump, 1, compLength) 'cut out that part of the clump
  decompressedPacket = DataDecomp(compressedPacket, compLength, offset, decompLength)
  'decompressedPacket = String$(compLength * compLength, Chr$(0))
  'Call GamePacketDecode(compressedPacket, compLength, decompressedPacket, Len(decompressedPacket), decompLength) 'decompress it
  decompressedPacket = Mid$(decompressedPacket, 1, decompLength)

    packetID = Asc(Mid$(decompressedPacket, 1, 1)) 'get packet id to identify size
    indLength = D2Parse.GetSize(packetID, decompressedPacket) 'get size of decompressed packet
    indPacket = Mid$(decompressedPacket, 1, indLength) 'removed from buffer
    'Call D2Parse.ParseD2GS(packetID, indLength, Mid$(indPacket, 2))
    AddChat vbWhite, "New decompressed packet 0x" & Hex(packetID) & ": " & DebugOutput(indPacket)
   
   newClump = Mid$(newClump, compLength + 1)
   
Wend

Ringo

#103
Quote from: LivedKrad.fe on September 23, 2005, 03:53 PM
Not really. Here's what I have, still broken:
Your still not attempting to split up the decompressed packets.
Look at your code, you cut out the compressed packet, then geting the first decompressed ID, then get its lengh and then parse it.
What about the packets after that one?
A compressed packet (when decompressed) can hold multiple messages, but your only attempting to parse the first one.

LivedKrad

Right.. but notice as I reassign a new data clump from the PREVIOUS data clump to newClump, and then continue to parse the rest of that clump from there..

|