PDA

View Full Version : L2 World Server/Client Packets


equinoxx
09.08.2005, 23:07
I am trying to create a proxy type system for my server. I have been going over the l2j source code to the best of my ability and I have it down to this much. (No, I dont run an L2J server, I am just using it as a reference)

The following is assuming the client has a valid password and valid protocol version.

1. Client talks with auth server using blowfish
2. Client is connected to world server
3. Client sends protocol version packet
4. Server sends back a 'key' packet, which is 10 bytes. The last 8 bytes are a key.
5. The next packet that the client sends uses this 8 byte key for its encryption
6. Server gets packet, decrypts using the key from step 4.
7. Server changes the key again (part of changing algorithim has to do with the packet size from step 6)
8. Server handles packet (ie, processes attack command)
9. The next packet the server sends to this client is encrypted with the key from step 7.
10. Client gets packet, decrypts using key from step 7.
11. The next packet the client sends is encrypted with the key from step 7.

and so on..

Three things that have me stumped:

1. Are the first two bytes of the packet a size marker? If so, how do I read this size marker? left to right or right to left when converting from base 16 to base 10?
2. I had thought that the first two bytes of each packet were a size marker for that packet. However, the first two bytes of the key packet are 0x00 and 0x01, which equals 1 ... not 10 .... can anyone explain why this is?
3. Each time the server changes the key (send and receive) does it use the length of the payload or does it also count the 2 byte size marker?

Riane
10.08.2005, 02:53
maybe you have to read those first two bytes last to first ;) so its 10 ;)

i remember when ppl talked about hexing once, this had to be done, so its not absurd ;)

equinoxx
10.08.2005, 16:27
I was told that the firs two bytes are a size marker, and that size = (2nd-byte * 256) + 1st-byte


In that case, 0x00 0x01 is 256, however, the packet is only 10 bytes long. So...can anyone confirm that size is the 2nd byte * 256 plus the first byte?

Also...can anyone explain why the key packet has the size marker of 0x00 0x01

Thank you for any help