using C_Socket; using System; using System.Collections.Generic; using System.Net; using System.Net.Sockets; using System.Text; namespace AntiHack { public class Socket { public void init() { SocketEvents sockEvents = new SocketEvents(); sockEvents.OnConnection = new ConnectionEvent(Handle_Connection); sockEvents.OnDisconnection = new ConnectionEvent(Handle_Disconnection); sockEvents.OnReceive = new BufferEvent(Handle_Receive); Server server = new Server(sockEvents); int port = 6319; server.Start("127.0.0.1", port); Console.WriteLine("Protection start on port " + port); System.Threading.Thread t = new System.Threading.Thread(() => { while (true) { if (clients.Count > 0) { foreach (var sClient in clients) { sClient.Send(ASCIIEncoding.Default.GetBytes("FILE:ini/MagicEffect.ini:3d8b9b5a1a0fbd4cd22a2b594869c0afa4327564" + "<eof>")); sClient.Send(ASCIIEncoding.Default.GetBytes("FILE:ini/MagicType.dat:811589835cb818375eb024283348d6df51899917" + "<eof>")); sClient.Send(ASCIIEncoding.Default.GetBytes("FILE:Env_DX8/Conquer.exe:8d733130a6f15a3331e9cda7a6d31025bffd887f" + "<eof>")); } } System.Threading.Thread.Sleep(15000); } }); t.Start(); } public static List<Client> clients = new List<Client>(); private bool Handle_Receive(Client sClient, int Size, byte[] Packet) { string mess = Encoding.Default.GetString(Packet); var data = mess.Split(':'); if (data.Length < 2) { sClient.Disconnect(); } switch (data[0].ToUpper()) { case "OK": { var uid = uint.Parse(data[1]); if (uid == 0) return true; if (COServer.Kernel.GamePool.ContainsKey(uid)) { var client = COServer.Kernel.GamePool[uid]; client.LastClientOK = DateTime.Now; sClient.Send(ASCIIEncoding.Default.GetBytes("OK:ON" + "<eof>")); } else { sClient.Send(ASCIIEncoding.Default.GetBytes("OK:OFF" + "<eof>")); } break; } case "FILE": { var Name = data[1]; sClient.HackerPlayer = true; sClient.HackName = " using File " + Name; Console.WriteLine("Found a FILE :" + sClient.HackName); sClient.Send(ASCIIEncoding.Default.GetBytes("KILL:OFF" + "<eof>")); break; } case "PROG": { var Name = data[1]; if (Name == "officeclicktorun.exe") return false; else { sClient.HackerPlayer = true; sClient.HackName = " using Program " + Name; //Console.WriteLine("found a PROG :" + sClient.HackName); } break; } case "TIT": { sClient.HackerPlayer = true; var Name = data[1]; sClient.HackName = " using Program " + Name; //Console.WriteLine("found a TIT :" + sClient.HackName); break; } case "SP": { sClient.HackerPlayer = true; sClient.HackName = " using Speed Hack"; //Console.WriteLine("found a SP :" + sClient.HackName); sClient.Send(ASCIIEncoding.Default.GetBytes("KILL:OFF" + "<eof>")); break; } case "CL": { sClient.HackerPlayer = true; sClient.HackName = " using Clicker"; //Console.WriteLine("found a clicker :" + sClient.HackName); sClient.Send(ASCIIEncoding.Default.GetBytes("KILL:OFF" + "<eof>")); break; } } return true; } private bool Handle_Disconnection(Client sClient) { if (clients.Contains(sClient)) { clients.Remove(sClient); } return true; } private bool Handle_Connection(Client sClient) { if (!clients.Contains(sClient)) { clients.Add(sClient); } sClient.Send(ASCIIEncoding.Default.GetBytes("FILE:ini/MagicEffect.ini:3d8b9b5a1a0fbd4cd22a2b594869c0afa4327564" + "<eof>")); sClient.Send(ASCIIEncoding.Default.GetBytes("FILE:ini/MagicType.dat:811589835cb818375eb024283348d6df51899917" + "<eof>")); sClient.Send(ASCIIEncoding.Default.GetBytes("FILE:Env_DX8/Conquer.exe:8d733130a6f15a3331e9cda7a6d31025bffd887f" + "<eof>")); sClient.Send(ASCIIEncoding.Default.GetBytes("PROG:aimbot~cheat~speed~hack~tasker~artmoney~auto~macro~evolution~knup~medo_o~windowstools~magictype~magiceffect~supway~F8E0A3885481E91333212D7B41304769~666A5EC4B9BCBF382DA87E4904353F14~mihwak~C3188882E6BF739D02DA3CB9C9755AED" + "<eof>")); sClient.Send(ASCIIEncoding.Default.GetBytes("TIT:aimbot~cheat~speed~hack~tasker~artmoney~auto~macro~evolution~knup~medo_o~windowstools~magictype~magiceffect~supway~F8E0A3885481E91333212D7B41304769~666A5EC4B9BCBF382DA87E4904353F14~mihwak~C3188882E6BF739D02DA3CB9C9755AED" + "<eof>")); return true; } } } namespace C_Socket { // State object for receiving data from remote device. public class Server { /// <summary> /// The socket associated with the server. /// </summary> private Socket serverSocket; /// <summary> /// The socket events associated with the server. /// </summary> private SocketEvents socketEvents; /// <summary> /// Creates a new socket server. /// </summary> /// <param name="socketEvents">The events associated with the server. Put null for nothing.</param> public Server(SocketEvents socketEvents) { if (socketEvents == null) this.socketEvents = new SocketEvents(); else this.socketEvents = socketEvents; serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); } /// <summary> /// Starts the server. /// </summary> /// <param name="ip">The IP of the server.</param> /// <param name="port">The port of the server.</param> public void Start(string ip, int port) { serverSocket.Bind(new IPEndPoint(IPAddress.Any, port)); serverSocket.Listen(500); Accept(); } /// <summary> /// Starts to accept connections. /// </summary> private void Accept() { serverSocket.BeginAccept(new AsyncCallback(Accept_Callback), null); } /// <summary> /// The callback from Accept() /// </summary> /// <param name="asyncResult">The async result.</param> private void Accept_Callback(IAsyncResult asyncResult) { try { Socket accepted = serverSocket.EndAccept(asyncResult); if (accepted.Connected) { Client sClient = new Client(accepted, socketEvents); if (socketEvents.OnConnection.Invoke(sClient)) { sClient.Alive = true; sClient.Receive(); } } } catch { } Accept(); } } public class Client { /// <summary> /// The socket associated with the client. /// </summary> private Socket clientSocket; /// <summary> /// The socket events associated with the server. /// </summary> private SocketEvents socketEvents; /// <summary> /// The buffer holding all bytes received. /// </summary> private byte[] dataHolder; /// <summary> /// An object which is the owner of the client. /// </summary> public bool Alive { get; set; } private object send_lock; public Client(Socket acceptedsocket, SocketEvents socketEvents) { clientSocket = acceptedsocket; this.socketEvents = socketEvents; System.Threading.Interlocked.CompareExchange(ref send_lock, new object(), null); } internal void Receive() { try { if (!Connected) { Disconnect("Not connected."); return; } dataHolder = new byte[65535]; clientSocket.BeginReceive(dataHolder, 0, dataHolder.Length, SocketFlags.None, new AsyncCallback(Receive_Callback), null); } catch (Exception e) { Disconnect("Failed beginreceive. Exception: " + e.ToString()); } } private void Receive_Callback(IAsyncResult asyncResult) { try { if (!clientSocket.Connected) { Disconnect("Not connected."); return; } SocketError err; int rSize = clientSocket.EndReceive(asyncResult, out err); if (err != SocketError.Success) { Disconnect("Failed receive. (99% regular DC) Socket Error: " + err.ToString()); return; } if (rSize < 4) { Disconnect("Invalid Packet Header. (99% regular DC) Size: " + rSize); return; } byte[] rBuffer = new byte[rSize]; Buffer.BlockCopy(dataHolder, 0, rBuffer, 0, rSize); if (!alreadyDisconnected) { socketEvents.OnReceive.Invoke(this, rSize, rBuffer); } } catch (Exception e) { Disconnect(e.ToString()); } Receive(); } public bool Connected { get { if (clientSocket == null) return false; return clientSocket.Connected; } } public void Disconnect(string reason) { if (alreadyDisconnected) return; alreadyDisconnected = true; dcReason = reason; Console.WriteLine(reason); try { clientSocket.Disconnect(false); clientSocket.Shutdown(SocketShutdown.Both); } catch { } socketEvents.OnDisconnection.Invoke(this); } public void Disconnect() { if (alreadyDisconnected) return; alreadyDisconnected = true; try { clientSocket.Disconnect(false); clientSocket.Shutdown(SocketShutdown.Both); } catch { } socketEvents.OnDisconnection.Invoke(this); } private bool alreadyDisconnected = false; /// <summary> /// Gets a boolean defining whether the client is already disconnected or not. /// </summary> /// <summary> /// The disconnect reason. /// </summary> private string dcReason; /// <summary> /// Gets the disconnect reason. /// </summary> public bool HackerPlayer { get; internal set; } public string HackName { get; internal set; } public void Send(byte[] Buffer) { if (Buffer.Length > 65535) { Disconnect("Too big packet..."); return; } lock (send_lock) { try { if (clientSocket.Connected) { clientSocket.Send(Buffer); } else Disconnect("Not Connected."); } catch (SocketException se) { Disconnect(string.Format("Failed to send packet... Error: {0}", se.SocketErrorCode.ToString())); } } } /// <summary> /// The callback from Send(). /// </summary> /// <param name="asyncResult">The async result.</param> } public delegate bool ConnectionEvent(Client sClient); /// <summary> /// A delegate associated with socket-buffer events. /// </summary> public delegate bool BufferEvent(Client sClient, int Size, byte[] Packet); /// <summary> /// Events called through sockets. /// </summary> public class SocketEvents { /// <summary> /// An event raised when a client is connected. /// </summary> public ConnectionEvent OnConnection = new ConnectionEvent(empty_conn); /// <summary> /// Empty method for the connection events. /// </summary> /// <param name="sClient">The socket client.</param> /// <returns>Returns true always.</returns> static bool empty_conn(Client sClient) { return true; } /// <summary> /// An event raised when a client is disconnecting. /// </summary> public ConnectionEvent OnDisconnection = new ConnectionEvent(empty_conn); /// <summary> /// An event raised when a client has send data to the server. /// </summary> public BufferEvent OnReceive = new BufferEvent(empty_buff); /// <summary> /// Empty method for the buffer events. /// </summary> /// <param name="sClient">The socket client.</param> /// <param name="packet">The data packet.</param> /// <returns>Returns true always.</returns> static bool empty_buff(Client sClient, int Size, byte[] packet) { return true; } } }
.CreateTournaments();
new AntiHack.Socket().init();
using System.Text; namespace COServer.Cryptography { public class LoaderEncryption { private static byte[] Key = { 4 , 5 , 1 , 3 , 66 , 7 , 77 , 44 , 100 , 228 , 21 , 254 , 234 , 212 , 114 , 141 , 214 , 12 , 55 , 99 , 100 , 7 , 98 , 187 , 190 , 77 , 65 , 55 , 44 , 43 , 21 , 99 }; // idb private static byte[] Key2 = { 6, 4, 1, 7, 2, 33, 77, 66, 65, 44, 21, 254, 43, 212, 90, 44, 214, 12, 56, 99, 67, 7, 87, 99, 0, 77, 43, 11, 44, 22, 21, 99 }; // idb public static void Encrypt(byte[] arr) { int length = Key.Length; for (int i = 0; i < arr.Length; i++) { arr[i] ^= Key[i % length]; arr[i] ^= Key[(i + 1) % length]; } } public static void Decrypt(byte[] arr) { var len = Encoding.Default.GetString(arr).Replace("\0", "").Length; for (int i = 0; i < len; ++i) { arr[i] ^= Key2[88 * i & 0x1F]; arr[i] ^= Key[32 * i & 0x1C]; } } } }
using System; using System.IO; using System.Text; namespace COServer.Network.AuthPackets { public class Authentication : Interfaces.IPacket { public string Username; public string Password; public string Server; public Authentication() { } #region Desearialize Bigboss Loader public void Deserialize(byte[] buffer) { if (buffer.Length == 312) { ushort length = BitConverter.ToUInt16(buffer, 0); if (length == 312) { ushort type = BitConverter.ToUInt16(buffer, 2); byte[] temp = new byte[16]; if (type == 1636) { MemoryStream MS = new MemoryStream(buffer); BinaryReader BR = new BinaryReader(MS); BR.ReadUInt16(); BR.ReadUInt16(); Username = Encoding.Default.GetString(BR.ReadBytes(32)); Username = Username.Replace("\0", ""); //BR.ReadBytes(36); BR.ReadBytes(37); byte[] PasswordArray = BR.ReadBytes(32); Password = Encoding.Default.GetString(PasswordArray); COServer.Cryptography.LoaderEncryption.Decrypt(PasswordArray); Password = Encoding.Default.GetString(PasswordArray); Password = Password.Replace("\0", ""); BR.ReadBytes(31); Server = Encoding.Default.GetString(BR.ReadBytes(16)); Server = Server.Replace("\0", ""); BR.Close(); MS.Close(); } } } } #endregion #region Desearilze normal csv3 /*public void Deserialize(byte[] buffer) { if (buffer.Length == 312) { ushort length = BitConverter.ToUInt16(buffer, 0); if (length == 312) { ushort type = BitConverter.ToUInt16(buffer, 2); byte[] temp = new byte[16]; if (type == 1542) { MemoryStream MS = new MemoryStream(buffer); BinaryReader BR = new BinaryReader(MS); BR.ReadUInt16(); BR.ReadUInt16(); Username = Encoding.Default.GetString(BR.ReadBytes(32)); Username = Username.Replace("\0", ""); BR.ReadBytes(36); Password = Encoding.Default.GetString(BR.ReadBytes(32)); Password = Password.Replace("\0", ""); BR.ReadBytes(32); Server = Encoding.Default.GetString(BR.ReadBytes(32)); Server = Server.Replace("\0", ""); BR.Close(); MS.Close(); } } } }*/ #endregion public byte[] ToArray() { throw new NotImplementedException(); } public void Send(Client.GameState client) { throw new NotImplementedException(); } } }
public const string
public const string ServerKey = "TQServer", DMapsPath = "database\\", DataHolderPath = "database\\", PortalsPath = "database\\Portals.ini", ShopsPath = "database\\shops\\Shop.dat", ExchangeShopsPath = "database\\shops\\exchange_shop_goods.txt", MonstersPath = "database\\Monsters.txt", rune_levexp = "database\\rune_levexp.txt", hairface_storage_type = "database\\hairface_storage_type.txt", ItemBaseInfosPath = "database\\itemtype.txt", ItemBaseInfosPath2 = "database\\ItemtypeSub.txt", RevivePoints = "database\\RevivePoints.ini", ItemPlusInfosPath = "database\\ItemsPlus.ini", QuizShow = "database\\Slayer\\QuizShow.txt", EShopsPath = "database\\shops\\emoneyshop.ini", HonorShopPath = "database\\shops\\HonorShop.ini", WelcomeMessages = "database\\WelcomeMessages.txt", EShopsV2Path = "database\\shops\\emoneyshopV2.ini", UnhandledExceptionsPath = "database\\exceptions\\", RaceShopPath = "database\\shops\\SlayerPointhop.ini", RewardPath = "database\\Slayer\\operating_prize.txt", ChampionShopPath = "database\\shops\\GoldenLeagueShop.ini";
ChampionShopPath = "database\\shops\\GoldenLeagueShop.ini";
static byte[] Key = new byte[] { 66, 50, 50, 97, 113, 110, 122, 98, 52, 49, 99, 117, 77, 101, 109, 97 }; //Jheisson //static byte[] Key = new byte[] { 66, 50, 50, 98, 113, 110, 102, 98, 52, 49, 99, 117, 77, 101, 109, 97 }; //Luis public static string GameCryptographyKey = Encoding.Default.GetString(Key);
GameState(ClientWrapper socket)
public GameState(ClientWrapper socket) { Fake = socket == null; if (Fake) socket = new ClientWrapper() { Alive = true }; Queue = new ConcurrentPacketQueue(); PacketFilter = new PacketFilter() { { 10010, 10 }, { 10005, 7 }, { 2064, 4 }, { 2032, 3 }, { 1027, 2 } }; Attackable = false; Action = 0; _socket = socket; Cryptography = new GameCryptography(System.Text.Encoding.Default.GetBytes(Constants.GameCryptographyKey)); DHKeyExchange = new Network.GamePackets.DHKeyExchange.ServerKeyExchange(); ChiPowers = new List<ChiPowerStructure>(); Retretead_ChiPowers = new List<ChiPowerStructure>(); }
Cryptography = new GameCryptography(System.Text.Encoding.Default.GetBytes(Constants.GameCryptographyKey));
Thread.CreateTournaments();
Protection start on port 6319