[c++] Help with Proxy

11/17/2010 13:25 Trigorio#16
Quote:
Originally Posted by IAmHawtness View Post
You can't get the character ID of the person you shift-click unless you hook the client's memory in some way, so if you had to do that, woulnd't it be easier if your whole proxy was memory based?
Why would that be easier? I think it's more efficient using your own cryptography.

And I don't need the character ID? I just need to get the Characther name of the box at the bottom left when shift clicking someone.

You just got to check for that memory and invoke an event when it changes.

The ID should already exist in the dictionairy lists since the client must of recieved a spawn packet by him.
11/17/2010 15:03 IAmHawtness#17
Quote:
Originally Posted by Trigorio View Post
Why would that be easier? I think it's more efficient using your own cryptography.

And I don't need the character ID? I just need to get the Characther name of the box at the bottom left when shift clicking someone.

You just got to check for that memory and invoke an event when it changes.

The ID should already exist in the dictionairy lists since the client must of recieved a spawn packet by him.
That's where dynamic memory comes in play. It's not just a simple readprocessmemory to get the id/name of the person you shift-clicked, which is why I believe hooking the client it easier. I'm just saying, a memory based proxy which only relies on hooking functions inside the exe can do a lot more than an "internet based" proxy that only works as a middle-man between the client and server.
11/17/2010 16:09 TomasLT#18
Hey i see that ur guys know more that i and i know that u can help me, so plz help. I cant figure out why i cant decrypt authresponse.
Code:
//[C++]
class AuthProtocolCryptographer
{
public:
	class CryptCounter
	{
	private:
		unsigned short m_Counter;

	public:
		unsigned char getKey2()
		{
			return static_cast<unsigned char>(m_Counter >> 8);
		}

		unsigned char getKey1()
		{
			return static_cast<unsigned char>(m_Counter & 0xFF);
		}

		void Increment()
		{
			m_Counter+=1;
		}
	};

private:
	CryptCounter *_decryptCounter;
	CryptCounter *_encryptCounter;
	unsigned char *_cryptKey1;
       	unsigned char *_cryptKey2;

public:
	AuthProtocolCryptographer()
	{
		_decryptCounter = new CryptCounter();
		_encryptCounter = new CryptCounter();
		_cryptKey1 = new unsigned char[256];
		_cryptKey2 = new unsigned char[256];
		unsigned char i_key1 = 0x9D;
		unsigned char i_key2 = 0x62;
		for (int i = 0; i <= 0x100; i++)
		{
			_cryptKey1[i] = i_key1;
			_cryptKey2[i] = i_key2;
			i_key1 = static_cast<unsigned char>((0xF + static_cast<unsigned char>(i_key1 * 0XFA)) * i_key1 + 0X13);
			i_key2 = static_cast<unsigned char>((0x79 - static_cast<unsigned char>(i_key2 * 0X5C)) * i_key2 + 0X6D);
		}
	}

	void EncryptClientPackets(byte buffer[], int len)
	{
		for (int i = 0; i < len; i++)
		{
			buffer[i] = buffer[i] ^ static_cast<unsigned char>(_cryptKey1[_encryptCounter->getKey1()] ^ _cryptKey2[_encryptCounter->getKey2()]);
			buffer[i] = static_cast<unsigned char>(buffer[i] >> 4 | buffer[i] << 4);
			buffer[i] = buffer[i] ^ static_cast<unsigned char>(0xAB);
			_encryptCounter->Increment();
		}
	}

        void EncryptServerPackets(byte buffer[], int len)
	{
		for (int i = 0; i < len; i++)
		{
			buffer[i] = buffer[i] ^ static_cast<unsigned char>(0xAB);
			buffer[i] = static_cast<unsigned char>(buffer[i] >> 4 | buffer[i] << 4);
			buffer[i] = buffer[i] ^ static_cast<unsigned char>(_cryptKey2[_decryptCounter->getKey2()] ^ _cryptKey1[_decryptCounter->getKey1()]);
			_encryptCounter->Increment();
		}
	}
	void DecryptClientPackets(byte buffer[],int len)
	{
		for (int i = 0; i < len; i++)
		{
			buffer[i] = buffer[i] ^ static_cast<unsigned char>(0xAB);
			buffer[i] = static_cast<unsigned char>(buffer[i] >> 4 | buffer[i] << 4);
			buffer[i] = buffer[i] ^ static_cast<unsigned char>(_cryptKey2[_decryptCounter->getKey2()] ^ _cryptKey1[_decryptCounter->getKey1()]);
			_decryptCounter->Increment();
		}
	}
        void DecryptServertPackets(byte buffer[],int len)
	{
		for (int i = 0; i < len; i++)
		{
			buffer[i] = buffer[i] ^ static_cast<unsigned char>(_cryptKey1[_encryptCounter->getKey1()] ^ _cryptKey2[_encryptCounter->getKey2()]);
			buffer[i] = static_cast<unsigned char>(buffer[i] >> 4 | buffer[i] << 4);
			buffer[i] = buffer[i] ^ static_cast<unsigned char>(0xAB);
                        _decryptCounter->Increment();
		}
	}
};
Maybe somethig wrong with keys ? bcouse i can decryt seed packets, and authrequest packets but cant decrytp authresponse