.NET 2.0/c# - CO2 Proxy Library

04/09/2006 13:34 cheesewhore66#1
Hi,
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

Quote:

ConquerProxy proxy = new ConquerProxy();
(new Thread(new ThreadStart(proxy.Run))).Start();
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!

What I know about different packets types
Ok simple answer, NOT VERY MUCH!

Well ok a little :). I have made the following assumptions:
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
04/09/2006 14:35 lolold#2
lets see
04/09/2006 14:50 blueshad0vv#3
lets see? wtf what kind of a helpful post was that

well anyways, back to the thread, isnt this just COPAC?
04/09/2006 15:12 cheesewhore66#4
Yes its doing essentially the same thing as the other packet tools, I wanted c# code to do it, as the base for writing other things......

I've just noticed the server emulator is c# so having a fish round there for ideas, I'm interested in building an api that can be used as the basis for bots...

Like I said if its useful, enjoy, otherwise don't worry about it :)
04/09/2006 15:42 Robsta#5
great work cheese, ill have a look through the code, i might re adjust my bot to work off of this, once i make it more stable. How many packet structs do you have so far? just the item ones?
04/09/2006 15:55 cheesewhore66#6
Thanks Robsta, not many (thats the online one I have full detail on right now, seems the server emulator has some comments which will be useful tho I might get a few packeted decoded soon)! I am building the basic code structure for decoding packets at the moment.....
04/09/2006 16:16 Doobs#7
God, Please for the LOVE OF GOD, Remove this...

I dont want noobs to be making there nooby bots, if they want to make bots they can do this themselfs!

PLEASE!, take this down Its great you want to contribute but dude this is just making it easy for the noobs, Please I beg you take this down....

If people want to make hacks they can read they guide and make it themselfs...
04/09/2006 16:31 cheesewhore66#8
Ahem...... I am a noob!
04/09/2006 16:44 Samm_br#9
Quote:
Originally posted by Doobs@Apr 9 2006, 16:16
God, Please for the LOVE OF GOD, Remove this...

I dont want noobs to be making there nooby bots, if they want to make bots they can do this themselfs!

PLEASE!, take this down Its great you want to contribute but dude this is just making it easy for the noobs, Please I beg you take this down....

If people want to make hacks they can read they guide and make it themselfs...
gtfo
04/09/2006 17:12 mindxspike#10
Quote:
Originally posted by Doobs@Apr 9 2006, 16:16
God, Please for the LOVE OF GOD, Remove this...

I dont want noobs to be making there nooby bots, if they want to make bots they can do this themselfs!

PLEASE!, take this down Its great you want to contribute but dude this is just making it easy for the noobs, Please I beg you take this down....

If people want to make hacks they can read they guide and make it themselfs...
you are kidding.....right? What exactly, may I ask, is wrong with noobs attempting to make their own bots? Would it hurt anyone at all? Just don't use them, thats all. And if they are noobs to begin with, I highly doubt they would have much use for this.
04/09/2006 17:29 Fataladmin#11
nice work, i hope this advances to somewhere good.. +1 karma for the good starting efforts ;)
04/09/2006 20:04 ~Unknown~#12
Quote:
Originally posted by cheesewhore66@Apr 9 2006, 06:34
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.
ok in this quote you basically saying that this proxy can decrypt all Conquer packets and provide to you so you can edit them and then resend them to the server If you'd like. Now I know that all packets in the game are encrypted with 4 different keys which I assume your proxy does. Now I know that the first packet you send, being the log in packet, doesn't use all 4 keys only 2. Does your proxy account for the log in packet and only use the 2 keys on it?
04/10/2006 09:37 Doobs#13
Ok, when im trying to say is, if people want to make hacks they can make them themselfs, No im not calling the maker a noob...
04/10/2006 13:51 Robsta#14
@ unknown, im sure it does, otherwise he wouldnt beable to get the keys to decrypt the other packets, the first 2 keys are hte same always, the 2nd and third are pulled from the login packet, dont remember what bytes.
04/10/2006 14:27 S.O#15
Quote:
Originally posted by cheesewhore66@Apr 9 2006, 13:34
Hi,
As I spent a good days work writing this, and I got a lot of help from reading through posts from this forum to
...

Edited out because jangotat complained i quote everything... noted.

...
- Share and enjoy
not bad :)