public GameClient(ClientWrapper socket) { 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 DHKeyExchange.ServerKeyExchange(); }
public GameCryptography HandleClientKeyPacket(string PublicKey, GameCryptography cryptographer) { _keyExchange.HandleResponse(PublicKey); byte[] data = _keyExchange.ToBytes(); var md5 = new MD5Digest(); var firstRun = new byte[md5.GetDigestSize() * 2]; md5.BlockUpdate(data, 0, data.TakeWhile(x => x != 0).Count()); md5.DoFinal(firstRun, 0); Array.Copy(firstRun, 0, firstRun, md5.GetDigestSize(), md5.GetDigestSize()); var n = Hex.Encode(firstRun); md5.BlockUpdate(n, 0, n.Length); md5.DoFinal(firstRun, md5.GetDigestSize()); byte[] key = Hex.Encode(firstRun); cryptographer.SetKey(key); cryptographer.SetIvs(_clientIv, _serverIv); return(cryptographer); }
private void BtnSetGameCryptKey_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("This action remplace your current 'GameCryptKey' of Conquer executable file", this.ProductName, MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dr == DialogResult.OK) { string cpath = Utils.GetCurrentConquerPath(uc); if (File.Exists(cpath)) { bool isSetCryptKey = GameCryptography.SetConquerCryptographyKey(cpath, tbGameCryptographyKey.Text); if (!isSetCryptKey) { MessageBox.Show("Cannot set the key because has a error with conquer executable file or the cryptkey format!", this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Not found a conquer.exe in path: " + cpath, this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public GameClient(WinsockClient Socket) { this.Socket = Socket; SendLock = new object(); Cryptography = new GameCryptography(); Cryptography.Initialize(); Entity = new Entity(this); Screen = new Screen(this); PacketQueue = new PacketQueue(); Inventory = new List<ConquerItem>(); Profiencys = new List<LearnProfiency>(); Spells = new List<LearnSpell>(); Equipment = new Dictionary<ItemPosition, ConquerItem>(); Status = LoginStatus.Logging; }
private void BtnStart_Click(object sender, EventArgs e) { if (Configuration.SelectedUserConfiguration != null) { if (File.Exists(Configuration.SelectedUserConfiguration.NameConquerExecutable)) { // Detect correct path for SCLHook string PathSCLHook = ""; if (Configuration.SelectedUserConfiguration.ExecuteInSubFolder != "" && Directory.Exists(Configuration.SelectedUserConfiguration.ExecuteInSubFolder)) { PathSCLHook = CurrentDirectory + @"\" + Configuration.SelectedUserConfiguration.ExecuteInSubFolder + @"\" + "SCLHook.dll"; } else { PathSCLHook = CurrentDirectory + @"\SCLHook.dll"; } // Create first the config used by DLL File.WriteAllText(PathSCLHook.Replace(".dll", ".ini"), "[SCLHook]" + Environment.NewLine + "HOST=" + Configuration.SelectedUserConfiguration.Host + Environment.NewLine + "GAMEHOST=" + Configuration.SelectedUserConfiguration.Host + Environment.NewLine + "PORT=" + Configuration.SelectedUserConfiguration.LoginPort + Environment.NewLine + "GAMEPORT=" + Configuration.SelectedUserConfiguration.GamePort + Environment.NewLine + "SERVERNAME=" + Configuration.SelectedUserConfiguration.ServerName + Environment.NewLine + "ENABLE_HOSTNAME=" + Configuration.SelectedUserConfiguration.EnableHostName + Environment.NewLine + "HOSTNAME=" + Configuration.SelectedUserConfiguration.HostName + Environment.NewLine + "SERVER_VERSION=" + Configuration.SelectedUserConfiguration.Version ); // Do injection Process pConquer = new Process { StartInfo = new ProcessStartInfo { FileName = CurrentDirectory + @"\" + Configuration.SelectedUserConfiguration.NameConquerExecutable, Arguments = "blacknull" } }; if (Configuration.SelectedUserConfiguration.ExecuteInSubFolder != "" && Directory.Exists(Configuration.SelectedUserConfiguration.ExecuteInSubFolder)) { pConquer.StartInfo.FileName = CurrentDirectory + @"\" + Configuration.SelectedUserConfiguration.ExecuteInSubFolder + @"\" + Configuration.SelectedUserConfiguration.NameConquerExecutable; pConquer.StartInfo.WorkingDirectory = CurrentDirectory + @"\" + Configuration.SelectedUserConfiguration.ExecuteInSubFolder + @"\"; } if (File.Exists(pConquer.StartInfo.FileName) && File.Exists(PathSCLHook)) { // Need check cryptkey bool checkCryptKey = Configuration.SelectedUserConfiguration.GameCryptographyKey != ""; if (checkCryptKey) { // Check if have the correct conquercryptkey string cConquerCryptKey = GameCryptography.GetCurrentConquerCryptographyKey(SCLCore.Utils.GetCurrentConquerPath(Configuration.SelectedUserConfiguration)); if (Configuration.SelectedUserConfiguration.GameCryptographyKey == cConquerCryptKey) { pConquer.Start(); pConquer.EnableRaisingEvents = true; pConquer.Exited += PConquer_Exited; Configuration.CurrentConquerPId = pConquer.Id; Injector injector = new Injector(pConquer); injector.Inject("SCLHook.dll"); injector.Dispose(); btnStart.Text = "Loading..."; LaunchServerSideProtection(); SystemTray(); } else { MessageBox.Show("Error invalid ConquerCryptographyKey in Conquer.exe found!", this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { pConquer.Start(); pConquer.EnableRaisingEvents = true; pConquer.Exited += PConquer_Exited; Configuration.CurrentConquerPId = pConquer.Id; Injector injector = new Injector(pConquer); injector.Inject("SCLHook.dll"); injector.Dispose(); btnStart.Text = "Loading..."; LaunchServerSideProtection(); SystemTray(); } } else { DialogResult dRes = MessageBox.Show("Error cannot load the SCLHook.dll for inject in Conquer.exe", this.ProductName, MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (dRes == DialogResult.Retry) { this.BtnStart_Click(sender, e); } } } else { MessageBox.Show("Sorry, the conquer executable '" + Configuration.SelectedUserConfiguration.NameConquerExecutable + "' has not been found", this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }