Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.- Constants.cs Buscas GameCryptographyKey y lo Reemplazas Por ->
- GameCryptographyKey = "XCheatLoaderMeGo",
- ===================================================================================
- 2.- Forward.cs Reemplazas la Clase Completa Por:
- using System.Text;
- namespace COServer.Network.AuthPackets
- {
- public unsafe class Forward : Interfaces.IPacket
- {
- byte[] Buffer;
- public enum ForwardType : byte
- {
- Ready = 2,
- InvalidInfo = 1,
- Banned = 25,
- WrongAccount = 57,
- Update = 58
- }
- public Forward()
- {
- Buffer = new byte[220 + 4];
- Writer.WriteUInt16(220 +4, 0, Buffer);
- Writer.WriteUInt16(1637, 2, Buffer);
- }
- public uint Identifier
- {
- get { return BitConverter.ToUInt32(Buffer, 4); }
- set { Writer.WriteUInt32(value, 4, Buffer); }
- }
- public ForwardType Type
- {
- get
- {
- return (ForwardType)(byte)BitConverter.ToUInt32(Buffer, 12);
- }
- set
- {
- Writer.WriteUInt32((byte)value, 12, Buffer);
- }
- }
- public ushort Port
- {
- get
- {
- return BitConverter.ToUInt16(Buffer, 16);
- }
- set
- {
- Writer.WriteUInt16(value, 16, Buffer);
- }
- }
- public string IP
- {
- get
- {
- return Encoding.Default.GetString(Buffer, 24, 16);
- }
- set
- {
- Writer.WriteString(value, 24, Buffer);
- }
- }
- public byte[] ToArray()
- {
- return Buffer;
- }
- public void Deserialize(byte[] buffer)
- {
- }
- public void Send(Client.GameState client)
- {
- client.Send(Buffer);
- }
- }
- }
- =========================================================================
- 3.- Authentication.cs Reemplazas la Clase Completa Por :
- using System;
- using COServer.Network.Cryptography;
- using System.Text;
- namespace COServer.Network.AuthPackets
- {
- public class Authentication
- {
- byte[] Buffer;
- public string Username
- {
- get
- {
- string x = Encoding.Default.GetString(Buffer, 8, 32);
- return x.Replace("\0", "");
- }
- }
- public string Password
- {
- get
- {
- byte[] PasswordArray = Encoding.Default.GetBytes(Encoding.Default.GetString(Buffer, 84, 32).Replace("\0", ""));
- string x = COServer.Network.Cryptography.PasswordDecryption.Decrypt(PasswordArray);
- return x.Replace("\0", "");
- }
- }
- public string Server
- {
- get
- {
- string x = Encoding.Default.GetString(Buffer, 136, 16);
- return x.Replace("\0", "").Replace("0", "");
- }
- }
- public string MacAddress
- {
- get
- {
- string x = Encoding.Default.GetString(Buffer, 152, 16);
- return x.Replace("\0", "");
- }
- }
- public void Deserialize(byte[] buffer)
- {
- if (buffer.Length == 312)
- {
- ushort length = BitConverter.ToUInt16(buffer, 0);
- if (length == 312)
- {
- ushort type = BitConverter.ToUInt16(buffer, 2);
- if (type == 1636)
- {
- Buffer = buffer;
- }
- }
- }
- }
- }
- }
- ==============================================================
- 4.- Creas una Nueva Clase y le Pegas Esto:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace COServer.Network.Cryptography
- {
- using System.Text;
- public class PasswordDecryption
- {
- static byte[] Key = new byte[32] { 90, 45, 12, 17, 35, 66, 44, 1, 02, 41, 59, 32, 36, 2, 234, 1, 10, 2, 79, 73, 202, 31, 99, 75, 7, 34, 16, 35, 101, 226, 99, 152 };
- public static string Decrypt(byte[] data)
- {
- int length = Key.Length;
- for (int x = 0; x < data.Length; x++)
- {
- data[x] ^= Key[x % length];
- data[x] ^= Key[(x * 24 % 16) % length];
- data[x] ^= Key[(x * 48 % 32) % length];
- }
- return Encoding.Default.GetString(data);
- }
- }
- }
- =================================================================================
- Server.cs
- static void GameServer_OnClientReceive(byte[] buffer, int length, ClientWrapper obj)
- {
- if (obj.Owner == null)
- {
- obj.Disconnect();
- return;
- }
- GameState Client = obj.Owner as GameState;
- if (Client.Exchange)
- {
- Client.Exchange = false;
- Client.Action = 1;
- var crypto = new Network.Cryptography.GameCryptography(Encoding.Default.GetBytes(Constants.GameCryptographyKey));
- byte[] otherData = new byte[length];
- Array.Copy(buffer, otherData, length);
- crypto.Decrypt(otherData, length);
- var ClientDataDHP = new ClientDHPacket(otherData);
- bool extra = false;
- int pos = 19 + ClientDataDHP.JunkLength + ClientDataDHP.Client_PubKey.Length + 8;
- if (pos < length)
- {
- extra = true;
- }
- string PubKey = ClientDataDHP.Client_PubKey;
- Client.Cryptography = Client.DHKeyExchange.HandleClientKeyPacket(PubKey, Client.Cryptography);
- if (extra)
- {
- byte[] data = new byte[40];
- Buffer.BlockCopy(buffer, length - 40, data, 0, 40);
- processData(data, 40, Client);
- }
- }
- else
- {
- processData(buffer, length, Client);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement