Building a packet struct then replaying it?

Ask questions about cheating in any games you would like. Does not need to pertain to MicroMacro.
Post Reply
Message
Author
Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Building a packet struct then replaying it?

#1 Post by Exempt » Sat Oct 22, 2011 7:54 pm

Hm, well I know I'm going to be sending in packets I make back thru the encrypt function but I'm not sure how to do this best.

I was just going to create a array that contains all the bytes for my movements then just replay them from the array, by just increamenting the array by the size of the packet. That might work but It'd be eally hard to fix and errors in one of the arrays. Do you know any better way to do this...

The packets seem pretty simple. I really don't know much at all about packet in general but...

The first 5 bytes all stay the same so they must be a head of some sort.
The next 8 are the x and y destinations
The last 4 bytes are a complete mystery to me.

Code: Select all

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 9B 2B 00 00 8A 31 00 00 4D 17 00 |..1...+...1..M..|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 DF 2B 00 00 99 31 00 00 4D 6C 02 |..1...+...1..Ml.|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 92 2B 00 00 02 32 00 00 4D 88 02 |..1...+...2..M..|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 A7 2B 00 00 59 32 00 00 4D F6 04 |..1...+..Y2..M..|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 1F 2B 00 00 86 32 00 00 4D 9B 04 |..1...+...2..M..|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 10 2B 00 00 85 32 00 00 4D 8D 06 |..1...+...2..M..|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 F8 2A 00 00 65 32 00 00 4D 55 06 |..1...*..e2..MU.|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 CF 2A 00 00 4A 32 00 00 4D 13 08 |..1...*..J2..M..|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 A9 2A 00 00 51 32 00 00 4D F4 08 |..1...*..Q2..M..|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 13 37 00 00 5B 32 00 00 41 5E 0A |..1...7..[2..A^.|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 FA 2A 00 00 3F 32 00 00 4D 35 0A |..1...*..?2..M5.|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 FA 2A 00 00 92 32 00 00 4D 8A 0C |..1...*...2..M..|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 89 2B 00 00 9A 32 00 00 4D 21 0C |..1...+...2..M!.|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 A1 2B 00 00 31 32 00 00 4D D2 0E |..1...+..12..M..|
|00                                              |.               |
-------------------------------------------------------------------

C -> S: OP 01, len 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|01 A5 31 00 00 9E 2B 00 00 F2 31 00 00 4D 90 0E |..1...+...1..M..|
|00                                              |.               |
-------------------------------------------------------------------

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Building a packet struct then replaying it?

#2 Post by Administrator » Sun Oct 23, 2011 12:07 am

The last 4 bytes could be anything. Try converting them to different data types. It could be the ID of the action you are trying to do, or your target, or maybe even a timestamp or other unique identifier. You just need to keep looking for patterns. That's about all you can do. Once you figure that out, then you can begin building your own packets.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: Building a packet struct then replaying it?

#3 Post by Exempt » Sun Oct 23, 2011 1:38 pm

Hm, I'll have to look up how to do the byte conversion I guess. Type casting wouldn't work for converting the byte to says floats and ints?. I have some good reasources for how the decrpyt and encrypt work tho and I believe the only unique thing about a file is it generate a random number 0-254 and does a easy stop for comview.
Something like this.

Code: Select all

	void MyDecrypt(byte *packet, size_t len) 
	{
		if (len < 2)
			return;

		byte key = packet[0] + packet[1];
		key &= 0xFF;
		packet[0] ^= 0xAA;
	
		if (packet[0] == 0)
			return;

		byte startkeyval = offsets[key];
		startkeyval &= 0x24;
		startkeyval |= 1;

		int writepos = 2;
		while (writepos < len)
		{
			byte keyval = offsets[key];

			if (writepos & startkeyval)
			{
				if (keyval & startkeyval)
					packet[writepos] -= keyval;
				else
					packet[writepos] ^= keyval;
			}
			else
			{
				if (keyval & startkeyval)
					packet[writepos] += keyval;
				else
					packet[writepos] = ~packet[writepos];
			}

			++key;
			key &= 0xFF;
			++writepos;
		}

		byte seed = packet[1];
		memmove(&packet[1], &packet[2], len - 1);
		packet[len - 1] = seed; //sneaky, good way to catch commview
	}
};
I'm not going to try this yet because I need to learn about Sockets to do this from a exe but I'm pretty sue this is right.

Code: Select all

void MyEncrypt(byte *packet, size_t len)
{
	if (len < 2)
		return;

	memmove(&packet[2], &packet[1], len - 1);

	srand(time(NULL));
	packet[1] = rand() % 254 + 1; //yes, this is the only dynamic variable that affects the outcome
	packet[0] ^= 0xAA;

	byte key = packet[0] + packet[1];
	key &= 0xFF;

	if (packet[0] == 0)
		return;

	byte startkeyval = offsets[key];
	startkeyval &= 0x24;
	startkeyval |= 1;

	int writepos = 2;
	while (writepos < len + 1) //we moved everything a byte forward
	{
		byte keyval = offsets[key];

		if (writepos & startkeyval)
		{
			if (keyval & startkeyval)
				packet[writepos] += keyval;
			else
				packet[writepos] ^= keyval;
		}
		else
		{
			if (keyval & startkeyval)
				packet[writepos] -= keyval;
			else
				packet[writepos] = ~packet[writepos];
		}

		++key;
		key &= 0xFF;
		++writepos;
	}
}

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: Building a packet struct then replaying it?

#4 Post by Exempt » Mon Oct 24, 2011 12:57 pm

Do you know a program that will let me um... highlight a few byte then see them in all the data types? I'm doing it manually atm any it's pretty slow. I am making progress tho! Almost completely have the main structure done. I'm at the last part which is gonna be a pain from the looks of it. NPCs.............

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Building a packet struct then replaying it?

#5 Post by Administrator » Mon Oct 24, 2011 3:11 pm

http://easycalculation.com/hex-converter.php

You can put the bytes into a calculator like that. You can also just use the calculator that comes with your operating system.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: Building a packet struct then replaying it?

#6 Post by Exempt » Wed Oct 26, 2011 6:39 pm

Not exactly what I was after. I'm thinking of a program that I can input a bunch of bytes them adjust the sizes as i see fit. I could convert a sigle byte then decide later to change it to 2. Seems like it would make finding the structure of a packet easier. Calc is what i've been using but it's pretty slow, for me.. -.-

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests