public static void SendProofValidation(Client client, byte[] clientChallenge) { var passwordModule = client.Modules.SingleOrDefault(m => m.Name == "Password"); var selectedGameAccountModule = client.Modules.SingleOrDefault(m => m.Name == "SelectGameAccount"); var proofValidation = new AuthPacket(AuthServerMessage.ProofRequest); var moduleCount = 2; proofValidation.Write(moduleCount, 3); /// Password module Manager.ModuleMgr.WriteModuleHeader(client, proofValidation, passwordModule, 161); // State proofValidation.Flush(); proofValidation.Write(PasswordModuleState.ValidateProof, 8); // Data proofValidation.Write(client.Session.SecureRemotePassword.ServerM); proofValidation.Write(client.Session.SecureRemotePassword.S2); /// SelectGameAccount module if (client.Session.GameAccounts.Count > 1) { var gameAccountBuffer = new AuthPacket(); gameAccountBuffer.Write(0, 8); gameAccountBuffer.Write(client.Session.GameAccounts.Count, 8); client.Session.GameAccounts.ForEach(ga => { gameAccountBuffer.Write(ga.Region, 8); gameAccountBuffer.WriteString(ga.Game + ga.Index, 8, false); }); gameAccountBuffer.Finish(); Manager.ModuleMgr.WriteModuleHeader(client, proofValidation, selectedGameAccountModule, gameAccountBuffer.Data.Length); // Data proofValidation.Write(gameAccountBuffer.Data); } else { Manager.ModuleMgr.WriteRiskFingerprint(client, proofValidation); } client.SendPacket(proofValidation); }
public static void SendProofVerification(AuthSession session, byte[] clientChallenge) { var proofVerification = new AuthPacket(AuthServerMessage.ProofRequest); proofVerification.Write(2, 3); session.Modules.ForEach(module => { var moduleStart = module.Hash.Substring(0, 2); switch (moduleStart) { case "2e": case "85": case "20": proofVerification.WriteFourCC("auth"); proofVerification.WriteFourCC("\0\0EU"); proofVerification.Write(module.Hash.ToByteArray()); proofVerification.Write(161, 10); // Flush & write the state id proofVerification.Flush(); proofVerification.Write(3, 8); proofVerification.Write(session.SecureRemotePassword.ServerM); proofVerification.Write(session.SecureRemotePassword.S2); break; case "5e": case "8c": case "1a": proofVerification.WriteFourCC("auth"); proofVerification.WriteFourCC("\0\0EU"); proofVerification.Write(module.Hash.ToByteArray()); proofVerification.Write(module.Size, 10); break; default: Log.Message(LogType.Error, "Module '{0}' not used in this state", moduleStart); break; } }); session.Send(proofVerification); }
public override void WriteData(AuthPacket packet) { packet.Flush(); packet.Write(State, 8); if (State == PasswordModuleState.ServerChallenge) { packet.Write(SecureRemotePassword.I); packet.Write(SecureRemotePassword.S); packet.Write(SecureRemotePassword.B); packet.Write(SecureRemotePassword.S2); } else if (State == PasswordModuleState.ValidateProof) { packet.Write(SecureRemotePassword.ServerM); packet.Write(SecureRemotePassword.S2); } }
public static void OnRealmUpdate(AuthPacket packet, AuthSession session) { Log.Message(LogType.Debug, "Received realm update."); var complete = new AuthPacket(AuthServerMessage.Complete, AuthChannel.WoW); complete.Flush(); complete.Write(0, 8); var realmCounter = 0; foreach (var realm in Manager.Realms.RealmList) { var realmlist = new AuthPacket(AuthServerMessage.RealmUpdate, AuthChannel.WoW); realmlist.Write(true, 1); realmlist.Write(1, 32); realmlist.Write(0f, 32); realmlist.Write(realm.Value.Flags, 8); realmlist.Write(realm.Value.Id, 19); realmlist.Write(0x80000000 + realm.Value.Type, 32); realmlist.WriteString(realm.Value.Name, 10, false); realmlist.Write(false, 1); realmlist.Write(realm.Value.Status, 8); realmlist.Write(0, 12); realmlist.Write(0, 8); realmlist.Write(0, 32); realmlist.Write(++realmCounter, 8); // End realmlist.Flush(); realmlist.Write(new byte[] { 0x43, 0x02 }); realmlist.Finish(); complete.Write(realmlist.Data); } session.Send(complete); }
public static void SendProofRequest(Client client) { var session = client.Session; client.Modules = Manager.ModuleMgr.Modules.Where(m => m.System == client.OS); var thumbprintModule = client.Modules.SingleOrDefault(m => m.Name == "Thumbprint"); var passwordModule = client.Modules.SingleOrDefault(m => m.Name == "Password"); var proofRequest = new AuthPacket(AuthServerMessage.ProofRequest); // Send two modules (Thumbprint & Password). proofRequest.Write(2, 3); /// Thumbprint module Manager.ModuleMgr.WriteModuleHeader(client, proofRequest, thumbprintModule); // Data proofRequest.Write(thumbprintModule.Data.ToByteArray()); session.SecureRemotePassword = new SRP6a(session.Account.Salt, session.Account.Email, session.Account.PasswordVerifier); session.SecureRemotePassword.CalculateB(); /// Password module Manager.ModuleMgr.WriteModuleHeader(client, proofRequest, passwordModule); // State proofRequest.Flush(); proofRequest.Write(PasswordModuleState.ServerChallenge, 8); // Data proofRequest.Write(session.SecureRemotePassword.I); proofRequest.Write(session.SecureRemotePassword.S); proofRequest.Write(session.SecureRemotePassword.B); proofRequest.Write(session.SecureRemotePassword.S2); client.SendPacket(proofRequest); }
public static void OnRealmUpdate(AuthPacket packet, Client client) { Log.Message(LogType.Debug, "Received realm update."); var complete = new AuthPacket(AuthServerMessage.RealmComplete, AuthChannel.WoW); complete.Flush(); complete.Write(0, 8); var realmCounter = 0; foreach (var realm in Manager.RealmMgr.RealmList) { var realmlist = new AuthPacket(AuthServerMessage.RealmUpdate, AuthChannel.WoW); realmlist.Write(true, 1); realmlist.Write(1, 32); realmlist.Write(0f, 32); realmlist.Write(realm.Value.Flags, 8); realmlist.Write(realm.Value.Id, 19); realmlist.Write(0x80000000 + realm.Value.Type, 32); realmlist.WriteString(realm.Value.Name, 10, false); realmlist.Write(false, 1); realmlist.Write(realm.Value.Status, 8); realmlist.Write(0, 12); realmlist.Write(0, 8); realmlist.Write(0, 32); realmlist.Write(++realmCounter, 8); // End realmlist.Write(new byte[] { 0x43, 0x02 }); realmlist.Finish(); complete.Write(realmlist.Data); } client.SendPacket(complete); }
public static void OnJoinRequest(AuthPacket packet, AuthSession session) { var clientSalt = BitConverter.GetBytes(packet.Read <uint>(32)); var serverSalt = new byte[0].GenerateRandomKey(4); session.GenerateSessionKey(clientSalt, serverSalt); // Continue if sessionKey is not empty if (session.Account.SessionKey != "") { var joinResponse = new AuthPacket(AuthServerMessage.JoinResponse, AuthChannel.WoW); joinResponse.Write(Manager.Realms.RealmList.Count == 0, 1); joinResponse.Write(BitConverter.ToUInt32(serverSalt, 0), 32); joinResponse.Write(Manager.Realms.RealmList.Count * 2, 5); foreach (var realm in Manager.Realms.RealmList) { var ip = IPAddress.Parse(realm.Value.IP).GetAddressBytes(); var port = BitConverter.GetBytes(realm.Value.Port); Array.Reverse(port); joinResponse.Write(ip); joinResponse.Write(port); joinResponse.Write(ip); joinResponse.Write(port); } joinResponse.Flush(); joinResponse.Write(0, 5); session.Send(joinResponse); } }
public static void SendProofValidation(Client client, byte[] clientChallenge) { var passwordModule = client.Modules.SingleOrDefault(m => m.Name == "Password"); var selectedGameAccountModule = client.Modules.SingleOrDefault(m => m.Name == "SelectGameAccount"); var proofValidation = new AuthPacket(AuthServerMessage.ProofRequest); var moduleCount = 2; proofValidation.Write(moduleCount, 3); /// Password module Manager.ModuleMgr.WriteModuleHeader(client, proofValidation, passwordModule, 161); // State proofValidation.Flush(); proofValidation.Write(PasswordModuleState.ValidateProof, 8); // Data proofValidation.Write(client.Session.SecureRemotePassword.ServerM); proofValidation.Write(client.Session.SecureRemotePassword.S2); /// SelectGameAccount module if (client.Session.GameAccounts.Count > 1) { var gameAccountBuffer = new AuthPacket(); gameAccountBuffer.Write(0, 8); gameAccountBuffer.Write(client.Session.GameAccounts.Count, 8); client.Session.GameAccounts.ForEach(ga => { gameAccountBuffer.Write(ga.Region, 8); gameAccountBuffer.WriteString(ga.Game + ga.Index, 8, false); }); gameAccountBuffer.Finish(); Manager.ModuleMgr.WriteModuleHeader(client, proofValidation, selectedGameAccountModule, gameAccountBuffer.Data.Length); // Data proofValidation.Write(gameAccountBuffer.Data); } else Manager.ModuleMgr.WriteRiskFingerprint(client, proofValidation); client.SendPacket(proofValidation); }
public static void SendProofValidation(AuthSession session, byte[] clientChallenge) { var passwordModule = session.Modules.SingleOrDefault(m => m.Name == "Password"); var riskFingerprintModule = session.Modules.SingleOrDefault(m => m.Name == "RiskFingerprint"); var proofValidation = new AuthPacket(AuthServerMessage.ProofRequest); // Send two modules (Password & RiskFingerprint). proofValidation.Write(2, 3); /// Password module Manager.Module.WriteModuleHeader(session, proofValidation, passwordModule, 161); // State proofValidation.Flush(); proofValidation.Write(PasswordModuleState.ValidateProof, 8); // Data proofValidation.Write(session.SecureRemotePassword.ServerM); proofValidation.Write(session.SecureRemotePassword.S2); /// RiskFingerprint module Manager.Module.WriteModuleHeader(session, proofValidation, riskFingerprintModule); session.Send(proofValidation); }
public static void SendProofRequest(AuthSession session) { // Default modules are Win64 session.Modules = Manager.Modules.Module64List; // Switch module list for different systems if (session.Account.OS == "Win") { session.Modules = Manager.Modules.ModuleList; } else if (session.Account.OS == "Mc64") { session.Modules = Manager.Modules.ModuleMacList; } var proofRequest = new AuthPacket(AuthServerMessage.ProofRequest); proofRequest.Write(2, 3); session.Modules.ForEach(module => { var moduleStart = module.Hash.Substring(0, 2); switch (moduleStart) { case "36": case "c3": case "b3": proofRequest.WriteFourCC("auth"); proofRequest.WriteFourCC("\0\0EU"); proofRequest.Write(module.Hash.ToByteArray()); proofRequest.Write(module.Size, 10); proofRequest.Write(module.Data.ToByteArray()); break; case "2e": case "85": case "20": session.SecureRemotePassword = new SRP6a(session.Account.Salt, session.Account.Email, session.Account.PasswordVerifier); session.SecureRemotePassword.CalculateB(); proofRequest.WriteFourCC("auth"); proofRequest.WriteFourCC("\0\0EU"); proofRequest.Write(module.Hash.ToByteArray()); proofRequest.Write(module.Size, 10); // Flush & write the state id proofRequest.Flush(); proofRequest.Write(0, 8); proofRequest.Write(session.SecureRemotePassword.I); proofRequest.Write(session.SecureRemotePassword.S); proofRequest.Write(session.SecureRemotePassword.B); proofRequest.Write(session.SecureRemotePassword.S2); break; default: Log.Message(LogType.Error, "Module '{0}' not used in this state", moduleStart); break; } }); session.Send(proofRequest); }