private ClientInformation(PacketIn packet) { try { ProtocolVersion = packet.ReadByte(); var claimedRemainingLength = packet.ReadUInt16(); if (packet.RemainingLength != claimedRemainingLength) { Log.Warn(WCell_Core.Auth_Logon_with_invalid_length, claimedRemainingLength, packet.RemainingLength); } var clientInstallationType = packet.ReadFourCC(); _clientInstallationType = ClientTypeUtility.Lookup(clientInstallationType); Version = new ClientVersion(packet.ReadBytes(5)); Architecture = packet.ReadFourCC().TrimEnd('\0'); OS = packet.ReadFourCC().TrimEnd('\0'); var locale = packet.ReadFourCC(); _locale = ClientLocaleUtility.Lookup(locale); TimeZone = BitConverter.ToUInt32(packet.ReadBytes(4), 0); IPAddress = new XmlIPAddress(packet.ReadBytes(4)); Log.Info(WCell_Core.ClientInformationFourCCs, ProtocolVersion, ClientInstallationType, Version, Architecture, OS, Locale, TimeZone, IPAddress); } catch { } }
/// <summary> /// Checks if the client's proof matches our proof. /// </summary> /// <param name="packet">the packet to read from</param> /// <returns>true if the client proof matches; false otherwise</returns> public bool IsClientProofValid(PacketIn packet) { m_srp.PublicEphemeralValueA = packet.ReadBigInteger(32); BigInteger proof = packet.ReadBigInteger(20); // SHA1 of PublicEphemeralValueA and the 16 random bytes sent in // AUTH_LOGON_CHALLENGE from the server byte[] arr = packet.ReadBytes(20); byte keyCount = packet.ReadByte(); for (int i = 0; i < keyCount; i++) { ushort keyUnk1 = packet.ReadUInt16(); uint keyUnk2 = packet.ReadUInt32(); byte[] keyUnkArray = packet.ReadBytes(4); // sha of the SRP's PublicEphemeralValueA, PublicEphemeralValueB, // and 20 unknown bytes byte[] keyUnkSha = packet.ReadBytes(20); } byte securityFlags = packet.ReadByte(); if ((securityFlags & 1) != 0) { // PIN byte[] pinRandom = packet.ReadBytes(16); byte[] pinSha = packet.ReadBytes(20); } if ((securityFlags & 2) != 0) { byte[] security2Buf = packet.ReadBytes(20); } if ((securityFlags & 4) != 0) { byte arrLen = packet.ReadByte(); byte[] security4Buf = packet.ReadBytes(arrLen); } return m_srp.IsClientProofValid(proof); }
private static void ReadUnknownDataFromPacket(PacketIn packet, byte unkFlags) { if ((unkFlags & 2) != 0) { packet.ReadFloat(); packet.ReadFloat(); packet.ReadByte(); // here the client appends a MSG_MOVE_STOP movement packet } }