As I spent a good days work writing this, and I got a lot of help from reading through posts from this forum to get it going I feel I should contribute something back! Maybe some of you could help me expand this code by sharing some your knowledge of the structure of the packets. I will cover the following in this post:
1) What this code does, and how to use it
2) What I know about different packets types (and what I'm assuming, I may be wrong!)
3) What I want to know!
If anyone feels like responding, reply here or in PM I don't mind. I feel like sharing today, but don't mind keeping it private!
What does this code do, andhow to use it
Simple answer it provides a proxy for CO2 that decodes all the data that passes through it, splits it into packets and then reencodes it and sends it onto the server. By doing this is can modify each packet sent either by the client or the server, and it can also inject packets in either direction at any time.
- It is written in c#
- It uses events to notify client classes of packets and other events
- Its multithreaded (it can support anynumber of connections theoretically
- Its an API, it is not a finished tool. IT IS FOR PROGRAMMERS!
- Its pratically untested, and horribly unfinnished, it is not threadsafe (probably)
To use it you need to do the following
To do anything useful, you need to hook the NewConnection event on proxy, then you need to hook events on each new game connection you get notified of. I'll leave you to work that out!Quote:
ConquerProxy proxy = new ConquerProxy();
(new Thread(new ThreadStart(proxy.Run))).Start();
What I know about different packets types
Ok simple answer, NOT VERY MUCH!
Well ok a little
1) There must be some structure, its just a matter of how uniform this is, do they have some sane encoding system or do they just through structs down the wire? I'm in no mood to go disassembling conquer, so maybe one of u can shed some light on this.
2) All packets have a length (this is pretty damn certian, I am breaking the up by the length bytes, and its working).
3) All packets have a typeId. This would make a lot of sense, but I have seen no attempts to make a list of ids on this forum, I would REALLY LIKE THIS LIST!
So heres what I see a packet as being:
ushort length; (including this field)
ushort type;
byte[] data; remaining data of packet.
The only packet I've really looked at so far is the packet you get sent for each item in a shop its structure is as follows:
ushort length; // 0x28 (40)
ushort type; // 0x454 (1108)
uint32 itemid; // Unique ID For Item?? Just a guess
uint32 shop; // 6D B9 01 00 - same for same shop - This ids seem to get allocated sequentially on a time basis, not on a location basis. How do we determine the shop ids of the shops around us, what packets tell us this?
uint32 price; // Price
uint32 itemtypeid; // Maps to ItemTypes.data
uint32 id2; // Another Id that seems to change from item 2 item
uint32 unknown1; // usually 0x1
uint32 unknown2; // usually 0x0 - not always
uint32 unknown3; // usually 0x0 - not always
uint32 unknown4; // usually 0x0 - never seen otherwise in my limited testing
We need to document a structure like this for every packet we can, any help on this would be great I dont feel like reversing every one!
What I want to know
- As much concrete structure information for useful packets as possible!
- Any mistakes I have made in my code!
- Share and enjoy






