Advertisement
XConquer

Mego Loader Para Harri

Sep 13th, 2020 (edited)
1,473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.35 KB | None | 0 0
  1. 1.- Constants.cs Buscas GameCryptographyKey y lo Reemplazas Por ->
  2. GameCryptographyKey = "XCheatLoaderMeGo",
  3. ===================================================================================
  4. 2.- Forward.cs Reemplazas la Clase Completa Por:
  5. using System.Text;
  6.  
  7. namespace COServer.Network.AuthPackets
  8. {
  9.     public unsafe class Forward : Interfaces.IPacket
  10.     {
  11.         byte[] Buffer;
  12.         public enum ForwardType : byte
  13.         {
  14.             Ready = 2,
  15.             InvalidInfo = 1,
  16.             Banned = 25,
  17.             WrongAccount = 57,
  18.             Update = 58
  19.         }
  20.         public Forward()
  21.         {
  22.             Buffer = new byte[220 + 4];
  23.             Writer.WriteUInt16(220 +4, 0, Buffer);
  24.             Writer.WriteUInt16(1637, 2, Buffer);
  25.         }
  26.         public uint Identifier
  27.         {
  28.             get { return BitConverter.ToUInt32(Buffer, 4); }
  29.             set { Writer.WriteUInt32(value, 4, Buffer); }
  30.         }
  31.         public ForwardType Type
  32.         {
  33.             get
  34.             {
  35.                 return (ForwardType)(byte)BitConverter.ToUInt32(Buffer, 12);
  36.             }
  37.             set
  38.             {
  39.                 Writer.WriteUInt32((byte)value, 12, Buffer);
  40.             }
  41.         }
  42.         public ushort Port
  43.         {
  44.  
  45.             get
  46.             {
  47.                 return BitConverter.ToUInt16(Buffer, 16);
  48.             }
  49.             set
  50.             {
  51.                 Writer.WriteUInt16(value, 16, Buffer);
  52.             }
  53.         }
  54.         public string IP
  55.         {
  56.             get
  57.             {
  58.                 return Encoding.Default.GetString(Buffer, 24, 16);
  59.             }
  60.             set
  61.             {
  62.                 Writer.WriteString(value, 24, Buffer);
  63.             }
  64.         }
  65.         public byte[] ToArray()
  66.         {
  67.             return Buffer;
  68.         }
  69.         public void Deserialize(byte[] buffer)
  70.         {
  71.  
  72.         }
  73.         public void Send(Client.GameState client)
  74.         {
  75.             client.Send(Buffer);
  76.         }
  77.     }
  78. }
  79. =========================================================================
  80. 3.- Authentication.cs Reemplazas la Clase Completa Por :
  81. using System;
  82. using COServer.Network.Cryptography;
  83. using System.Text;
  84.  
  85. namespace COServer.Network.AuthPackets
  86. {
  87.     public class Authentication
  88.     {
  89.         byte[] Buffer;
  90.         public string Username
  91.         {
  92.             get
  93.             {
  94.                 string x = Encoding.Default.GetString(Buffer, 8, 32);
  95.                 return x.Replace("\0", "");
  96.             }
  97.         }
  98.         public string Password
  99.         {
  100.             get
  101.             {
  102.                 byte[] PasswordArray = Encoding.Default.GetBytes(Encoding.Default.GetString(Buffer, 84, 32).Replace("\0", ""));
  103.                 string x = COServer.Network.Cryptography.PasswordDecryption.Decrypt(PasswordArray);
  104.                 return x.Replace("\0", "");
  105.             }
  106.         }
  107.         public string Server
  108.         {
  109.             get
  110.             {
  111.                 string x = Encoding.Default.GetString(Buffer, 136, 16);
  112.                 return x.Replace("\0", "").Replace("0", "");
  113.             }
  114.         }
  115.         public string MacAddress
  116.         {
  117.             get
  118.             {
  119.                 string x = Encoding.Default.GetString(Buffer, 152, 16);
  120.                 return x.Replace("\0", "");
  121.             }
  122.         }
  123.         public void Deserialize(byte[] buffer)
  124.         {
  125.             if (buffer.Length == 312)
  126.             {
  127.                 ushort length = BitConverter.ToUInt16(buffer, 0);
  128.                 if (length == 312)
  129.                 {
  130.                     ushort type = BitConverter.ToUInt16(buffer, 2);
  131.                     if (type == 1636)
  132.                     {
  133.                         Buffer = buffer;
  134.                     }
  135.                 }
  136.             }
  137.         }
  138.     }
  139. }
  140. ==============================================================
  141. 4.- Creas una Nueva Clase y le Pegas Esto:
  142.  
  143.  
  144. using System;
  145. using System.Collections.Generic;
  146. using System.Linq;
  147. using System.Text;
  148. using System.Threading.Tasks;
  149.  
  150. namespace COServer.Network.Cryptography
  151. {
  152.     using System.Text;
  153.     public class PasswordDecryption
  154.     {
  155.  
  156.         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 };
  157.         public static string Decrypt(byte[] data)
  158.         {
  159.             int length = Key.Length;
  160.             for (int x = 0; x < data.Length; x++)
  161.             {
  162.                 data[x] ^= Key[x % length];
  163.                 data[x] ^= Key[(x * 24 % 16) % length];
  164.                 data[x] ^= Key[(x * 48 % 32) % length];
  165.             }
  166.             return Encoding.Default.GetString(data);
  167.         }
  168.     }
  169. }
  170. =================================================================================
  171. Server.cs
  172.  
  173.  static void GameServer_OnClientReceive(byte[] buffer, int length, ClientWrapper obj)
  174.         {
  175.             if (obj.Owner == null)
  176.             {
  177.                 obj.Disconnect();
  178.                 return;
  179.             }
  180.  
  181.             GameState Client = obj.Owner as GameState;
  182.  
  183.             if (Client.Exchange)
  184.             {
  185.  
  186.                 Client.Exchange = false;
  187.                 Client.Action = 1;
  188.                 var crypto = new Network.Cryptography.GameCryptography(Encoding.Default.GetBytes(Constants.GameCryptographyKey));
  189.                 byte[] otherData = new byte[length];
  190.                 Array.Copy(buffer, otherData, length);
  191.                 crypto.Decrypt(otherData, length);
  192.                 var ClientDataDHP = new ClientDHPacket(otherData);
  193.  
  194.                 bool extra = false;
  195.                 int pos = 19 + ClientDataDHP.JunkLength + ClientDataDHP.Client_PubKey.Length + 8;
  196.                 if (pos < length)
  197.                 {
  198.                     extra = true;
  199.                 }
  200.  
  201.                 string PubKey = ClientDataDHP.Client_PubKey;
  202.                 Client.Cryptography = Client.DHKeyExchange.HandleClientKeyPacket(PubKey, Client.Cryptography);
  203.  
  204.                 if (extra)
  205.                 {
  206.                     byte[] data = new byte[40];
  207.                     Buffer.BlockCopy(buffer, length - 40, data, 0, 40);
  208.                     processData(data, 40, Client);
  209.                 }
  210.             }
  211.             else
  212.             {
  213.                 processData(buffer, length, Client);
  214.             }
  215.         }
  216.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement