jackpoz / BotFarm

Application used to spawn WoW automated players compatible with 3.3.5a version only.
GNU General Public License v2.0
84 stars 68 forks source link

Question about decrypting packets #58

Open futurumesta opened 1 year ago

futurumesta commented 1 year ago

Hi! I want to ask about encrypting packets, I have some problem with that.

When we encrypt packet headers (send from client), we encrypt 6 bytes (as an example: CMSG_CHAR_CREATE), Since we are using a Circular buffer the next offset will be 6 bytes (and so on each time +6 bytes on the next send from the client, offset 6,12,18,24...). This works fine for me and the server understands and correctly decodes the packet headers. But the problem comes when I (the client) try to decode the response (server) headers. We must always decode exactly 4 bytes of the server header (as always, shouldn't we? as an example SMSG_CHAR_CREATE). I can only decrypt the header of the first packet. Further, all other packets coming from the server cannot be decrypted by me. Here we use the same Circular buffer, only offset is now +4 bytes (4,8,12,16...) - SMSG (server) headers are always 4 bytes

Am I making a mistake somewhere?

https://github.com/jackpoz/BotFarm/blob/6ee6f4750e482abaff8d5c119891b150336a596c/Client/Crypto/ARC4.cs#L47-L64

jackpoz commented 1 year ago

Hi, I have not modified that code and kept what the previous author did, so no idea what could go wrong. Are you building something of your own ?

futurumesta commented 1 year ago

Hi, I have not modified that code and kept what the previous author did, so no idea what could go wrong. Are you building something of your own ?

Yeah, I'm writing my new application and I just can't figure out how the decryption algorithm works here

jackpoz commented 1 year ago

you could check what https://github.com/TrinityCore/TrinityCore/tree/3.3.5 does, maybe it will help