diff --git a/WowPacketParser/App.config b/WowPacketParser/App.config index 9dd72fef95..c52a0a1ce8 100644 --- a/WowPacketParser/App.config +++ b/WowPacketParser/App.config @@ -105,6 +105,8 @@ 13: Binary (.pkt) merge output in a file (fusion.pkt) 14: UniversalProto (.dat) 15: UniversalProto with text (.dat) + 16: UniversalProto with separate text (.dat) + 17: SanitizedPkt (.pkt) removes personal data (e.g. guid, realmid, chat message, guild, name, ...) and dumps a new pkt (_sanitized.pkt) --> diff --git a/WowPacketParser/Enums/DumpFormatType.cs b/WowPacketParser/Enums/DumpFormatType.cs index e5d8ac382e..fef4024f81 100644 --- a/WowPacketParser/Enums/DumpFormatType.cs +++ b/WowPacketParser/Enums/DumpFormatType.cs @@ -18,6 +18,7 @@ public enum DumpFormatType Fusion, UniversalProto, UniversalProtoWithText, - UniversalProtoWithSeparateText + UniversalProtoWithSeparateText, + SanitizedPkt } } diff --git a/WowPacketParser/Loading/BinaryPacketReader.cs b/WowPacketParser/Loading/BinaryPacketReader.cs index b70de3c8d7..d3d8d9407e 100644 --- a/WowPacketParser/Loading/BinaryPacketReader.cs +++ b/WowPacketParser/Loading/BinaryPacketReader.cs @@ -30,11 +30,14 @@ enum PktVersion private int _snifferId; private short _snifferVersion; + private byte[] FileHeader; + public BinaryPacketReader(SniffType type, string fileName, Encoding encoding) { _sniffType = type; _reader = new BinaryReader(new FileStream(@fileName, FileMode.Open, FileAccess.Read, FileShare.Read), encoding); ReadHeader(); + StoreFileHeader(); } void ReadHeader() @@ -125,6 +128,16 @@ void ReadHeader() } } + void StoreFileHeader() + { + // all data till this position belong to the sniffFile header + // store the end position of the header + // then reset it to 0 and simply store the whole header again as byte[] + var currentPosition = _reader.BaseStream.Position; + _reader.BaseStream.Position = 0; + FileHeader = _reader.ReadBytes((int)currentPosition); + } + static void SetBuild(uint build) { ClientVersion.SetVersion((ClientVersionBuild)build); @@ -149,8 +162,13 @@ public Packet Read(int number, string fileName) byte[] data; StringBuilder writer = null; int cIndex = 0; + byte[] header; IPEndPoint endPoint = null; // Only used in PKT3.1 by TC's PacketLogger + // Note: PacketHeader ends before data + var packetHeaderStartPosition = _reader.BaseStream.Position; + long packetHeaderEndPosition = 0; + if (_sniffType == SniffType.Pkt) { switch (_pktVersion) @@ -166,11 +184,13 @@ public Packet Read(int number, string fileName) if (direction == Direction.ServerToClient) { opcode = _reader.ReadInt16(); + packetHeaderEndPosition = _reader.BaseStream.Position; data = _reader.ReadBytes(length - 2); } else { opcode = _reader.ReadInt32(); + packetHeaderEndPosition = _reader.BaseStream.Position; data = _reader.ReadBytes(length - 4); } @@ -256,6 +276,7 @@ public Packet Read(int number, string fileName) _reader.ReadBytes(additionalSize); opcode = _reader.ReadInt32(); + packetHeaderEndPosition = _reader.BaseStream.Position; data = _reader.ReadBytes(length - 4); break; } @@ -265,6 +286,7 @@ public Packet Read(int number, string fileName) length = _reader.ReadInt32(); direction = (Direction)_reader.ReadByte(); time = Utilities.GetDateTimeFromUnixTime(_reader.ReadInt64()); + packetHeaderEndPosition = _reader.BaseStream.Position; data = _reader.ReadBytes(length); break; } @@ -276,6 +298,7 @@ public Packet Read(int number, string fileName) length = _reader.ReadInt32(); time = Utilities.GetDateTimeFromUnixTime(_reader.ReadInt32()); direction = (Direction)_reader.ReadByte(); + packetHeaderEndPosition = _reader.BaseStream.Position; data = _reader.ReadBytes(length); } @@ -286,6 +309,15 @@ public Packet Read(int number, string fileName) ClientVersion.SetVersion(time); } + // store the end position of the packet so we can return here + var packetEndPosition = _reader.BaseStream.Position; + + // go back to packetHeaderStartPosition + _reader.BaseStream.Position = packetHeaderStartPosition; + // store all bytes till packetHeaderEndPosition, because its the header + header = _reader.ReadBytes((int)(packetHeaderEndPosition - packetHeaderStartPosition)); + // go back to end of packet + _reader.BaseStream.Position = packetEndPosition; // ignore opcodes that were not "decrypted" (usually because of // a missing session key) (only applicable to 335 or earlier) if (opcode >= 1312 && (ClientVersion.Build <= ClientVersionBuild.V3_3_5a_12340 && ClientVersion.Build != ClientVersionBuild.Zero)) @@ -294,7 +326,8 @@ public Packet Read(int number, string fileName) return new Packet(data, opcode, time, direction, number, writer, Path.GetFileName(fileName)) { ConnectionIndex = cIndex, - EndPoint = endPoint + EndPoint = endPoint, + Header = header }; } @@ -308,6 +341,11 @@ public long GetCurrentSize() return _reader?.BaseStream.Position ?? 0; } + public byte[] GetFileHeader() + { + return FileHeader; + } + public void Dispose() { if (_reader == null) return; diff --git a/WowPacketParser/Loading/IPacketReader.cs b/WowPacketParser/Loading/IPacketReader.cs index c8ef231388..7d4c8d545d 100644 --- a/WowPacketParser/Loading/IPacketReader.cs +++ b/WowPacketParser/Loading/IPacketReader.cs @@ -9,5 +9,6 @@ public interface IPacketReader : IDisposable Packet Read(int number, string fileName); long GetTotalSize(); long GetCurrentSize(); + byte[] GetFileHeader(); } } diff --git a/WowPacketParser/Loading/SniffFile.cs b/WowPacketParser/Loading/SniffFile.cs index fe23ffffc9..867b0e7fbd 100644 --- a/WowPacketParser/Loading/SniffFile.cs +++ b/WowPacketParser/Loading/SniffFile.cs @@ -36,6 +36,8 @@ public class SniffFile private readonly List _skippedHeaders = new List(); private readonly List _noStructureHeaders = new List(); + private static byte _xorSeed; + public SniffFile(string fileName, DumpFormatType dumpFormat = DumpFormatType.Text, Tuple number = null) { if (string.IsNullOrWhiteSpace(fileName)) @@ -472,6 +474,137 @@ private void ProcessFileImpl() FusionDump(packets); break; } + case DumpFormatType.SanitizedPkt: + { + List packetList = new List(); + + Random rnd = new Random(); + _xorSeed = (byte)rnd.Next(1, 255); + + var outFileName = Path.ChangeExtension(FileName, null) + "_sanitized.pkt"; + + if (Utilities.FileIsInUse(outFileName)) + { + Trace.WriteLine($"Save file {outFileName} is in use, parsing will not be done."); + break; + } + File.Delete(outFileName); + + _stats.SetStartTime(DateTime.Now); + + var threadCount = Settings.Threads; + if (threadCount == 0) + threadCount = Environment.ProcessorCount; + + ThreadPool.SetMinThreads(threadCount + 2, 4); + + var written = false; + var firstRead = true; + + var reader = _compression != FileCompression.None ? new Reader(_tempName, _sniffType) : new Reader(FileName, _sniffType); + + var pwp = new ParallelWorkProcessor(() => // read + { + if (!reader.PacketReader.CanRead()) + return Tuple.Create(null, true); + + Packet packet; + var b = reader.TryRead(out packet); + + if (firstRead) + { + Trace.WriteLine( + $"{_logPrefix}: Parsing {Utilities.BytesToString(reader.PacketReader.GetTotalSize())} of packets. Detected version {ClientVersion.VersionString}"); + + firstRead = false; + } + + return Tuple.Create(packet, b); + }, packet => // parse + { + // We have to parse the packets and then modify them + if (packet.Direction == Direction.BNClientToServer || + packet.Direction == Direction.BNServerToClient) + BattlenetHandler.ParseBattlenet(packet); + else + Handler.Parse(packet); // Attribute in handlers affect the Readers to write instead of read + + // Update statistics + _stats.AddByStatus(packet.Status); + return packet; + }, + packet => // write + { + ShowPercentProgress("Processing...", reader.PacketReader.GetCurrentSize(), reader.PacketReader.GetTotalSize()); + + if (!packet.Status.HasAnyFlag(Settings.OutputFlag) || !packet.WriteToFile) + { + packet.ClosePacket(); + return; + } + + written = true; + + // get packet header if necessary + if (Settings.LogPacketErrors) + { + switch (packet.Status) + { + case ParsedStatus.WithErrors: + _withErrorHeaders.Add(packet.GetHeader()); + break; + case ParsedStatus.NotParsed: + _skippedHeaders.Add(packet.GetHeader()); + break; + case ParsedStatus.NoStructure: + _noStructureHeaders.Add(packet.GetHeader()); + break; + } + } + + // we can't sanitize stuff we can't read + switch (packet.Status) + { + case ParsedStatus.WithErrors: + _withErrorHeaders.Add(packet.GetHeader()); + packet.ClosePacket(); + return; + case ParsedStatus.NotParsed: + _skippedHeaders.Add(packet.GetHeader()); + packet.ClosePacket(); + return; + case ParsedStatus.NoStructure: + _noStructureHeaders.Add(packet.GetHeader()); + packet.ClosePacket(); + return; + } + + // add packet to out list + packetList.Add(packet); + }, threadCount); + + pwp.WaitForFinished(Timeout.Infinite); + + reader.PacketReader.Dispose(); + + _stats.SetEndTime(DateTime.Now); + + if (written) + Trace.WriteLine($"{_logPrefix}: Saved file to '{outFileName}'"); + else + { + Trace.WriteLine($"{_logPrefix}: No file produced"); + File.Delete(outFileName); + } + + Trace.WriteLine($"{_logPrefix}: {_stats}"); + + SanitizedDump(outFileName, reader.PacketReader.GetFileHeader(), packetList); + + GC.Collect(); // Force a GC collect after parsing a file. It seems to help. + + break; + } default: { Trace.WriteLine($"{_logPrefix}: Dump format is none, nothing will be processed."); @@ -560,6 +693,12 @@ private void BinaryDump(string fileName, ICollection packets) BinaryPacketWriter.Write(SniffType.Pkt, fileName, Encoding.ASCII, packets); } + private void SanitizedDump(string fileName, byte[] fileHeader, ICollection packets) + { + Trace.WriteLine($"{_logPrefix}: Copying {packets.Count} packets to .pkt format..."); + SanitizedBinaryPacketWriter.Write(SniffType.Pkt, fileName, Encoding.ASCII, fileHeader, packets); + } + private void WriteSQLs() { var sqlFileName = string.IsNullOrWhiteSpace(Settings.SQLFileName) ? $"{Utilities.FormattedDateTimeForFiles()}_{Path.GetFileName(FileName)}.sql" : Settings.SQLFileName; @@ -658,5 +797,10 @@ private string GetCompressedFileName() { return FileName + _compression.GetExtension(); } + + public static byte GetXORSeed() + { + return _xorSeed; + } } } diff --git a/WowPacketParser/Loading/SqLitePacketReader.cs b/WowPacketParser/Loading/SqLitePacketReader.cs index cf5a993f3d..4b0ad8764e 100644 --- a/WowPacketParser/Loading/SqLitePacketReader.cs +++ b/WowPacketParser/Loading/SqLitePacketReader.cs @@ -63,6 +63,11 @@ public long GetTotalSize() return _count; } + public byte[] GetFileHeader() + { + return new byte[0]; + } + public void Dispose() { if (_reader != null) diff --git a/WowPacketParser/Misc/Packet.cs b/WowPacketParser/Misc/Packet.cs index cddd17b70a..5ca6f1bb8f 100644 --- a/WowPacketParser/Misc/Packet.cs +++ b/WowPacketParser/Misc/Packet.cs @@ -33,6 +33,7 @@ public Packet(byte[] input, int opcode, DateTime time, Direction direction, int FileName = fileName; Status = ParsedStatus.None; WriteToFile = true; + BinaryWriter = new BinaryWriter(BaseStream); if (number == 0) _firstPacketTime = Time; @@ -54,6 +55,20 @@ public Packet(byte[] input, int opcode, DateTime time, Direction direction, int public Packet(byte[] input, int opcode, DateTime time, Direction direction, int number, string fileName) : this(input, opcode, time, direction, number, null, fileName) { + Opcode = opcode; + Time = time; + Direction = direction; + Number = number; + Writer = null; + FileName = fileName; + Status = ParsedStatus.None; + WriteToFile = true; + BinaryWriter = new BinaryWriter(BaseStream); + + if (number == 0) + _firstPacketTime = Time; + + TimeSpan = Time - _firstPacketTime; } public int Opcode { get; set; } // setter can't be private because it's used in multiple_packets @@ -67,6 +82,8 @@ public Packet(byte[] input, int opcode, DateTime time, Direction direction, int public bool WriteToFile { get; private set; } public int ConnectionIndex { get; set; } public IPEndPoint EndPoint { get; set; } + public byte[] Header { get; set; } + public BinaryWriter BinaryWriter { get; } public PacketHolder Holder { get; set; } diff --git a/WowPacketParser/Misc/PacketReads.cs b/WowPacketParser/Misc/PacketReads.cs index b460c35654..8760d24674 100644 --- a/WowPacketParser/Misc/PacketReads.cs +++ b/WowPacketParser/Misc/PacketReads.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.IO; using System.Linq; using System.Net; using System.Runtime.InteropServices; using System.Text; using WowPacketParser.Enums; +using WowPacketParser.Loading; namespace WowPacketParser.Misc { @@ -33,8 +35,12 @@ public WowGuid ReadPackedGuid128() { var guidLowMask = ReadByte(); var guidHighMask = ReadByte(); + WowGuid128 guid; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + guid = new WowGuid128(ReadPackedUInt64_Sanitize(guidLowMask, true, true), ReadPackedUInt64_Sanitize(guidHighMask, true)); + else + guid = new WowGuid128(ReadPackedUInt64(guidLowMask), ReadPackedUInt64(guidHighMask)); - var guid = new WowGuid128(ReadPackedUInt64(guidLowMask), ReadPackedUInt64(guidHighMask)); if (WriteToFile) WriteToFile = Filters.CheckFilter(guid); @@ -761,5 +767,358 @@ private static string GetIndexString(params object[] values) return current + (s[0] + value.ToString() + s[1] + ' '); }); } + +#region Sanitizing + public byte ReadByte_Sanitize(string name, params object[] indexes) + { + byte val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadByte(); + AddValue(name, FormatInteger(val), indexes); + return val; + } + + public sbyte ReadSByte_Sanitize(string name, params object[] indexes) + { + sbyte val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadSByte(); + AddValue(name, FormatInteger(val), indexes); + return val; + } + + public short ReadInt16_Sanitize(string name, params object[] indexes) + { + short val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadInt16(); + AddValue(name, FormatInteger(val), indexes); + return val; + } + + public ushort ReadUInt16_Sanitize(string name, params object[] indexes) + { + ushort val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadUInt16(); + AddValue(name, FormatInteger(val), indexes); + return val; + } + + public float ReadSingle_Sanitize(string name, params object[] indexes) + { + float val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadSingle(); + AddValue(name, FormatFloat(val), indexes); + return val; + } + + public double ReadDouble_Sanitize(string name, params object[] indexes) + { + double val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadDouble(); + AddValue(name, FormatFloat(val), indexes); + return val; + } + + public int ReadInt32_Sanitize(string name, params object[] indexes) + { + int val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadInt32(); + AddValue(name, FormatInteger(val), indexes); + return val; + } + + public uint ReadUInt32_Sanitize(string name, params object[] indexes) + { + uint val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadUInt32(); + AddValue(name, FormatInteger(val), indexes); + return val; + } + + public long ReadInt64_Sanitize(string name, params object[] indexes) + { + long val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadInt64(); + AddValue(name, FormatInteger(val), indexes); + return val; + } + + public ulong ReadUInt64_Sanitize(string name, params object[] indexes) + { + ulong val = 0; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + BinaryWriter.Write(val); + } + else + val = ReadUInt64(); + AddValue(name, FormatInteger(val), indexes); + return val; + } + + public WowGuid ReadGuid_Sanitize(string name, params object[] indexes) + { + // TODO: Create sanitize ReadGuid() function which generates a new guid an replaces all -> store original and replacement in a map + return AddValue(name, ReadGuid(), indexes); + } + public string ReadWoWString_Sanitize(int len) + { + Encoding encoding = Encoding.UTF8; + byte[] bytes; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + var str = new string('X', len); + BinaryWriter.Write(encoding.GetBytes(str)); + return str; + } + else + bytes = ReadBytes(len).Where(b => b != 0).ToArray(); + + string s = encoding.GetString(bytes); + return s; + } + + public string ReadWoWString_Sanitize(string name, int len, params object[] indexes) + { + return AddValue(name, ReadWoWString_Sanitize(len), indexes); + } + + public string ReadWoWString_Sanitize(string name, uint len, params object[] indexes) + { + return AddValue(name, ReadWoWString_Sanitize((int)len), indexes); + } + + public string ReadDynamicString_Sanitize(int len) + { + if (len == 1) + return string.Empty; + + return ReadWoWString_Sanitize(len); + } + + public string ReadDynamicString_Sanitize(string name, int len, params object[] indexes) + { + return AddValue(name, ReadDynamicString_Sanitize(len), indexes); + } + + public string ReadDynamicString_Sanitize(string name, uint len, params object[] indexes) + { + return AddValue(name, ReadDynamicString_Sanitize((int)len), indexes); + } + + public string ReadCString_Sanitize(Encoding encoding) + { + var bytes = new List(); + + byte b; + // store position of BaseStream so we can jump back when writing + var startPosition = BaseStream.Position; + + while (CanRead() && (b = ReadByte()) != 0) // CDataStore::GetCString calls CanRead too + bytes.Add(b); + + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + // jump back before Read + BaseStream.Position = startPosition; + // replace CString by X with same length + var str = new string('X', bytes.Count); + BinaryWriter.Write(encoding.GetBytes(str)); + return str; + } + + return encoding.GetString(bytes.ToArray()); + } + + public string ReadCString_Sanitize() + { + return ReadCString_Sanitize(Encoding.UTF8); + } + + public string ReadCString_Sanitize(string name, params object[] indexes) + { + return AddValue(name, ReadCString_Sanitize(), indexes); + } + + public WowGuid ReadPackedGuid_Sanitize(string name, params object[] indexes) + { + // TODO: Create sanitize ReadPackedGuid() function which generates a new guid an replaces all -> store original and replacement in a map + return AddValue(name, ReadPackedGuid(), indexes); + } + + private ulong ReadPackedUInt64_Sanitize(byte mask, bool guid = false, bool xor = false) + { + if (mask == 0) + return 0; + + ulong res = 0; + + int i = 0; + while (i < 8) + { + if ((mask & 1 << i) != 0) + { + byte val = 0; + if (guid) + { + // packed uint64 contains RealmID in this range + if (!xor && (i >= 5 && i <= 6)) + { + BinaryWriter.Write(val); + res += (ulong)val << (i * 8); + } + else if (xor) + { + var position = BaseStream.Position; + + byte original = ReadByte(); + val = (byte)(original ^ SniffFile.GetXORSeed()); + res += (ulong)val << (i * 8); + + BaseStream.Position = position; + BinaryWriter.Write(val); + } + else + res += (ulong)ReadByte() << (i * 8); + } + else + { + BinaryWriter.Write(val); + res += (ulong)val << (i * 8); + } + } + + i++; + } + + return res; + } + + public byte[] ReadBytesString_Sanitize(string name, int length, params object[] indexes) + { + byte[] val; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + var str = new string('X', length); + val = Encoding.UTF8.GetBytes(str); + BinaryWriter.Write(val); + } + else + val = ReadBytes(length); + + AddValue(name, Encoding.UTF8.GetString(val), indexes); + return val; + } + + public byte[] ReadBytesTable_Sanitize(string name, int length, params object[] indexes) + { + byte[] val; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + val = new byte[length]; + BinaryWriter.Write(val); + } + else + val = ReadBytes(length); + + AddValue(name, Utilities.ByteArrayToHexTable(val, true, + GetIndexString(indexes).Length + name.Length + ": ".Length), + indexes); + return val; + } + + public byte[] ReadBytes_Sanitize(string name, int length, params object[] indexes) + { + byte[] val; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + val = new byte[length]; + BinaryWriter.Write(val); + } + else + val = ReadBytes(length); + AddValue(name, Convert.ToHexString(val), indexes); + return val; + } + + public IPAddress ReadIPAddress_Sanitize() + { + byte[] val; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + val = new byte[4]; + BinaryWriter.Write(val); + } + else + val = ReadBytes(4); + + return new IPAddress(val); + } + + public IPAddress ReadIPv6Address_Sanitize() + { + byte[] val; + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + val = new byte[16]; + BinaryWriter.Write(val); + } + else + val = ReadBytes(16); + return new IPAddress(val); + } + + public IPAddress ReadIPAddress_Sanitize(string name, params object[] indexes) + { + return AddValue(name, ReadIPAddress_Sanitize(), indexes); + } + public IPAddress ReadIPv6Address_Sanitize(string name, params object[] indexes) + { + return AddValue(name, ReadIPv6Address_Sanitize(), indexes); + } + #endregion } } diff --git a/WowPacketParser/Saving/SanitizedBinaryPacketWriter.cs b/WowPacketParser/Saving/SanitizedBinaryPacketWriter.cs new file mode 100644 index 0000000000..c143d092fd --- /dev/null +++ b/WowPacketParser/Saving/SanitizedBinaryPacketWriter.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Text; +using WowPacketParser.Enums; +using WowPacketParser.Misc; + +namespace WowPacketParser.Saving +{ + public static class SanitizedBinaryPacketWriter + { + [SuppressMessage("Microsoft.Reliability", "CA2000", Justification = "fileStream is disposed when writer is disposed.")] + public static void Write(SniffType type, string fileName, Encoding encoding, byte[] fileHeader, IEnumerable packets) + { + var fileStream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None); + using (var writer = new BinaryWriter(fileStream, encoding)) + { + writer.Write(fileHeader); + foreach (var packet in packets) + { + writer.Write(packet.Header); + writer.Write(packet.GetStream(0)); + } + } + } + } +} diff --git a/WowPacketParserModule.Substructures/MythicPlusHandler.cs b/WowPacketParserModule.Substructures/MythicPlusHandler.cs index 79572f6a8c..50085d02f7 100644 --- a/WowPacketParserModule.Substructures/MythicPlusHandler.cs +++ b/WowPacketParserModule.Substructures/MythicPlusHandler.cs @@ -41,8 +41,8 @@ public static void ReadMythicPlusMember(Packet packet, params object[] indexes) packet.ReadUInt64("GuildClubMemberID", indexes); packet.ReadPackedGuid128("GUID", indexes); packet.ReadPackedGuid128("GuildGUID", indexes); - packet.ReadUInt32("NativeRealmAddress", indexes); - packet.ReadUInt32("VirtualRealmAddress", indexes); + packet.ReadUInt32_Sanitize("NativeRealmAddress", indexes); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", indexes); if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_2_0_42423)) packet.ReadInt32("ChrSpecializationID", indexes); else diff --git a/WowPacketParserModule.V1_13_2_31446/Parsers/GuildHandler.cs b/WowPacketParserModule.V1_13_2_31446/Parsers/GuildHandler.cs index b74220c059..212ed48b42 100644 --- a/WowPacketParserModule.V1_13_2_31446/Parsers/GuildHandler.cs +++ b/WowPacketParserModule.V1_13_2_31446/Parsers/GuildHandler.cs @@ -15,7 +15,7 @@ public static void HandleGuildQueryResponse(Packet packet) if (hasData) { packet.ReadPackedGuid128("GuildGUID"); - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var rankCount = packet.ReadUInt32("RankCount"); packet.ReadInt32("EmblemColor"); packet.ReadInt32("EmblemStyle"); @@ -58,7 +58,7 @@ public static void ReadGuildRosterMemberData(Packet packet, params object[] idx) packet.ReadUInt32("Step", idx, j); } - packet.ReadUInt32("VirtualRealmAddress", idx); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", idx); packet.ReadByteE("Status", idx); packet.ReadByte("Level", idx); @@ -74,7 +74,7 @@ public static void ReadGuildRosterMemberData(Packet packet, params object[] idx) packet.ReadBit("Authenticated", idx); packet.ReadBit("SorEligible", idx); - packet.ReadWoWString("Name", nameLen, idx); + packet.ReadWoWString_Sanitize("Name", nameLen, idx); packet.ReadWoWString("Note", noteLen, idx); packet.ReadWoWString("OfficerNote", officersNoteLen, idx); } diff --git a/WowPacketParserModule.V2_5_1_38707/Parsers/AuthenticationHandler.cs b/WowPacketParserModule.V2_5_1_38707/Parsers/AuthenticationHandler.cs index 1436601f9d..03a0f74340 100644 --- a/WowPacketParserModule.V2_5_1_38707/Parsers/AuthenticationHandler.cs +++ b/WowPacketParserModule.V2_5_1_38707/Parsers/AuthenticationHandler.cs @@ -15,7 +15,7 @@ public static void HandleAuthResponse(Packet packet) var queued = packet.ReadBit("Queued"); if (ok) { - packet.ReadUInt32("VirtualRealmAddress"); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); var realms = packet.ReadUInt32(); packet.ReadUInt32("TimeRested"); packet.ReadByte("ActiveExpansionLevel"); diff --git a/WowPacketParserModule.V2_5_1_38707/Parsers/HotfixHandler.cs b/WowPacketParserModule.V2_5_1_38707/Parsers/HotfixHandler.cs index d98687831a..8292430d37 100644 --- a/WowPacketParserModule.V2_5_1_38707/Parsers/HotfixHandler.cs +++ b/WowPacketParserModule.V2_5_1_38707/Parsers/HotfixHandler.cs @@ -149,7 +149,7 @@ private static void HandleHotfixOptionalData(Packet packet, DB2Hash type, int en [Parser(Opcode.SMSG_AVAILABLE_HOTFIXES)] public static void HandleAvailableHotfixes(Packet packet) { - packet.ReadUInt32("VirtualRealmAddress"); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); var uniqueIDCount = packet.ReadUInt32("UniqueIDCount"); for (var i = 0; i < uniqueIDCount; ++i) diff --git a/WowPacketParserModule.V2_5_1_38707/Parsers/SystemHandler.cs b/WowPacketParserModule.V2_5_1_38707/Parsers/SystemHandler.cs index f97c1a5aa1..ca7d24a327 100644 --- a/WowPacketParserModule.V2_5_1_38707/Parsers/SystemHandler.cs +++ b/WowPacketParserModule.V2_5_1_38707/Parsers/SystemHandler.cs @@ -13,8 +13,8 @@ public static void HandleFeatureSystemStatus(Packet packet) packet.ReadUInt32("ScrollOfResurrectionRequestsRemaining"); packet.ReadUInt32("ScrollOfResurrectionMaxRequestsPerDay"); - packet.ReadUInt32("CfgRealmID"); - packet.ReadInt32("CfgRealmRecID"); + packet.ReadUInt32_Sanitize("CfgRealmID"); + packet.ReadInt32_Sanitize("CfgRealmRecID"); packet.ReadUInt32("MaxRecruits", "RAFSystem"); packet.ReadUInt32("MaxRecruitMonths", "RAFSystem"); packet.ReadUInt32("MaxRecruitmentUses", "RAFSystem"); diff --git a/WowPacketParserModule.V3_4_0_45166/Parsers/AccountDataHandler.cs b/WowPacketParserModule.V3_4_0_45166/Parsers/AccountDataHandler.cs index 0de471e112..0cad4072cd 100644 --- a/WowPacketParserModule.V3_4_0_45166/Parsers/AccountDataHandler.cs +++ b/WowPacketParserModule.V3_4_0_45166/Parsers/AccountDataHandler.cs @@ -10,7 +10,7 @@ public static void ReadAccountCharacterList(Packet packet, params object[] idx) { packet.ReadPackedGuid128("WowAccountGUID", idx); packet.ReadPackedGuid128("CharacterGUID", idx); - packet.ReadUInt32("VirtualRealmAddress", idx); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", idx); packet.ReadByteE("Race" ,idx); packet.ReadByteE("Class", idx); packet.ReadByteE("Gender", idx); @@ -23,8 +23,8 @@ public static void ReadAccountCharacterList(Packet packet, params object[] idx) uint characterNameLength = packet.ReadBits(6); uint realmNameLength = packet.ReadBits(9); - packet.ReadWoWString("CharacterName", characterNameLength, idx); - packet.ReadWoWString("RealmName", realmNameLength, idx); + packet.ReadWoWString_Sanitize("CharacterName", characterNameLength, idx); + packet.ReadWoWString_Sanitize("RealmName", realmNameLength, idx); } [Parser(Opcode.SMSG_GET_ACCOUNT_CHARACTER_LIST_RESULT)] diff --git a/WowPacketParserModule.V3_4_0_45166/Parsers/MiscellaneousHandler.cs b/WowPacketParserModule.V3_4_0_45166/Parsers/MiscellaneousHandler.cs index faeae87665..385a8c49ea 100644 --- a/WowPacketParserModule.V3_4_0_45166/Parsers/MiscellaneousHandler.cs +++ b/WowPacketParserModule.V3_4_0_45166/Parsers/MiscellaneousHandler.cs @@ -90,8 +90,8 @@ public static void HandleFeatureSystemStatus(Packet packet) packet.ReadUInt32("ScrollOfResurrectionRequestsRemaining"); packet.ReadUInt32("ScrollOfResurrectionMaxRequestsPerDay"); - packet.ReadUInt32("CfgRealmID"); - packet.ReadInt32("CfgRealmRecID"); + packet.ReadUInt32_Sanitize("CfgRealmID"); + packet.ReadInt32_Sanitize("CfgRealmRecID"); packet.ReadUInt32("MaxRecruits", "RAFSystem"); packet.ReadUInt32("MaxRecruitMonths", "RAFSystem"); packet.ReadUInt32("MaxRecruitmentUses", "RAFSystem"); diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/AchievementHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/AchievementHandler.cs index 83c48f6c3f..3ebbfe137e 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/AchievementHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/AchievementHandler.cs @@ -54,8 +54,8 @@ public static void ReadEarnedAchievement(Packet packet, params object[] idx) packet.ReadInt32("Id", idx); packet.ReadPackedTime("Date", idx); packet.ReadPackedGuid128("Owner", idx); - packet.ReadInt32("VirtualRealmAddress", idx); - packet.ReadInt32("NativeRealmAddress", idx); + packet.ReadInt32_Sanitize("VirtualRealmAddress", idx); + packet.ReadInt32_Sanitize("NativeRealmAddress", idx); } [Parser(Opcode.SMSG_ALL_ACCOUNT_CRITERIA)] @@ -92,8 +92,8 @@ public static void HandleAchievementEarned(Packet packet) packet.ReadPackedGuid128("Earner"); packet.ReadUInt32("AchievementID"); packet.ReadPackedTime("Time"); - packet.ReadUInt32("EarnerNativeRealm"); - packet.ReadUInt32("EarnerVirtualRealm"); + packet.ReadUInt32_Sanitize("EarnerNativeRealm"); + packet.ReadUInt32_Sanitize("EarnerVirtualRealm"); packet.ReadBit("Initial"); } diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/BattlePayHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/BattlePayHandler.cs index 450d734999..3e74a3f873 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/BattlePayHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/BattlePayHandler.cs @@ -126,8 +126,8 @@ private static void ReadBattlePayDistributionObject(Packet packet, params object packet.ReadInt32("ProductID", index); packet.ReadPackedGuid128("TargetPlayer", index); - packet.ReadInt32("TargetVirtualRealm", index); - packet.ReadInt32("TargetNativeRealm", index); + packet.ReadInt32_Sanitize("TargetVirtualRealm", index); + packet.ReadInt32_Sanitize("TargetNativeRealm", index); packet.ReadInt64("PurchaseID", index); diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/BattlePetHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/BattlePetHandler.cs index c6267aac28..b15475a6ee 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/BattlePetHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/BattlePetHandler.cs @@ -66,8 +66,8 @@ public static void ReadClientPetBattleSlot(Packet packet, params object[] idx) public static void ReadClientBattlePetOwnerInfo(Packet packet, params object[] idx) { packet.ReadPackedGuid128("Guid", idx); - packet.ReadUInt32("PlayerVirtualRealm", idx); - packet.ReadUInt32("PlayerNativeRealm", idx); + packet.ReadUInt32_Sanitize("PlayerVirtualRealm", idx); + packet.ReadUInt32_Sanitize("PlayerNativeRealm", idx); } [Parser(Opcode.SMSG_BATTLE_PET_JOURNAL)] diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/ChallengeModeHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/ChallengeModeHandler.cs index 28433fca46..8cd99d93d8 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/ChallengeModeHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/ChallengeModeHandler.cs @@ -8,7 +8,7 @@ public static class ChallengeModeHandler { public static void ReadChallengeModeAttempt(Packet packet, params object[] indexes) { - packet.ReadUInt32("InstanceRealmAddress", indexes); + packet.ReadUInt32_Sanitize("InstanceRealmAddress", indexes); packet.ReadUInt32("AttemptID", indexes); packet.ReadInt32("CompletionTime", indexes); packet.ReadPackedTime("CompletionDate", indexes); @@ -17,8 +17,8 @@ public static void ReadChallengeModeAttempt(Packet packet, params object[] index var int12 = packet.ReadUInt32("MembersCount", indexes); for (int i = 0; i < int12; i++) { - packet.ReadUInt32("VirtualRealmAddress", indexes, i); - packet.ReadUInt32("NativeRealmAddress", indexes, i); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", indexes, i); + packet.ReadUInt32_Sanitize("NativeRealmAddress", indexes, i); packet.ReadPackedGuid128("Guid", indexes, i); packet.ReadInt32("SpecializationID", indexes, i); } diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/ChannelHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/ChannelHandler.cs index 98b36cf510..b9c3aa186c 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/ChannelHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/ChannelHandler.cs @@ -63,11 +63,11 @@ public static void HandleChannelNotify(Packet packet) packet.ReadPackedGuid128("SenderGuid"); packet.ReadPackedGuid128("BnetAccountID"); - packet.ReadInt32("SenderVirtualRealm"); + packet.ReadInt32_Sanitize("SenderVirtualRealm"); packet.ReadPackedGuid128("TargetGuid"); - packet.ReadUInt32("TargetVirtualRealm"); + packet.ReadUInt32_Sanitize("TargetVirtualRealm"); packet.ReadInt32("ChatChannelID"); if (type == ChatNotificationType.ModeChange) @@ -94,7 +94,7 @@ public static void HandleChannelSendList(Packet packet) for (var i = 0; i < int20; i++) { packet.ReadPackedGuid128("Guid", i); - packet.ReadUInt32("VirtualRealmAddress", i); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", i); packet.ReadByte("Flags", i); } } diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/CharacterHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/CharacterHandler.cs index e46092b56a..58956388ad 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/CharacterHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/CharacterHandler.cs @@ -381,10 +381,10 @@ public static void HandleNameQuery(Packet packet) var bit12 = packet.ReadBit(); if (bit4) - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); if (bit12) - packet.ReadInt32("NativeRealmAddress"); + packet.ReadInt32_Sanitize("NativeRealmAddress"); } [Parser(Opcode.SMSG_QUERY_PLAYER_NAME_RESPONSE)] @@ -413,7 +413,7 @@ public static void HandleNameQueryResponse(Packet packet) packet.ReadPackedGuid128("BnetAccountID"); packet.ReadPackedGuid128("Player Guid"); - packet.ReadUInt32("VirtualRealmAddress"); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); response.Race = (uint)packet.ReadByteE("Race"); response.Gender = (uint)packet.ReadByteE("Gender"); @@ -573,7 +573,7 @@ public static void ReadPVPBracketData(Packet packet, params object[] idx) public static void HandleRequestInspectPVP(Packet packet) { packet.ReadPackedGuid128("InspectTarget"); - packet.ReadInt32("InspectRealmAddress"); + packet.ReadInt32_Sanitize("InspectRealmAddress"); } [Parser(Opcode.SMSG_INSPECT_PVP)] diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/CombatHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/CombatHandler.cs index 7fcc9d2424..f168dd46d5 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/CombatHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/CombatHandler.cs @@ -188,12 +188,12 @@ public static void HandleDuelWinner(Packet packet) packet.ReadBit("Fled"); // Order guessed - packet.ReadUInt32("BeatenVirtualRealmAddress"); - packet.ReadUInt32("WinnerVirtualRealmAddress"); + packet.ReadUInt32_Sanitize("BeatenVirtualRealmAddress"); + packet.ReadUInt32_Sanitize("WinnerVirtualRealmAddress"); // Order guessed - packet.ReadWoWString("BeatenName", bits80); - packet.ReadWoWString("WinnerName", bits24); + packet.ReadWoWString_Sanitize("BeatenName", bits80); + packet.ReadWoWString_Sanitize("WinnerName", bits24); } [Parser(Opcode.SMSG_CAN_DUEL_RESULT)] diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/ContactHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/ContactHandler.cs index a6fb2da3b4..b7bf9a4ba5 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/ContactHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/ContactHandler.cs @@ -28,7 +28,7 @@ public static void HandleAddFriend(Packet packet) public static void ReadQualifiedGUID(Packet packet, params object[] indexes) { - packet.ReadInt32("VirtualRealmAddress", indexes); + packet.ReadInt32_Sanitize("VirtualRealmAddress", indexes); packet.ReadPackedGuid128("Guid", indexes); } @@ -48,7 +48,7 @@ public static void HandleFriendStatus(Packet packet) packet.ReadPackedGuid128("Guid"); packet.ReadPackedGuid128("WowAccount"); - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); packet.ReadByteE("Status"); @@ -69,8 +69,8 @@ public static void ReadContactInfo(Packet packet, params object[] index) packet.ReadPackedGuid128("Guid", index); packet.ReadPackedGuid128("WowAccount", index); - packet.ReadUInt32("VirtualRealmAddr", index); - packet.ReadUInt32("NativeRealmAddr", index); + packet.ReadUInt32_Sanitize("VirtualRealmAddr", index); + packet.ReadUInt32_Sanitize("NativeRealmAddr", index); packet.ReadUInt32("TypeFlags", index); packet.ReadByte("Status", index); diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/GroupHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/GroupHandler.cs index a087090417..d04b231cb9 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/GroupHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/GroupHandler.cs @@ -366,7 +366,7 @@ public static void HandlePartyInvite(Packet packet) packet.ReadPackedGuid128("InviterGuid"); packet.ReadPackedGuid128("InviterBNetAccountID"); - packet.ReadInt32("InviterCfgRealmID"); + packet.ReadInt32_Sanitize("InviterCfgRealmID"); packet.ReadInt16("Unk1"); packet.ResetBitReader(); @@ -376,14 +376,14 @@ public static void HandlePartyInvite(Packet packet) var bits2 = packet.ReadBits(8); var bits258 = packet.ReadBits(8); - packet.ReadWoWString("InviterRealmNameActual", bits2); - packet.ReadWoWString("InviterRealmNameNormalized", bits258); + packet.ReadWoWString_Sanitize("InviterRealmNameActual", bits2); + packet.ReadWoWString_Sanitize("InviterRealmNameNormalized", bits258); packet.ReadInt32("ProposedRoles"); var int32 = packet.ReadInt32("LfgSlotsCount"); packet.ReadInt32("LfgCompletedMask"); - packet.ReadWoWString("InviterName", len); + packet.ReadWoWString_Sanitize("InviterName", len); for (int i = 0; i < int32; i++) packet.ReadInt32("LfgSlots", i); @@ -537,15 +537,15 @@ public static void HandleClientPartyInvite(Packet packet) packet.ReadByte("PartyIndex"); packet.ReadInt32("ProposedRoles"); packet.ReadPackedGuid128("TargetGuid"); - packet.ReadInt32("TargetCfgRealmID"); + packet.ReadInt32_Sanitize("TargetCfgRealmID"); packet.ResetBitReader(); var lenTargetName = packet.ReadBits(9); var lenTargetRealm = packet.ReadBits(9); - packet.ReadWoWString("TargetName", lenTargetName); - packet.ReadWoWString("TargetRealm", lenTargetRealm); + packet.ReadWoWString_Sanitize("TargetName", lenTargetName); + packet.ReadWoWString_Sanitize("TargetRealm", lenTargetRealm); } [Parser(Opcode.CMSG_CONVERT_RAID)] diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/GuildHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/GuildHandler.cs index 3c7b356af1..9f365f68fe 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/GuildHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/GuildHandler.cs @@ -40,7 +40,7 @@ public static void HandleGuildQueryResponse(Packet packet) if (hasData) { packet.ReadPackedGuid128("Guild Guid"); - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var rankCount = packet.ReadInt32("RankCount"); packet.ReadInt32("EmblemColor"); packet.ReadInt32("EmblemStyle"); @@ -60,7 +60,7 @@ public static void HandleGuildQueryResponse(Packet packet) packet.ResetBitReader(); var nameLen = packet.ReadBits(7); - packet.ReadWoWString("Guild Name", nameLen); + packet.ReadWoWString_Sanitize("Guild Name", nameLen); } } @@ -140,7 +140,7 @@ public static void HandleGuildRoster(Packet packet) packet.ReadUInt32("Step", i, j); } - packet.ReadUInt32("VirtualRealmAddress", i); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", i); packet.ReadByteE("Status", i); packet.ReadByte("Level", i); @@ -156,9 +156,9 @@ public static void HandleGuildRoster(Packet packet) packet.ReadBit("Authenticated", i); packet.ReadBit("SorEligible", i); - packet.ReadWoWString("Name", bits36, i); - packet.ReadWoWString("Note", bits92, i); - packet.ReadWoWString("OfficerNote", bits221, i); + packet.ReadWoWString_Sanitize("Name", bits36, i); + packet.ReadWoWString_Sanitize("Note", bits92, i); + packet.ReadWoWString_Sanitize("OfficerNote", bits221, i); } packet.ResetBitReader(); @@ -203,14 +203,14 @@ public static void HandleGuildUpdateRoster(Packet packet) public static void HandleGuildEventPresenceChange(Packet packet) { packet.ReadPackedGuid128("Guid"); - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); packet.ResetBitReader(); var bits38 = packet.ReadBits(6); packet.ReadBit("LoggedOn"); packet.ReadBit("Mobile"); - packet.ReadWoWString("Name", bits38); + packet.ReadWoWString_Sanitize("Name", bits38); } [Parser(Opcode.SMSG_GUILD_KNOWN_RECIPES)] @@ -269,7 +269,7 @@ public static void HandleGuildPermissionsQueryResult(Packet packet) public static void HandleGuildInviteByName(Packet packet) { var bits16 = packet.ReadBits(9); - packet.ReadWoWString("Name", bits16); + packet.ReadWoWString_Sanitize("Name", bits16); } [Parser(Opcode.SMSG_GUILD_CRITERIA_UPDATE)] @@ -326,10 +326,10 @@ public static void HandleGuildInvite(Packet packet) var bits216 = packet.ReadBits(7); var bits52 = packet.ReadBits(7); - packet.ReadInt32("InviterVirtualRealmAddress"); - packet.ReadUInt32("GuildVirtualRealmAddress"); + packet.ReadInt32_Sanitize("InviterVirtualRealmAddress"); + packet.ReadUInt32_Sanitize("GuildVirtualRealmAddress"); packet.ReadPackedGuid128("GuildGUID"); - packet.ReadUInt32("OldGuildVirtualRealmAddress"); + packet.ReadUInt32_Sanitize("OldGuildVirtualRealmAddress"); packet.ReadPackedGuid128("OldGuildGUID"); packet.ReadUInt32("EmblemStyle"); packet.ReadUInt32("EmblemColor"); @@ -338,9 +338,9 @@ public static void HandleGuildInvite(Packet packet) packet.ReadUInt32("Background"); packet.ReadUInt32("AchievementPoints"); - packet.ReadWoWString("InviterName", bits149); - packet.ReadWoWString("OldGuildName", bits216); - packet.ReadWoWString("GuildName", bits52); + packet.ReadWoWString_Sanitize("InviterName", bits149); + packet.ReadWoWString_Sanitize("OldGuildName", bits216); + packet.ReadWoWString_Sanitize("GuildName", bits52); } [Parser(Opcode.SMSG_GUILD_BANK_QUERY_RESULTS)] @@ -475,7 +475,7 @@ public static void HandleGuildCommandResult(Packet packet) packet.ReadUInt32E("Result"); packet.ReadUInt32E("Command"); var len = packet.ReadBits(8); - packet.ReadWoWString("Name", len); + packet.ReadWoWString_Sanitize("Name", len); } [Parser(Opcode.SMSG_GUILD_NAME_CHANGED)] @@ -484,7 +484,7 @@ public static void HandleGuildNameChanged(Packet packet) packet.ReadPackedGuid128("GuildGUID"); var len = packet.ReadBits(7); - packet.ReadWoWString("GuildName", len); + packet.ReadWoWString_Sanitize("GuildName", len); } [Parser(Opcode.CMSG_GUILD_BANK_QUERY_TAB)] @@ -614,10 +614,10 @@ public static void HandleGuildAchievementEarned(Packet packet) public static void HandleGuildEventPlayerJoined(Packet packet) { packet.ReadPackedGuid128("Guid"); - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var len = packet.ReadBits(6); - packet.ReadWoWString("Name", len); + packet.ReadWoWString_Sanitize("Name", len); } [Parser(Opcode.SMSG_GUILD_EVENT_PLAYER_LEFT)] @@ -630,20 +630,20 @@ public static void HandleGuildEventPlayerLeft(Packet packet) { var lenRemoverName = packet.ReadBits(6); packet.ReadPackedGuid128("RemoverGUID"); - packet.ReadInt32("RemoverVirtualRealmAddress"); - packet.ReadWoWString("RemoverName", lenRemoverName); + packet.ReadInt32_Sanitize("RemoverVirtualRealmAddress"); + packet.ReadWoWString_Sanitize("RemoverName", lenRemoverName); } packet.ReadPackedGuid128("LeaverGUID"); - packet.ReadInt32("LeaverVirtualRealmAddress"); - packet.ReadWoWString("LeaverName", lenLeaverName); + packet.ReadInt32_Sanitize("LeaverVirtualRealmAddress"); + packet.ReadWoWString_Sanitize("LeaverName", lenLeaverName); } public static void ReadLFGuildRecruitData(Packet packet, params object[] indexes) { packet.ReadPackedGuid128("RecruitGUID", indexes); - packet.ReadUInt32("RecruitVirtualRealm", indexes); + packet.ReadUInt32_Sanitize("RecruitVirtualRealm", indexes); packet.ReadInt32("CharacterClass", indexes); packet.ReadInt32("CharacterGender", indexes); @@ -660,14 +660,14 @@ public static void ReadLFGuildRecruitData(Packet packet, params object[] indexes var lenName = packet.ReadBits(6); var lenComment = packet.ReadBits(10); - packet.ReadWoWString("Name", lenName, indexes); + packet.ReadWoWString_Sanitize("Name", lenName, indexes); packet.ReadWoWString("Comment", lenComment, indexes); } public static void ReadLFGuildApplicationData(Packet packet, params object[] indexes) { packet.ReadPackedGuid128("GuildGUID", indexes); - packet.ReadUInt32("GuildVirtualRealm", indexes); + packet.ReadUInt32_Sanitize("GuildVirtualRealm", indexes); packet.ReadInt32("ClassRoles", indexes); packet.ReadInt32("PlayStyle", indexes); @@ -679,7 +679,7 @@ public static void ReadLFGuildApplicationData(Packet packet, params object[] ind var lenName = packet.ReadBits(7); var lenComment = packet.ReadBits(10); - packet.ReadWoWString("GuildName", lenName, indexes); + packet.ReadWoWString_Sanitize("GuildName", lenName, indexes); packet.ReadWoWString("Comment", lenComment, indexes); } @@ -732,7 +732,7 @@ public static void HandleSignPetition(Packet packet) [Parser(Opcode.CMSG_QUERY_PETITION)] public static void HandleQueryPetition(Packet packet) { - packet.ReadUInt32("PetitionID"); + packet.ReadUInt32_Sanitize("PetitionID"); packet.ReadPackedGuid128("ItemGUID"); } @@ -770,7 +770,7 @@ public static void HandlePetitionShowSignatures(Packet packet) packet.ReadPackedGuid128("Item"); packet.ReadPackedGuid128("Owner"); packet.ReadPackedGuid128("OwnerWoWAccount"); - packet.ReadInt32("PetitionID"); + packet.ReadInt32_Sanitize("PetitionID"); var signaturesCount = packet.ReadInt32("SignaturesCount"); for (int i = 0; i < signaturesCount; i++) @@ -779,7 +779,7 @@ public static void HandlePetitionShowSignatures(Packet packet) public static void ReadPetitionInfo(Packet packet, params object[] indexes) { - packet.ReadInt32("PetitionID", indexes); + packet.ReadInt32_Sanitize("PetitionID", indexes); packet.ReadPackedGuid128("Petitioner", indexes); packet.ReadInt32("MinSignatures", indexes); @@ -816,7 +816,7 @@ public static void ReadPetitionInfo(Packet packet, params object[] indexes) [Parser(Opcode.SMSG_QUERY_PETITION_RESPONSE)] public static void HandleQueryPetitionResponse(Packet packet) { - packet.ReadInt32("PetitionID"); + packet.ReadInt32_Sanitize("PetitionID"); packet.ResetBitReader(); var hasAllow = packet.ReadBit("Allow"); @@ -848,7 +848,7 @@ public static void HandlePetitionRenameGuildResponse(Packet packet) packet.ResetBitReader(); var length = packet.ReadBits("NewGuildNameLength", 7); - packet.ReadWoWString("NewGuildName", length); + packet.ReadWoWString_Sanitize("NewGuildName", length); } [Parser(Opcode.SMSG_TURN_IN_PETITION_RESULT)] @@ -865,8 +865,8 @@ public static void HandleGuildInviteDeclined(Packet packet) packet.ResetBitReader(); - packet.ReadUInt32("VirtualRealmAddress"); - packet.ReadWoWString("Name", nameLength); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); + packet.ReadWoWString_Sanitize("Name", nameLength); } [Parser(Opcode.SMSG_GUILD_BANK_TEXT_QUERY_RESULT)] @@ -901,7 +901,7 @@ public static void ReadLFGuildBrowseData(Packet packet, params object[] idx) packet.ReadPackedGuid128("GuildGUID", idx); - packet.ReadUInt32("GuildVirtualRealm", idx); + packet.ReadUInt32_Sanitize("GuildVirtualRealm", idx); // packet.ReadInt32("GuildLevel", idx); packet.ReadInt32("GuildMembers", idx); packet.ReadInt32("GuildAchievementPoints", idx); @@ -918,7 +918,7 @@ public static void ReadLFGuildBrowseData(Packet packet, params object[] idx) packet.ReadSByte("Cached", idx); packet.ReadSByte("MembershipRequested", idx); - packet.ReadWoWString("GuildName", guildNameLength); + packet.ReadWoWString_Sanitize("GuildName", guildNameLength); packet.ReadWoWString("CommentLength", commentLength); } diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/InstanceHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/InstanceHandler.cs index 5ff1428992..404e8bbfe3 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/InstanceHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/InstanceHandler.cs @@ -72,7 +72,7 @@ public static void HandleCUFProfiles(Packet packet) packet.ReadInt16("BottomOffset", i); packet.ReadInt16("LeftOffset", i); - packet.ReadWoWString("Name", strlen, i); + packet.ReadWoWString_Sanitize("Name", strlen, i); } } diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/MailHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/MailHandler.cs index 13bd7dd22a..8f8f0bf43c 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/MailHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/MailHandler.cs @@ -24,7 +24,7 @@ public static void HandleMailCommandResult(Packet packet) public static void ReadMailListEntry(Packet packet, params object[] idx) { - packet.ReadInt32("MailID", idx); + packet.ReadInt32_Sanitize("MailID", idx); packet.ReadByteE("SenderType", idx); if (!ClientVersion.AddedInVersion(ClientVersionBuild.V6_1_0_19678)) @@ -35,10 +35,10 @@ public static void ReadMailListEntry(Packet packet, params object[] idx) var bit12 = packet.ReadBit(); if (bit4) - packet.ReadInt32("VirtualRealmAddress", idx); + packet.ReadInt32_Sanitize("VirtualRealmAddress", idx); if (bit12) - packet.ReadInt32("NativeRealmAddress", idx); + packet.ReadInt32_Sanitize("NativeRealmAddress", idx); } packet.ReadInt64("Cod", idx); @@ -139,10 +139,10 @@ public static void HandleMailQueryNextTimeResult60x(Packet packet) var bit12 = packet.ReadBit("HasNativeRealmAddress", i); if (bit4) - packet.ReadInt32("VirtualRealmAddress", i); + packet.ReadInt32_Sanitize("VirtualRealmAddress", i); if (bit12) - packet.ReadInt32("NativeRealmAddress", i); + packet.ReadInt32_Sanitize("NativeRealmAddress", i); packet.ReadSingle("TimeLeft", i); packet.ReadInt32("AltSenderID", i); @@ -193,7 +193,7 @@ public static void HandleSendMail(Packet packet) var itemCount = packet.ReadBits(5); packet.ResetBitReader(); - packet.ReadWoWString("Target", nameLength); + packet.ReadWoWString_Sanitize("Target", nameLength); packet.ReadWoWString("Subject", subjectLength); packet.ReadWoWString("Body", bodyLength); diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/MiscellaneousHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/MiscellaneousHandler.cs index f89dedc970..49cb948366 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/MiscellaneousHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/MiscellaneousHandler.cs @@ -119,8 +119,8 @@ public static void HandleFeatureSystemStatus60x(Packet packet) packet.ReadInt32("ScrollOfResurrectionRequestsRemaining"); packet.ReadInt32("ScrollOfResurrectionMaxRequestsPerDay"); - packet.ReadInt32("CfgRealmID"); - packet.ReadInt32("CfgRealmRecID"); + packet.ReadInt32_Sanitize("CfgRealmID"); + packet.ReadInt32_Sanitize("CfgRealmRecID"); packet.ResetBitReader(); @@ -153,8 +153,8 @@ public static void HandleFeatureSystemStatus610(Packet packet) packet.ReadInt32("ScrollOfResurrectionRequestsRemaining"); packet.ReadInt32("ScrollOfResurrectionMaxRequestsPerDay"); - packet.ReadInt32("CfgRealmID"); - packet.ReadInt32("CfgRealmRecID"); + packet.ReadInt32_Sanitize("CfgRealmID"); + packet.ReadInt32_Sanitize("CfgRealmRecID"); packet.ReadInt32("Int27"); packet.ReadInt32("Int29"); @@ -200,8 +200,8 @@ public static void HandleFeatureSystemStatus612(Packet packet) packet.ReadInt32("ScrollOfResurrectionRequestsRemaining"); packet.ReadInt32("ScrollOfResurrectionMaxRequestsPerDay"); - packet.ReadInt32("CfgRealmID"); - packet.ReadInt32("CfgRealmRecID"); + packet.ReadInt32_Sanitize("CfgRealmID"); + packet.ReadInt32_Sanitize("CfgRealmRecID"); packet.ReadInt32("TwitterPostThrottleLimit"); packet.ReadInt32("TwitterPostThrottleCooldown"); packet.ReadInt32("TokenPollTimeSeconds"); @@ -296,10 +296,10 @@ public static void HandleWhoRequest(Packet packet) packet.ReadBit("ExactName"); var bit708 = packet.ReadBit("HasServerInfo"); - packet.ReadWoWString("Name", bits2); - packet.ReadWoWString("VirtualRealmName", bits57); - packet.ReadWoWString("Guild", bits314); - packet.ReadWoWString("GuildVirtualRealmName", bits411); + packet.ReadWoWString_Sanitize("Name", bits2); + packet.ReadWoWString_Sanitize("VirtualRealmName", bits57); + packet.ReadWoWString_Sanitize("Guild", bits314); + packet.ReadWoWString_Sanitize("GuildVirtualRealmName", bits411); for (var i = 0; i < bit169; ++i) { @@ -313,7 +313,7 @@ public static void HandleWhoRequest(Packet packet) { packet.ReadInt32("FactionGroup"); packet.ReadInt32("Locale"); - packet.ReadInt32("RequesterVirtualRealmAddress"); + packet.ReadInt32_Sanitize("RequesterVirtualRealmAddress"); } for (var i = 0; i < bits728; ++i) @@ -339,31 +339,31 @@ public static void HandleWho(Packet packet) } for (var j = 0; j < 5; ++j) - packet.ReadWoWString("DeclinedNames", declinedNamesLen[j], i, j); + packet.ReadWoWString_Sanitize("DeclinedNames", declinedNamesLen[j], i, j); packet.ReadPackedGuid128("AccountID", i); packet.ReadPackedGuid128("BnetAccountID", i); packet.ReadPackedGuid128("GuidActual", i); - packet.ReadInt32("VirtualRealmAddress", i); + packet.ReadInt32_Sanitize("VirtualRealmAddress", i); packet.ReadByteE("Race", i); packet.ReadByteE("Sex", i); packet.ReadByteE("ClassId", i); packet.ReadByte("Level", i); - packet.ReadWoWString("Name", bits15, i); + packet.ReadWoWString_Sanitize("Name", bits15, i); packet.ReadPackedGuid128("GuildGUID", i); - packet.ReadInt32("GuildVirtualRealmAddress", i); + packet.ReadInt32_Sanitize("GuildVirtualRealmAddress", i); packet.ReadInt32("AreaID", i); packet.ResetBitReader(); var bits460 = packet.ReadBits(7); packet.ReadBit("IsGM", i); - packet.ReadWoWString("GuildName", bits460, i); + packet.ReadWoWString_Sanitize("GuildName", bits460, i); } } @@ -675,8 +675,8 @@ public static void HandleBugReport(Packet packet) var len1 = packet.ReadBits(12); var len2 = packet.ReadBits(10); - packet.ReadWoWString("DiagInfo", len1); - packet.ReadWoWString("Text", len2); + packet.ReadWoWString_Sanitize("DiagInfo", len1); + packet.ReadWoWString_Sanitize("Text", len2); } [Parser(Opcode.SMSG_RESURRECT_REQUEST)] @@ -684,7 +684,7 @@ public static void HandleResurrectRequest(Packet packet) { packet.ReadPackedGuid128("ResurrectOffererGUID"); - packet.ReadUInt32("ResurrectOffererVirtualRealmAddress"); + packet.ReadUInt32_Sanitize("ResurrectOffererVirtualRealmAddress"); packet.ReadUInt32("PetNumber"); packet.ReadInt32("SpellID"); @@ -693,7 +693,7 @@ public static void HandleResurrectRequest(Packet packet) packet.ReadBit("UseTimer"); packet.ReadBit("Sickness"); - packet.ReadWoWString("Name", len); + packet.ReadWoWString_Sanitize("Name", len); } [Parser(Opcode.CMSG_RESURRECT_RESPONSE)] @@ -823,7 +823,7 @@ public static void HandleLastWeeklyReset(Packet packet) public static void HandleSummonRequest(Packet packet) { packet.ReadPackedGuid128("SummonerGUID"); - packet.ReadUInt32("SummonerVirtualRealmAddress"); + packet.ReadUInt32_Sanitize("SummonerVirtualRealmAddress"); packet.ReadInt32("AreaID"); packet.ReadBit("ConfirmSummon_NC"); } @@ -883,14 +883,14 @@ public static void HandleToySetFavorite(Packet packet) public static void HandleWhoIsRequest(Packet packet) { var len = packet.ReadBits(6); - packet.ReadWoWString("CharName", len); + packet.ReadWoWString_Sanitize("CharName", len); } [Parser(Opcode.SMSG_WHO_IS)] public static void HandleWhoIsResponse(Packet packet) { var accNameLen = packet.ReadBits(11); - packet.ReadWoWString("AccountName", accNameLen); + packet.ReadWoWString_Sanitize("AccountName", accNameLen); } [Parser(Opcode.CMSG_COLLECTION_ITEM_SET_FAVORITE)] diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/PetHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/PetHandler.cs index df3e7fc9b3..d5ad7da326 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/PetHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/PetHandler.cs @@ -32,14 +32,14 @@ public static void HandlePetNameQueryResponse(Packet packet) declinedNameLen[i] = (int)packet.ReadBits(7); for (var i = 0; i < maxDeclinedNameCases; ++i) - packet.ReadWoWString("DeclinedNames", declinedNameLen[i], i); + packet.ReadWoWString_Sanitize("DeclinedNames", declinedNameLen[i], i); if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_0_5_37503)) packet.ReadTime64("Timestamp"); else packet.ReadTime("Timestamp"); - packet.ReadWoWString("Pet name", len); + packet.ReadWoWString_Sanitize("Pet name", len); } public static (uint, uint) ReadPetAction(Packet packet, params object[] indexes) @@ -150,10 +150,10 @@ public static void ReadPetRenameData(Packet packet) count[i] = (int)packet.ReadBits(7); for (var i = 0; i < 5; ++i) - packet.ReadWoWString("DeclinedNames", count[i], i); + packet.ReadWoWString_Sanitize("DeclinedNames", count[i], i); } - packet.ReadWoWString("NewName", bits20); + packet.ReadWoWString_Sanitize("NewName", bits20); } [Parser(Opcode.SMSG_PET_NAME_INVALID)] @@ -247,7 +247,7 @@ public static void ReadPetStableInfo(Packet packet, params object[] indexes) packet.ResetBitReader(); var len = packet.ReadBits(8); - packet.ReadWoWString("PetName", len, indexes); + packet.ReadWoWString_Sanitize("PetName", len, indexes); } [Parser(Opcode.SMSG_PET_STABLE_LIST)] diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/RecruitAFriendHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/RecruitAFriendHandler.cs index ed2992adbf..d49e0cd5de 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/RecruitAFriendHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/RecruitAFriendHandler.cs @@ -13,9 +13,9 @@ public static void HandleRecruitAFriend(Packet packet) var bits273 = packet.ReadBits(9); var bits338 = packet.ReadBits(10); - packet.ReadWoWString("Name", bits16); - packet.ReadWoWString("Email", bits273); - packet.ReadWoWString("Text", bits338); + packet.ReadWoWString_Sanitize("Name", bits16); + packet.ReadWoWString_Sanitize("Email", bits273); + packet.ReadWoWString_Sanitize("Text", bits338); } [Parser(Opcode.SMSG_RECRUIT_A_FRIEND_RESPONSE)] diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/SessionHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/SessionHandler.cs index b930c992e2..f34feaceef 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/SessionHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/SessionHandler.cs @@ -25,7 +25,7 @@ public static void HandleAuthResponse(Packet packet) var queued = packet.ReadBit("Queued"); if (ok) { - packet.ReadUInt32("VirtualRealmAddress"); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); var realms = packet.ReadUInt32(); if (ClientVersion.RemovedInVersion(ClientVersionBuild.V6_2_4_21315)) { @@ -53,14 +53,14 @@ public static void HandleAuthResponse(Packet packet) for (var i = 0; i < realms; ++i) { - packet.ReadUInt32("VirtualRealmAddress", i); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", i); packet.ResetBitReader(); packet.ReadBit("IsLocal", i); packet.ReadBit("unk", i); var nameLen1 = packet.ReadBits(8); var nameLen2 = packet.ReadBits(8); - packet.ReadWoWString("RealmNameActual", nameLen1, i); - packet.ReadWoWString("RealmNameNormalized", nameLen2, i); + packet.ReadWoWString_Sanitize("RealmNameActual", nameLen1, i); + packet.ReadWoWString_Sanitize("RealmNameNormalized", nameLen2, i); } for (var i = 0; i < races; ++i) @@ -145,22 +145,22 @@ public static void HandleSetTimeZoneInformation(Packet packet) public static void HandleAuthSession(Packet packet) { var sha = new byte[20]; - packet.ReadUInt32("Grunt ServerId"); + packet.ReadUInt32_Sanitize("Grunt ServerId"); packet.ReadInt16E("Client Build"); packet.ReadUInt32("Region"); packet.ReadUInt32("Battlegroup"); - packet.ReadUInt32("RealmIndex"); + packet.ReadUInt32_Sanitize("RealmIndex"); packet.ReadByte("Login Server Type"); packet.ReadByte("Unk"); - packet.ReadUInt32("Client Seed"); - packet.ReadUInt64("DosResponse"); + packet.ReadUInt32_Sanitize("Client Seed"); + packet.ReadUInt64_Sanitize("DosResponse"); for (uint i = 0; i < 20; ++i) sha[i] = packet.ReadByte(); var accountNameLength = packet.ReadBits("Account Name Length", 11); packet.ResetBitReader(); - packet.ReadWoWString("Account Name", accountNameLength); + packet.ReadWoWString_Sanitize("Account Name", accountNameLength); packet.ReadBit("UseIPv6"); var addonSize = packet.ReadInt32("Addons Size"); @@ -183,10 +183,10 @@ public static void HandleAuthSession624(Packet packet) packet.ReadByte("BuildType"); packet.ReadUInt32("RegionID"); packet.ReadUInt32("BattlegroupID"); - packet.ReadUInt32("RealmID"); - packet.ReadBytes("LocalChallenge", 16); - packet.ReadBytes("Digest", 24); - packet.ReadUInt64("DosResponse"); + packet.ReadUInt32_Sanitize("RealmID"); + packet.ReadBytes_Sanitize("LocalChallenge", 16); + packet.ReadBytes_Sanitize("Digest", 24); + packet.ReadUInt64_Sanitize("DosResponse"); var addonSize = packet.ReadInt32(); if (addonSize > 0) @@ -215,23 +215,23 @@ public static void HandlePlayerLogin(Packet packet) [Parser(Opcode.CMSG_AUTH_CONTINUED_SESSION)] public static void HandleRedirectAuthProof(Packet packet) { - packet.ReadInt64("DosResponse"); - packet.ReadInt64("Key"); + packet.ReadInt64_Sanitize("DosResponse"); + packet.ReadInt64_Sanitize("Key"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V6_2_4_21315)) { - packet.ReadBytes("LocalChallenge", 16); - packet.ReadBytes("Digest", 24); + packet.ReadBytes_Sanitize("LocalChallenge", 16); + packet.ReadBytes_Sanitize("Digest", 24); } else - packet.ReadBytes("Digest", 20); + packet.ReadBytes_Sanitize("Digest", 20); } [Parser(Opcode.SMSG_CONNECT_TO)] public static void HandleRedirectClient422(Packet packet) { - packet.ReadUInt64("Key"); + packet.ReadUInt64_Sanitize("Key"); packet.ReadUInt32("Serial"); - packet.ReadBytes("Where (RSA encrypted)", 256); + packet.ReadBytes_Sanitize("Where (RSA encrypted)", 256); packet.ReadByte("Con"); } @@ -241,9 +241,9 @@ public static void HandleServerAuthChallenge(Packet packet) if (ClientVersion.RemovedInVersion(ClientVersionBuild.V6_2_4_21315)) packet.ReadUInt32("Challenge"); for (uint i = 0; i < 8; ++i) - packet.ReadUInt32("DosChallenge", i); + packet.ReadUInt32_Sanitize("DosChallenge", i); if (ClientVersion.AddedInVersion(ClientVersionBuild.V6_2_4_21315)) - packet.ReadBytes("Challenge", 16); + packet.ReadBytes_Sanitize("Challenge", 16); packet.ReadByte("DosZeroBits"); } @@ -290,13 +290,13 @@ public static void HandleZeroLengthPackets(Packet packet) [Parser(Opcode.CMSG_QUERY_REALM_NAME)] public static void HandleRealmQuery(Packet packet) { - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); } [Parser(Opcode.SMSG_REALM_QUERY_RESPONSE)] public static void HandleRealmQueryResponse(Packet packet) { - packet.ReadUInt32("VirtualRealmAddress"); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); var state = packet.ReadByte("LookupState"); if (state == 0) @@ -310,8 +310,8 @@ public static void HandleRealmQueryResponse(Packet packet) var bits258 = packet.ReadBits(8); packet.ReadBit(); - packet.ReadWoWString("RealmNameActual", bits2); - packet.ReadWoWString("RealmNameNormalized", bits258); + packet.ReadWoWString_Sanitize("RealmNameActual", bits2); + packet.ReadWoWString_Sanitize("RealmNameNormalized", bits258); } } @@ -325,21 +325,21 @@ public static void HandleTimeQueryResponse(Packet packet) [Parser(Opcode.CMSG_CONNECT_TO_FAILED)] public static void HandleRedirectFailed(Packet packet) { - packet.ReadUInt32("Serial"); + packet.ReadUInt32_Sanitize("Serial"); packet.ReadSByte("Con"); } [Parser(Opcode.CMSG_SUSPEND_TOKEN_RESPONSE)] public static void HandleSuspendToken(Packet packet) { - packet.ReadUInt32("Sequence"); + packet.ReadUInt32_Sanitize("Sequence"); } [Parser(Opcode.SMSG_SUSPEND_TOKEN)] [Parser(Opcode.SMSG_RESUME_TOKEN)] public static void HandleResumeTokenPacket(Packet packet) { - packet.ReadUInt32("Sequence"); + packet.ReadUInt32_Sanitize("Sequence"); packet.ReadBits("Reason", 2); } @@ -353,15 +353,15 @@ public static void HandleRouterClientLogStreamingError(Packet packet) [Parser(Opcode.SMSG_BATTLENET_CHALLENGE_START)] public static void HandleBattlenetChallengeStart(Packet packet) { - packet.ReadUInt32("Token"); + packet.ReadUInt32_Sanitize("Token"); var bits16 = packet.ReadBits(9); - packet.ReadWoWString("ChallengeURL", bits16); + packet.ReadWoWString_Sanitize("ChallengeURL", bits16); } [Parser(Opcode.CMSG_BATTLENET_CHALLENGE_RESPONSE)] public static void HandleBattlenetChallengeResponse(Packet packet) { - packet.ReadUInt32("Token"); + packet.ReadUInt32_Sanitize("Token"); var result = packet.ReadBits(3); if (result == 3) { @@ -373,15 +373,15 @@ public static void HandleBattlenetChallengeResponse(Packet packet) [Parser(Opcode.SMSG_BATTLENET_CHALLENGE_ABORT)] public static void HandleBattlenetChallengeAbort(Packet packet) { - packet.ReadUInt32("Token"); + packet.ReadUInt32_Sanitize("Token"); packet.ReadBit("Timeout"); } public static void ReadMethodCall(Packet packet, params object[] idx) { packet.ReadUInt64("Type", idx); - packet.ReadUInt64("ObjectId", idx); - packet.ReadUInt32("Token", idx); + packet.ReadUInt64_Sanitize("ObjectId", idx); + packet.ReadUInt32_Sanitize("Token", idx); } [Parser(Opcode.CMSG_BATTLENET_REQUEST)] @@ -390,7 +390,7 @@ public static void HandleBattlenetRequest(Packet packet) ReadMethodCall(packet, "Method"); int protoSize = packet.ReadInt32(); - packet.ReadBytesTable("Data", protoSize); + packet.ReadBytesTable_Sanitize("Data", protoSize); } [Parser(Opcode.SMSG_BATTLENET_NOTIFICATION)] @@ -399,7 +399,7 @@ public static void HandleBattlenetNotification(Packet packet) ReadMethodCall(packet, "Method"); int protoSize = packet.ReadInt32(); - packet.ReadBytesTable("Data", protoSize); + packet.ReadBytesTable_Sanitize("Data", protoSize); } [Parser(Opcode.SMSG_BATTLENET_RESPONSE)] @@ -409,7 +409,7 @@ public static void HandleBattlenetResponse(Packet packet) ReadMethodCall(packet, "Method"); int protoSize = packet.ReadInt32(); - packet.ReadBytesTable("Data", protoSize); + packet.ReadBytesTable_Sanitize("Data", protoSize); } [Parser(Opcode.SMSG_BATTLE_NET_CONNECTION_STATUS)] @@ -427,18 +427,18 @@ public static void HandleUpdateClientSettings(Packet packet) [Parser(Opcode.SMSG_CHANGE_REALM_TICKET_RESPONSE)] public static void HandleChangeRealmTicketResponse(Packet packet) { - packet.ReadUInt32("Token"); + packet.ReadUInt32_Sanitize("Token"); packet.ResetBitReader(); packet.ReadBit("Allow"); int protoSize = packet.ReadInt32(); - packet.ReadBytesTable("Data", protoSize); + packet.ReadBytesTable_Sanitize("Data", protoSize); } [Parser(Opcode.CMSG_CHANGE_REALM_TICKET)] public static void HandleChangeRealmTicket(Packet packet) { - packet.ReadUInt32("Token"); + packet.ReadUInt32_Sanitize("Token"); packet.ReadBytes("Secret", 32); } } diff --git a/WowPacketParserModule.V6_0_2_19033/Parsers/TicketHandler.cs b/WowPacketParserModule.V6_0_2_19033/Parsers/TicketHandler.cs index 9833340624..4f93a79177 100644 --- a/WowPacketParserModule.V6_0_2_19033/Parsers/TicketHandler.cs +++ b/WowPacketParserModule.V6_0_2_19033/Parsers/TicketHandler.cs @@ -26,19 +26,19 @@ public static void HandleGMTicketCaseStatus(Packet packet) var int24 = packet.ReadInt32("CasesCount"); for (int i = 0; i < int24; i++) { - packet.ReadInt32("CaseID", i); + packet.ReadInt32_Sanitize("CaseID", i); packet.ReadInt32("CaseOpened", i); packet.ReadInt32("CaseStatus", i); - packet.ReadInt16("CfgRealmID", i); - packet.ReadInt64("CharacterID", i); + packet.ReadInt16_Sanitize("CfgRealmID", i); + packet.ReadInt64_Sanitize("CharacterID", i); packet.ReadInt32("WaitTimeOverrideMinutes", i); packet.ResetBitReader(); var bits12 = packet.ReadBits(11); var bits262 = packet.ReadBits(10); - packet.ReadWoWString("Url", bits12, i); - packet.ReadWoWString("WaitTimeOverrideMessage", bits262, i); + packet.ReadWoWString_Sanitize("Url", bits12, i); + packet.ReadWoWString_Sanitize("WaitTimeOverrideMessage", bits262, i); } } @@ -58,7 +58,7 @@ public static void HandleGMTicketGetTicketResponse(Packet packet) // ClientGMTicketInfo if (hasInfo) { - packet.ReadInt32("TicketID"); + packet.ReadInt32_Sanitize("TicketID"); packet.ReadByte("Category"); packet.ReadTime("TicketOpenTime"); packet.ReadTime("OldestTicketTime"); @@ -72,27 +72,27 @@ public static void HandleGMTicketGetTicketResponse(Packet packet) var bits1 = packet.ReadBits(11); var bits2022 = packet.ReadBits(10); - packet.ReadWoWString("TicketDescription", bits1); - packet.ReadWoWString("WaitTimeOverrideMessage", bits2022); + packet.ReadWoWString_Sanitize("TicketDescription", bits1); + packet.ReadWoWString_Sanitize("WaitTimeOverrideMessage", bits2022); } } public static void ReadComplaintOffender(Packet packet, params object[] indexes) { packet.ReadPackedGuid128("PlayerGuid", indexes); - packet.ReadInt32("RealmAddress", indexes); + packet.ReadInt32_Sanitize("RealmAddress", indexes); packet.ReadInt32("TimeSinceOffence", indexes); } public static void ReadComplaintChat(Packet packet, params object[] indexes) { - packet.ReadInt32("Command"); - packet.ReadInt32("ChannelID"); + packet.ReadInt32_Sanitize("Command"); + packet.ReadInt32_Sanitize("ChannelID"); packet.ResetBitReader(); var len = packet.ReadBits(12); - packet.ReadWoWString("MessageLog", len); + packet.ReadWoWString_Sanitize("MessageLog", len); } [Parser(Opcode.CMSG_COMPLAINT)] @@ -105,15 +105,15 @@ public static void HandleComplain(Packet packet) switch (result) { case 0: // Mail - packet.ReadInt32("MailID"); + packet.ReadInt32_Sanitize("MailID"); break; case 1: // Chat ReadComplaintChat(packet, "Chat"); break; case 2: // Calendar // Order guessed - packet.ReadInt64("EventGuid"); - packet.ReadInt64("InviteGuid"); + packet.ReadInt64_Sanitize("EventGuid"); + packet.ReadInt64_Sanitize("InviteGuid"); break; } } @@ -121,7 +121,7 @@ public static void HandleComplain(Packet packet) [Parser(Opcode.CMSG_GM_TICKET_ACKNOWLEDGE_SURVEY)] public static void HandleGMTicketAcknowledgeSurvey(Packet packet) { - packet.ReadInt32("CaseID"); + packet.ReadInt32_Sanitize("CaseID"); } [Parser(Opcode.CMSG_GM_TICKET_CREATE)] @@ -133,7 +133,7 @@ public static void HandleGMTicketCreate(Packet packet) var descriptionLength = packet.ReadBits("DescriptionLength", 11); packet.ResetBitReader(); - packet.ReadWoWString("Description", descriptionLength); + packet.ReadWoWString_Sanitize("Description", descriptionLength); packet.ReadBit("NeedResponse"); packet.ReadBit("NeedMoreHelp"); @@ -150,7 +150,7 @@ public static void HandleGMTicketCreate(Packet packet) var decompCount = packet.ReadInt32(); var pkt = packet.Inflate(decompCount); - pkt.ReadCString("Text"); + pkt.ReadCString_Sanitize("Text"); pkt.ClosePacket(false); } } @@ -161,25 +161,25 @@ public static void HandleGMTicketUpdatetext(Packet packet) var length = packet.ReadBits("DescriptionLength", 11); packet.ResetBitReader(); - packet.ReadWoWString("Description", length); + packet.ReadWoWString_Sanitize("Description", length); } public static void ReadClientGMSurveyQuestion(Packet packet, params object[] idx) { - packet.ReadInt32("QuestionID", idx); + packet.ReadInt32_Sanitize("QuestionID", idx); packet.ReadByte("Answer", idx); packet.ResetBitReader(); var length = packet.ReadBits("AnswerCommentLength", 11, idx); packet.ResetBitReader(); - packet.ReadWoWString("AnswerComment", length, idx); + packet.ReadWoWString_Sanitize("AnswerComment", length, idx); } [Parser(Opcode.CMSG_GM_SURVEY_SUBMIT)] public static void HandleGMSurveySubmit(Packet packet) { - packet.ReadInt32("SurveyID"); + packet.ReadInt32_Sanitize("SurveyID"); var questionCount = packet.ReadBits("SurveyQuestionCount", 4); var commentLenght = packet.ReadBits("CommentLength", 11); @@ -189,7 +189,7 @@ public static void HandleGMSurveySubmit(Packet packet) for (var i = 0; i < questionCount; ++i) ReadClientGMSurveyQuestion(packet, "SurveyQuestion", i); - packet.ReadWoWString("Comment", commentLenght); + packet.ReadWoWString_Sanitize("Comment", commentLenght); } public static void ReadCliSupportTicketHeader(Packet packet, params object[] idx) @@ -207,7 +207,7 @@ public static void HandleSubmitBug(Packet packet) var noteLength = packet.ReadBits("NoteLength", 10); packet.ResetBitReader(); - packet.ReadWoWString("Note", noteLength); + packet.ReadWoWString_Sanitize("Note", noteLength); } public static void ReadCliSupportTicketChatLine(Packet packet, params object[] idx) @@ -216,7 +216,7 @@ public static void ReadCliSupportTicketChatLine(Packet packet, params object[] i var textLength = packet.ReadBits("TextLength", 12, idx); packet.ResetBitReader(); - packet.ReadWoWString("Text", textLength, idx); + packet.ReadWoWString_Sanitize("Text", textLength, idx); } public static void ReadCliSupportTicketChatLog(Packet packet, params object[] idx) @@ -234,21 +234,21 @@ public static void ReadCliSupportTicketChatLog(Packet packet, params object[] id public static void ReadCliSupportTicketMailInfo(Packet packet, params object[] idx) { - packet.ReadInt32("MailID", idx); + packet.ReadInt32_Sanitize("MailID", idx); var bodyLength = packet.ReadBits("MailBodyLength", 13, idx); var subjectLength = packet.ReadBits("MailSubjectLength", 9, idx); packet.ResetBitReader(); - packet.ReadWoWString("MailBody", bodyLength, idx); - packet.ReadWoWString("MailSubject", subjectLength, idx); + packet.ReadWoWString_Sanitize("MailBody", bodyLength, idx); + packet.ReadWoWString_Sanitize("MailSubject", subjectLength, idx); } public static void ReadCliSupportTicketCalendarEventInfo(Packet packet, params object[] idx) { - packet.ReadUInt64("EventID", idx); // order not confirmed - packet.ReadUInt64("InviteID", idx); // order not confirmed + packet.ReadUInt64_Sanitize("EventID", idx); // order not confirmed + packet.ReadUInt64_Sanitize("InviteID", idx); // order not confirmed var eventTitleLength = packet.ReadBits("EventTitleLength", 8, idx); @@ -265,7 +265,7 @@ public static void ReadCliSupportTicketPetInfo(Packet packet, params object[] id packet.ResetBitReader(); - packet.ReadWoWString("PetName", petNameLength, idx); + packet.ReadWoWString_Sanitize("PetName", petNameLength, idx); } public static void ReadCliSupportTicketGuildInfo(Packet packet, params object[] idx) @@ -276,7 +276,7 @@ public static void ReadCliSupportTicketGuildInfo(Packet packet, params object[] packet.ResetBitReader(); - packet.ReadWoWString("GuildName", guildNameLength, idx); + packet.ReadWoWString_Sanitize("GuildName", guildNameLength, idx); } public static void ReadCliSupportTicketLFGListSearchResult(Packet packet, params object[] idx) @@ -293,9 +293,9 @@ public static void ReadCliSupportTicketLFGListSearchResult(Packet packet, params packet.ResetBitReader(); - packet.ReadWoWString("Title", titleLength, idx); - packet.ReadWoWString("Description", descriptionLength, idx); - packet.ReadWoWString("VoiceChat", voiceChatLength, idx); + packet.ReadWoWString_Sanitize("Title", titleLength, idx); + packet.ReadWoWString_Sanitize("Description", descriptionLength, idx); + packet.ReadWoWString_Sanitize("VoiceChat", voiceChatLength, idx); } public static void ReadCliSupportTicketLFGListApplicant(Packet packet, params object[] idx) @@ -304,7 +304,7 @@ public static void ReadCliSupportTicketLFGListApplicant(Packet packet, params ob var length = packet.ReadBits(9); packet.ResetBitReader(); - packet.ReadWoWString("Comment", length, idx); + packet.ReadWoWString_Sanitize("Comment", length, idx); } [Parser(Opcode.CMSG_SUPPORT_TICKET_SUBMIT_COMPLAINT)] @@ -379,14 +379,14 @@ public static void HandleGMTicketResponse(Packet packet) { // TODO: confirm order - packet.ReadUInt32("TicketID"); - packet.ReadUInt32("ResponseID"); + packet.ReadUInt32_Sanitize("TicketID"); + packet.ReadUInt32_Sanitize("ResponseID"); var descriptionLength = packet.ReadBits(11); var responseTextLength = packet.ReadBits(14); - packet.ReadWoWString("Description", descriptionLength); - packet.ReadWoWString("ResponseText", responseTextLength); + packet.ReadWoWString_Sanitize("Description", descriptionLength); + packet.ReadWoWString_Sanitize("ResponseText", responseTextLength); } } diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/AuthenticationHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/AuthenticationHandler.cs index 188782ae94..f32d1c4479 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/AuthenticationHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/AuthenticationHandler.cs @@ -14,7 +14,7 @@ public static void HandleAuthSession(Packet packet) packet.ReadByte("BuildType"); packet.ReadUInt32("RegionID"); packet.ReadUInt32("BattlegroupID"); - packet.ReadUInt32("RealmID"); + packet.ReadUInt32_Sanitize("RealmID"); packet.ReadBytes("LocalChallenge", 16); packet.ReadBytes("Digest", 24); packet.ReadBit("UseIPv6"); @@ -32,7 +32,7 @@ public static void HandleAuthResponse(Packet packet) var queued = packet.ReadBit("Queued"); if (ok) { - packet.ReadUInt32("VirtualRealmAddress"); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); var realms = packet.ReadUInt32(); packet.ReadUInt32("TimeRested"); packet.ReadByte("ActiveExpansionLevel"); @@ -87,14 +87,14 @@ public static void HandleAuthResponse(Packet packet) for (var i = 0; i < realms; ++i) { - packet.ReadUInt32("RealmAddress", "VirtualRealms", i); + packet.ReadUInt32_Sanitize("RealmAddress", "VirtualRealms", i); packet.ResetBitReader(); packet.ReadBit("IsLocal", "VirtualRealms", i); packet.ReadBit("IsInternalRealm", "VirtualRealms", i); var nameLen1 = packet.ReadBits(8); var nameLen2 = packet.ReadBits(8); - packet.ReadWoWString("RealmNameActual", nameLen1, "VirtualRealms", i); - packet.ReadWoWString("RealmNameNormalized", nameLen2, "VirtualRealms", i); + packet.ReadWoWString_Sanitize("RealmNameActual", nameLen1, "VirtualRealms", i); + packet.ReadWoWString_Sanitize("RealmNameNormalized", nameLen2, "VirtualRealms", i); } for (var i = 0; i < templates; ++i) diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/BattlePetHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/BattlePetHandler.cs index 8ecb8694e8..44736201f9 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/BattlePetHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/BattlePetHandler.cs @@ -32,7 +32,7 @@ public static void ReadClientBattlePet(Packet packet, params object[] idx) var hasOwnerInfo = packet.ReadBit("HasOwnerInfo", idx); packet.ReadBit("NoRename", idx); - packet.ReadWoWString("CustomName", customNameLength, idx); + packet.ReadWoWString_Sanitize("CustomName", customNameLength, idx); if (hasOwnerInfo) V6_0_2_19033.Parsers.BattlePetHandler.ReadClientBattlePetOwnerInfo(packet, "OwnerInfo", idx); @@ -105,10 +105,10 @@ public static void HandleBattlePetModifyName(Packet packet) declinedNamesLen[i] = packet.ReadBits(7); for (int i = 0; i < 5; i++) - packet.ReadWoWString("DeclinedNames", declinedNamesLen[i]); + packet.ReadWoWString_Sanitize("DeclinedNames", declinedNamesLen[i]); } - packet.ReadWoWString("Name", nameLen); + packet.ReadWoWString_Sanitize("Name", nameLen); } [Parser(Opcode.CMSG_BATTLE_PET_CLEAR_FANFARE)] diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/CharacterHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/CharacterHandler.cs index e4723d87f6..847488a59b 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/CharacterHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/CharacterHandler.cs @@ -65,7 +65,7 @@ public static void ReadCharactersData(Packet packet, params object[] idx) packet.ReadBit("BoostInProgress", idx); packet.ReadBits("UnkWod61x", 5, idx); - packet.ReadWoWString("Character Name", nameLength, idx); + packet.ReadWoWString_Sanitize("Character Name", nameLength, idx); if (firstLogin) { @@ -147,7 +147,7 @@ public static void HandleClientCharCreate(Packet packet) for (var i = 0; i < 3; i++) packet.ReadByte("CustomDisplay", i); - packet.ReadWoWString("Name", nameLen); + packet.ReadWoWString_Sanitize("Name", nameLen); if (hasTemplateSet) packet.ReadInt32("TemplateSetID"); @@ -305,7 +305,7 @@ public static void HandleClientCharCustomize(Packet packet) packet.ResetBitReader(); var bits19 = packet.ReadBits(6); - packet.ReadWoWString("CharName", bits19); + packet.ReadWoWString_Sanitize("CharName", bits19); } @@ -326,7 +326,7 @@ public static void HandleCharRaceOrFactionChange(Packet packet) packet.ReadByte("FaceID"); for (uint i = 0; i < 3; ++i) packet.ReadByte("CustomDisplay", i); - packet.ReadWoWString("Name", bits20); + packet.ReadWoWString_Sanitize("Name", bits20); } [Parser(Opcode.SMSG_CHAR_FACTION_CHANGE_RESULT)] @@ -353,7 +353,7 @@ public static void HandleCharFactionChangeResult(Packet packet) for (uint i = 0; i < 3; ++i) packet.ReadByte("CustomDisplay", i); - packet.ReadWoWString("Name", bits55); + packet.ReadWoWString_Sanitize("Name", bits55); } } @@ -372,7 +372,7 @@ public static void HandleServerCharCustomize(Packet packet) packet.ResetBitReader(); var bits55 = packet.ReadBits(6); - packet.ReadWoWString("Name", bits55); + packet.ReadWoWString_Sanitize("Name", bits55); } } } diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/ChatHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/ChatHandler.cs index 3a358025d0..3172f415bd 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/ChatHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/ChatHandler.cs @@ -41,7 +41,7 @@ public static void HandleClientChatMessage(Packet packet) { packet.ReadInt32E("Language"); var len = packet.ReadBits(9); - packet.ReadWoWString("Text", len); + packet.ReadWoWString_Sanitize("Text", len); } [Parser(Opcode.CMSG_CHAT_MESSAGE_CHANNEL)] @@ -52,9 +52,9 @@ public static void HandleChatAddonMessageChannel(Packet packet) packet.ReadPackedGuid128("ChannelGUID"); var channelNameLen = packet.ReadBits(9); var msgLen = packet.ReadBits(9); - - packet.ReadWoWString("Target", channelNameLen); - packet.ReadWoWString("Text", msgLen); + packet.ResetBitReader(); + packet.ReadWoWString("Channel Name", channelNameLen); + packet.ReadWoWString_Sanitize("Message", msgLen); } [Parser(Opcode.CMSG_CHAT_MESSAGE_WHISPER)] @@ -64,8 +64,8 @@ public static void HandleClientChatMessageWhisper(Packet packet) var recvName = packet.ReadBits(9); var msgLen = packet.ReadBits(9); - packet.ReadWoWString("Target", recvName); - packet.ReadWoWString("Text", msgLen); + packet.ReadWoWString_Sanitize("Target", recvName); + packet.ReadWoWString_Sanitize("Text", msgLen); } [Parser(Opcode.CMSG_CHAT_MESSAGE_DND)] diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/GarrisonHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/GarrisonHandler.cs index 69dc010118..ce1b3aeb92 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/GarrisonHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/GarrisonHandler.cs @@ -62,7 +62,7 @@ public static void ReadGarrisonFollower(Packet packet, params object[] indexes) packet.ResetBitReader(); var len = packet.ReadBits(7); - packet.ReadWoWString("CustomName", len, indexes); + packet.ReadWoWString_Sanitize("CustomName", len, indexes); } public static void ReadGarrisonTalents(Packet packet, params object[] indexes) @@ -497,10 +497,10 @@ public static void HandleGarrisonGetClassSpecCategoryInfo(Packet packet) [Parser(Opcode.CMSG_GARRISON_RENAME_FOLLOWER)] public static void HandleGarrisonRenameFollower(Packet packet) { - packet.ReadUInt64("FollowerDbId"); + packet.ReadUInt64_Sanitize("FollowerDbId"); var followerNewNameLength = packet.ReadBits("FollowerNewNameLength", 7); packet.ResetBitReader(); - packet.ReadWoWString("FollowerNewName", followerNewNameLength); + packet.ReadWoWString_Sanitize("FollowerNewName", followerNewNameLength); } [Parser(Opcode.CMSG_GARRISON_SET_RECRUITMENT_PREFERENCES)] diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/GroupHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/GroupHandler.cs index 46af12f66c..dfc540653e 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/GroupHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/GroupHandler.cs @@ -36,7 +36,7 @@ public static void ReadPetInfos(Packet packet, params object[] index) packet.ResetBitReader(); var len = packet.ReadBits(8); - packet.ReadWoWString("PetName", len, index); + packet.ReadWoWString_Sanitize("PetName", len, index); } [Parser(Opcode.SMSG_PARTY_MEMBER_FULL_STATE)] @@ -115,8 +115,8 @@ public static void HandleClientPartyInvite(Packet packet) packet.ReadPackedGuid128("TargetGuid"); } - packet.ReadWoWString("TargetName", lenTargetName); - packet.ReadWoWString("TargetRealm", lenTargetRealm); + packet.ReadWoWString_Sanitize("TargetName", lenTargetName); + packet.ReadWoWString_Sanitize("TargetRealm", lenTargetRealm); } [Parser(Opcode.SMSG_PARTY_INVITE)] @@ -130,13 +130,13 @@ public static void HandlePartyInvite(Packet packet) var len = packet.ReadBits(6); packet.ResetBitReader(); - packet.ReadInt32("InviterVirtualRealmAddress"); + packet.ReadInt32_Sanitize("InviterVirtualRealmAddress"); packet.ReadBit("IsLocal"); packet.ReadBit("Unk2"); var bits2 = packet.ReadBits(8); var bits258 = packet.ReadBits(8); - packet.ReadWoWString("InviterRealmNameActual", bits2); - packet.ReadWoWString("InviterRealmNameNormalized", bits258); + packet.ReadWoWString_Sanitize("InviterRealmNameActual", bits2); + packet.ReadWoWString_Sanitize("InviterRealmNameNormalized", bits258); packet.ReadPackedGuid128("InviterGuid"); packet.ReadPackedGuid128("InviterBNetAccountID"); @@ -144,7 +144,7 @@ public static void HandlePartyInvite(Packet packet) packet.ReadInt32("ProposedRoles"); var lfgSlots = packet.ReadInt32(); packet.ReadInt32("LfgCompletedMask"); - packet.ReadWoWString("InviterName", len); + packet.ReadWoWString_Sanitize("InviterName", len); for (int i = 0; i < lfgSlots; i++) packet.ReadInt32("LfgSlots", i); } @@ -181,7 +181,7 @@ public static void HandlePartyUpdate(Packet packet) packet.ReadByte("RolesAssigned", i); packet.ReadByteE("Class", i); - packet.ReadWoWString("Name", playerNameLength, i); + packet.ReadWoWString_Sanitize("Name", playerNameLength, i); } packet.ResetBitReader(); @@ -255,7 +255,7 @@ public static void HandlePartyMemberPartialState(Packet packet) { packet.ResetBitReader(); var len = packet.ReadBits(8); - packet.ReadWoWString("NewPetName", len, "Pet"); + packet.ReadWoWString_Sanitize("NewPetName", len, "Pet"); } if (petGuidChanged) packet.ReadPackedGuid128("NewPetGuid", "Pet"); diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/GuildHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/GuildHandler.cs index 00cfa1e4b0..5d7919c019 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/GuildHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/GuildHandler.cs @@ -15,7 +15,7 @@ public static void HandleGuildQueryResponse(Packet packet) if (hasData) { packet.ReadPackedGuid128("GuildGUID"); - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var rankCount = packet.ReadInt32("RankCount"); packet.ReadInt32("EmblemColor"); packet.ReadInt32("EmblemStyle"); @@ -33,10 +33,10 @@ public static void HandleGuildQueryResponse(Packet packet) packet.ResetBitReader(); var rankNameLen = packet.ReadBits(7); - packet.ReadWoWString("Rank Name", rankNameLen, i); + packet.ReadWoWString_Sanitize("Rank Name", rankNameLen, i); } - packet.ReadWoWString("Guild Name", nameLen); + packet.ReadWoWString_Sanitize("Guild Name", nameLen); } } @@ -70,7 +70,7 @@ public static void HandleGuildRoster(Packet packet) packet.ReadUInt32("Step", i, j); } - packet.ReadUInt32("VirtualRealmAddress", i); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", i); packet.ReadByteE("Status", i); packet.ReadByte("Level", i); @@ -86,9 +86,9 @@ public static void HandleGuildRoster(Packet packet) packet.ReadBit("Authenticated", i); packet.ReadBit("SorEligible", i); - packet.ReadWoWString("Name", bits36, i); - packet.ReadWoWString("Note", bits92, i); - packet.ReadWoWString("OfficerNote", bits221, i); + packet.ReadWoWString_Sanitize("Name", bits36, i); + packet.ReadWoWString_Sanitize("Note", bits92, i); + packet.ReadWoWString_Sanitize("OfficerNote", bits221, i); } packet.ReadWoWString("WelcomeText", bits2037); diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/HotfixHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/HotfixHandler.cs index 166f2f0cb8..05d0c28343 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/HotfixHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/HotfixHandler.cs @@ -131,7 +131,7 @@ public static void HandleHotfixQuery(Packet packet) [Parser(Opcode.SMSG_AVAILABLE_HOTFIXES)] public static void HandleHotfixList(Packet packet) { - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var hotfixCount = packet.ReadUInt32("HotfixCount"); for (var i = 0u; i < hotfixCount; ++i) { diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/InstanceHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/InstanceHandler.cs index 069ea2d628..1ede0fc8bd 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/InstanceHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/InstanceHandler.cs @@ -72,7 +72,7 @@ public static void HandleCUFProfiles(Packet packet) packet.ReadInt16("BottomOffset", i); packet.ReadInt16("LeftOffset", i); - packet.ReadWoWString("Name", strlen, i); + packet.ReadWoWString_Sanitize("Name", strlen, i); } } diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/LfgHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/LfgHandler.cs index 96e82d96f8..ab51eb2491 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/LfgHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/LfgHandler.cs @@ -51,7 +51,7 @@ public static void ReadLfgListSearchResult(Packet packet, params object[] idx) if (ClientVersion.AddedInVersion(ClientVersionBuild.V7_3_0_24920)) packet.ReadPackedGuid128("LastTouchedVoiceChat", idx); - packet.ReadUInt32("VirtualRealmAddress", idx); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", idx); var bnetFriendCount = packet.ReadUInt32(); var characterFriendCount = packet.ReadUInt32(); @@ -301,7 +301,7 @@ public static void ReadLfgListSearchResultPartialUpdate(Packet packet, params ob packet.ReadPackedGuid128("Leader", idx); if (hasVirtualRealmAddress) - packet.ReadUInt32("VirtualRealmAddress", idx); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", idx); if (hasCompletedEncountersMask) packet.ReadUInt32("CompletedEncountersMask", idx); @@ -343,7 +343,7 @@ public static void HandleLfgListApplicantListUpdate(Packet packet) for (int j = 0; j < memberCount; j++) { packet.ReadPackedGuid128("Guid", i, j); - packet.ReadUInt32("VirtualRealmAddress", i, j); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", i, j); packet.ReadSingle("ItemLevel", i, j); packet.ReadUInt32("Level", i, j); packet.ReadInt32("HonorLevel", i, j); diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/MiscellaneousHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/MiscellaneousHandler.cs index 370bd89769..9c6324d0cf 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/MiscellaneousHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/MiscellaneousHandler.cs @@ -143,8 +143,8 @@ public static void HandleFeatureSystemStatus710(Packet packet) packet.ReadUInt32("ScrollOfResurrectionRequestsRemaining"); packet.ReadUInt32("ScrollOfResurrectionMaxRequestsPerDay"); - packet.ReadUInt32("CfgRealmID"); - packet.ReadInt32("CfgRealmRecID"); + packet.ReadUInt32_Sanitize("CfgRealmID"); + packet.ReadInt32_Sanitize("CfgRealmRecID"); packet.ReadUInt32("TwitterPostThrottleLimit"); packet.ReadUInt32("TwitterPostThrottleCooldown"); packet.ReadUInt32("TokenPollTimeSeconds"); @@ -224,8 +224,8 @@ public static void HandleFeatureSystemStatus715(Packet packet) packet.ReadUInt32("ScrollOfResurrectionRequestsRemaining"); packet.ReadUInt32("ScrollOfResurrectionMaxRequestsPerDay"); - packet.ReadUInt32("CfgRealmID"); - packet.ReadInt32("CfgRealmRecID"); + packet.ReadUInt32_Sanitize("CfgRealmID"); + packet.ReadInt32_Sanitize("CfgRealmRecID"); packet.ReadUInt32("TwitterPostThrottleLimit"); packet.ReadUInt32("TwitterPostThrottleCooldown"); packet.ReadUInt32("TokenPollTimeSeconds"); diff --git a/WowPacketParserModule.V7_0_3_22248/Parsers/SpellHandler.cs b/WowPacketParserModule.V7_0_3_22248/Parsers/SpellHandler.cs index f072520bde..b9046f86d3 100644 --- a/WowPacketParserModule.V7_0_3_22248/Parsers/SpellHandler.cs +++ b/WowPacketParserModule.V7_0_3_22248/Parsers/SpellHandler.cs @@ -168,7 +168,7 @@ public static void ReadSpellTargetData(Packet packet, PacketSpellData packetSpel } } - packet.ReadWoWString("Name", nameLength, idx); + packet.ReadWoWString_Sanitize("Name", nameLength, idx); } public static void ReadRuneData(Packet packet, params object[] idx) @@ -557,7 +557,7 @@ public static void HandleResurrectRequest(Packet packet) { packet.ReadPackedGuid128("ResurrectOffererGUID"); - packet.ReadUInt32("ResurrectOffererVirtualRealmAddress"); + packet.ReadUInt32_Sanitize("ResurrectOffererVirtualRealmAddress"); packet.ReadUInt32("PetNumber"); packet.ReadInt32("SpellID"); @@ -566,7 +566,7 @@ public static void HandleResurrectRequest(Packet packet) packet.ReadBit("UseTimer"); packet.ReadBit("Sickness"); - packet.ReadWoWString("Name", len); + packet.ReadWoWString_Sanitize("Name", len); } [Parser(Opcode.SMSG_TOTEM_CREATED, ClientVersionBuild.V7_1_0_22900)] diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/AccountDataHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/AccountDataHandler.cs index e9422fa6df..6a31136597 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/AccountDataHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/AccountDataHandler.cs @@ -10,7 +10,7 @@ public static void ReadAccountCharacterList(Packet packet, params object[] idx) { packet.ReadPackedGuid128("WowAccountGUID", idx); packet.ReadPackedGuid128("CharacterGUID", idx); - packet.ReadUInt32("VirtualRealmAddress", idx); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", idx); packet.ReadByteE("Race" ,idx); packet.ReadByteE("Class", idx); packet.ReadByteE("Gender", idx); @@ -27,8 +27,8 @@ public static void ReadAccountCharacterList(Packet packet, params object[] idx) uint characterNameLength = packet.ReadBits(6); uint realmNameLength = packet.ReadBits(9); - packet.ReadWoWString("CharacterName", characterNameLength, idx); - packet.ReadWoWString("RealmName", realmNameLength, idx); + packet.ReadWoWString_Sanitize("CharacterName", characterNameLength, idx); + packet.ReadWoWString_Sanitize("RealmName", realmNameLength, idx); } [Parser(Opcode.SMSG_GET_ACCOUNT_CHARACTER_LIST_RESULT)] diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/AchievementHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/AchievementHandler.cs index 2d7975461a..16a1ede659 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/AchievementHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/AchievementHandler.cs @@ -24,7 +24,7 @@ public static void HandleCriteriaPlayer(Packet packet) hasRafAcceptanceID = packet.ReadBit(); if (hasRafAcceptanceID) - packet.ReadUInt64("RafAcceptanceID"); + packet.ReadUInt64_Sanitize("RafAcceptanceID"); if (Settings.UseDBC) if (DBC.Criteria.ContainsKey(criteriaId)) diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/AuthenticationHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/AuthenticationHandler.cs index 3ea659a690..0f4bed77ad 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/AuthenticationHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/AuthenticationHandler.cs @@ -12,13 +12,13 @@ public static void HandleAuthSession(Packet packet) packet.ReadUInt64("DosResponse"); packet.ReadUInt32("RegionID"); packet.ReadUInt32("BattlegroupID"); - packet.ReadUInt32("RealmID"); - packet.ReadBytes("LocalChallenge", 16); - packet.ReadBytes("Digest", 24); + packet.ReadUInt32_Sanitize("RealmID"); + packet.ReadBytes_Sanitize("LocalChallenge", 16); + packet.ReadBytes_Sanitize("Digest", 24); packet.ReadBit("UseIPv6"); var realmJoinTicketSize = packet.ReadInt32(); - packet.ReadBytes("RealmJoinTicket", realmJoinTicketSize); + packet.ReadBytes_Sanitize("RealmJoinTicket", realmJoinTicketSize); } [Parser(Opcode.SMSG_AUTH_RESPONSE)] @@ -30,7 +30,7 @@ public static void HandleAuthResponse(Packet packet) var queued = packet.ReadBit("Queued"); if (ok) { - packet.ReadUInt32("VirtualRealmAddress"); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); var realms = packet.ReadUInt32(); packet.ReadUInt32("TimeRested"); packet.ReadByte("ActiveExpansionLevel"); @@ -96,7 +96,7 @@ public static void HandleAuthResponse(Packet packet) for (var i = 0; i < realms; ++i) { - packet.ReadUInt32("RealmAddress", "VirtualRealms", i); + packet.ReadUInt32_Sanitize("RealmAddress", "VirtualRealms", i); packet.ResetBitReader(); packet.ReadBit("IsLocal", "VirtualRealms", i); packet.ReadBit("IsInternalRealm", "VirtualRealms", i); @@ -108,8 +108,8 @@ public static void HandleAuthResponse(Packet packet) var nameLen1 = packet.ReadBits(bitsCount); var nameLen2 = packet.ReadBits(bitsCount); - packet.ReadWoWString("RealmNameActual", nameLen1, "VirtualRealms", i); - packet.ReadWoWString("RealmNameNormalized", nameLen2, "VirtualRealms", i); + packet.ReadWoWString_Sanitize("RealmNameActual", nameLen1, "VirtualRealms", i); + packet.ReadWoWString_Sanitize("RealmNameNormalized", nameLen2, "VirtualRealms", i); } for (var i = 0; i < templates; ++i) diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/CalendarHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/CalendarHandler.cs index b765671e0b..a37f866e10 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/CalendarHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/CalendarHandler.cs @@ -37,7 +37,7 @@ public static void ReadCalendarSendCalendarEventInfo(Packet packet, params objec packet.ReadInt32("Flags", indexes); packet.ReadInt32("TextureID", indexes); - packet.ReadUInt64("CommunityID", indexes); + packet.ReadUInt64_Sanitize("CommunityID", indexes); packet.ReadPackedGuid128("OwnerGUID", indexes); packet.ResetBitReader(); diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/ChannelHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/ChannelHandler.cs index 3e55c3a5c3..5c23ee939a 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/ChannelHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/ChannelHandler.cs @@ -49,7 +49,7 @@ public static void HandleChannelJoin(Packet packet) packet.ResetBitReader(); packet.ReadWoWString("ChannelName", channelLength); - packet.ReadWoWString("Password", passwordLength); + packet.ReadWoWString_Sanitize("Password", passwordLength); } [Parser(Opcode.CMSG_CHAT_MESSAGE_GUILD, ClientVersionBuild.V8_1_0_28724)] @@ -61,7 +61,7 @@ public static void HandleClientChatMessage(Packet packet) { packet.ReadInt32E("Language"); var len = packet.ReadBits(10); - packet.ReadWoWString("Text", len); + packet.ReadWoWString_Sanitize("Text", len); } [Parser(Opcode.CMSG_CHAT_MESSAGE_WHISPER, ClientVersionBuild.V8_1_0_28724)] @@ -71,8 +71,8 @@ public static void HandleClientChatMessageWhisper(Packet packet) var recvName = packet.ReadBits(9); var msgLen = packet.ReadBits(10); - packet.ReadWoWString("Target", recvName); - packet.ReadWoWString("Text", msgLen); + packet.ReadWoWString_Sanitize("Target", recvName); + packet.ReadWoWString_Sanitize("Text", msgLen); } } } diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/CharacterHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/CharacterHandler.cs index 105b2334b7..c42412628c 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/CharacterHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/CharacterHandler.cs @@ -88,7 +88,7 @@ public static void ReadPlayerModelDisplayInfo(Packet packet, params object[] idx packet.ReadByteE("ClassID", idx); for (int i = 0; i < 3; i++) packet.ReadByte("CustomDisplay", idx); - packet.ReadWoWString("Name", nameLen, idx); + packet.ReadWoWString_Sanitize("Name", nameLen, idx); for (int i = 0; i < itemCount; i++) ReadInspectItemData(packet, idx, i); @@ -107,14 +107,14 @@ public static PlayerGuidLookupData ReadPlayerGuidLookupData(Packet packet, param count[i] = (int)packet.ReadBits(7); for (var i = 0; i < 5; ++i) - packet.ReadWoWString("Name Declined", count[i], i, idx); + packet.ReadWoWString_Sanitize("Name Declined", i, idx); packet.ReadPackedGuid128("AccountID", idx); packet.ReadPackedGuid128("BnetAccountID", idx); packet.ReadPackedGuid128("Player Guid", idx); - packet.ReadUInt64("GuildClubMemberID", idx); - packet.ReadUInt32("VirtualRealmAddress", idx); + packet.ReadUInt64_Sanitize("GuildClubMemberID"); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); data.Race = packet.ReadByteE("Race", idx); data.Gender = packet.ReadByteE("Gender", idx); @@ -124,7 +124,7 @@ public static PlayerGuidLookupData ReadPlayerGuidLookupData(Packet packet, param if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_1_5_40772)) packet.ReadByte("Unused915", idx); - data.Name = packet.ReadWoWString("Name", bits15, idx); + data.Name = packet.ReadWoWString_Sanitize("Name", bits15); return data; } @@ -154,7 +154,7 @@ public static void ReadCharactersData(Packet packet, params object[] idx) { packet.ReadPackedGuid128("Guid", idx); - packet.ReadUInt64("GuildClubMemberID", idx); + packet.ReadUInt64_Sanitize("GuildClubMemberID", idx); packet.ReadByte("ListPosition", idx); var race = packet.ReadByteE("RaceID", idx); @@ -218,7 +218,7 @@ public static void ReadCharactersData(Packet packet, params object[] idx) if (mailSenderLengths[j] > 1) packet.ReadDynamicString("MailSender", mailSenderLengths[j], idx); - packet.ReadWoWString("Character Name", nameLength, idx); + packet.ReadWoWString_Sanitize("Character Name", nameLength, idx); if (firstLogin) { @@ -402,7 +402,7 @@ public static void HandleClientCharCreate(Packet packet) for (var i = 0; i < 3; i++) packet.ReadByte("CustomDisplay", i); - packet.ReadWoWString("Name", nameLen); + packet.ReadWoWString_Sanitize("Name", nameLen); if (hasTemplateSet) packet.ReadInt32("TemplateSetID"); diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/ChatHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/ChatHandler.cs index 9ed55ae3db..512ef8a9c0 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/ChatHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/ChatHandler.cs @@ -21,8 +21,8 @@ public static void ReadChatAddonMessageParams(Packet packet, params object[] ind packet.ReadBit("IsLogged", indexes); packet.ReadInt32("Type", indexes); - packet.ReadWoWString("Prefix", prefixLen, indexes); - packet.ReadWoWString("Text", textLen, indexes); + packet.ReadWoWString_Sanitize("Prefix", prefixLen, indexes); + packet.ReadWoWString_Sanitize("Text", textLen, indexes); } [Parser(Opcode.SMSG_CHAT)] @@ -39,8 +39,8 @@ public static void HandleServerChatMessage(Packet packet) packet.ReadPackedGuid128("SenderGuildGUID"); packet.ReadPackedGuid128("WowAccountGUID"); text.ReceiverGUID = packet.ReadPackedGuid128("TargetGUID"); - packet.ReadUInt32("TargetVirtualAddress"); - packet.ReadUInt32("SenderVirtualAddress"); + packet.ReadUInt32_Sanitize("TargetVirtualAddress"); + packet.ReadUInt32_Sanitize("SenderVirtualAddress"); packet.ReadPackedGuid128("PartyGUID"); packet.ReadInt32("AchievementID"); packet.ReadSingle("DisplayTime"); @@ -60,21 +60,11 @@ public static void HandleServerChatMessage(Packet packet) packet.ReadBit("FakeSenderName"); bool unk801bit = packet.ReadBit("Unk801_Bit"); - text.SenderName = packet.ReadWoWString("Sender Name", senderNameLen); - text.ReceiverName = packet.ReadWoWString("Receiver Name", receiverNameLen); + text.SenderName = packet.ReadWoWString_Sanitize("Sender Name", senderNameLen); + text.ReceiverName = packet.ReadWoWString_Sanitize("Receiver Name", receiverNameLen); packet.ReadWoWString("Addon Message Prefix", prefixLen); packet.ReadWoWString("Channel Name", channelLen); - chatPacket.Text = text.Text = packet.ReadWoWString("Text", textLen); - chatPacket.Sender = text.SenderGUID.ToUniversalGuid(); - chatPacket.Target = text.ReceiverGUID.ToUniversalGuid(); - chatPacket.Language = (int) text.Language; - chatPacket.Type = (int) text.Type; - chatPacket.Flags = flags; - - if (unk801bit) - packet.ReadUInt32("Unk801"); - uint entry = 0; if (text.SenderGUID.GetObjectType() == ObjectType.Unit) entry = text.SenderGUID.GetEntry(); @@ -82,7 +72,21 @@ public static void HandleServerChatMessage(Packet packet) entry = text.ReceiverGUID.GetEntry(); if (entry != 0) + { + chatPacket.Text = text.Text = text.Text = packet.ReadWoWString("Text", textLen); Storage.CreatureTexts.Add(entry, text, packet.TimeSpan); + } + else + chatPacket.Text = text.Text = text.Text = packet.ReadWoWString_Sanitize("Text", textLen); + + chatPacket.Sender = text.SenderGUID.ToUniversalGuid(); + chatPacket.Target = text.ReceiverGUID.ToUniversalGuid(); + chatPacket.Language = (int)text.Language; + chatPacket.Type = (int)text.Type; + chatPacket.Flags = flags; + + if (unk801bit) + packet.ReadUInt32("Unk801"); } [Parser(Opcode.CMSG_CHAT_ADDON_MESSAGE)] @@ -98,7 +102,7 @@ public static void HandleChatAddonMessageTargeted(Packet packet) ReadChatAddonMessageParams(packet, "Params"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_1_0_39185)) packet.ReadPackedGuid128("ChannelGUID"); - packet.ReadWoWString("Target", targetLen); + packet.ReadWoWString_Sanitize("Target", targetLen); } } } diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/GroupHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/GroupHandler.cs index 9a522edb11..90a02b9f06 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/GroupHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/GroupHandler.cs @@ -46,7 +46,7 @@ public static void HandlePartyUpdate(Packet packet) if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_2_5_43903)) packet.ReadByte("FactionGroup", i); - packet.ReadWoWString("Name", playerNameLength, i); + packet.ReadWoWString_Sanitize("Name", playerNameLength, i); packet.ReadDynamicString("VoiceStateID", voiceStateLength, i); } diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/GuildHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/GuildHandler.cs index 41df3fe5d2..9d4602de90 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/GuildHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/GuildHandler.cs @@ -17,7 +17,7 @@ public static void HandleGuildQueryResponse(Packet packet) if (hasData) { packet.ReadPackedGuid128("GuildGUID"); - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var rankCount = packet.ReadInt32("RankCount"); packet.ReadInt32("EmblemColor"); packet.ReadInt32("EmblemStyle"); @@ -35,10 +35,10 @@ public static void HandleGuildQueryResponse(Packet packet) packet.ResetBitReader(); var rankNameLen = packet.ReadBits(7); - packet.ReadWoWString("Rank Name", rankNameLen, i); + packet.ReadWoWString_Sanitize("Rank Name", rankNameLen, i); } - packet.ReadWoWString("Guild Name", nameLen); + packet.ReadWoWString_Sanitize("Guild Name", nameLen); } } @@ -76,7 +76,7 @@ public static void HandleGuildRoster(Packet packet) packet.ReadUInt32("Step", i, j); } - packet.ReadUInt32("VirtualRealmAddress", i); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", i); packet.ReadByteE("Status", i); packet.ReadByte("Level", i); @@ -92,13 +92,13 @@ public static void HandleGuildRoster(Packet packet) packet.ReadBit("Authenticated", i); packet.ReadBit("SorEligible", i); - packet.ReadWoWString("Name", nameLen, i); - packet.ReadWoWString("Note", noteLen, i); - packet.ReadWoWString("OfficerNote", officersNoteLen, i); + packet.ReadWoWString_Sanitize("Name", nameLen, i); + packet.ReadWoWString_Sanitize("Note", noteLen, i); + packet.ReadWoWString_Sanitize("OfficerNote", officersNoteLen, i); } - packet.ReadWoWString("WelcomeText", welcomeTextLen); - packet.ReadWoWString("InfoText", infoTextLen); + packet.ReadWoWString_Sanitize("WelcomeText", welcomeTextLen); + packet.ReadWoWString_Sanitize("InfoText", infoTextLen); } [Parser(Opcode.SMSG_GUILD_BANK_QUERY_RESULTS, ClientVersionBuild.V7_2_0_23826)] @@ -180,7 +180,7 @@ public static void HandleGuildRewardsList(Packet packet) public static void HandleEventMotd(Packet packet) { var motdLen = packet.ReadBits(11); - packet.ReadWoWString("MotdText", motdLen); + packet.ReadWoWString_Sanitize("MotdText", motdLen); } [Parser(Opcode.CMSG_GUILD_SET_RANK_PERMISSIONS, ClientVersionBuild.V8_2_5_31921)] diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/HotfixHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/HotfixHandler.cs index 9559efd894..296c101275 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/HotfixHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/HotfixHandler.cs @@ -150,7 +150,7 @@ public static void HandleHotfixQuery815(Packet packet) [Parser(Opcode.SMSG_AVAILABLE_HOTFIXES, ClientVersionBuild.V8_1_0_28724, ClientVersionBuild.V8_1_5_29683)] public static void HandleHotfixList(Packet packet) { - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var hotfixCount = packet.ReadUInt32("HotfixCount"); for (var i = 0u; i < hotfixCount; ++i) { @@ -164,7 +164,7 @@ public static void HandleHotfixList(Packet packet) [Parser(Opcode.SMSG_AVAILABLE_HOTFIXES, ClientVersionBuild.V8_1_5_29683)] public static void HandleHotfixList815(Packet packet) { - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var hotfixCount = packet.ReadUInt32("HotfixCount"); for (var i = 0u; i < hotfixCount; ++i) { diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/InstanceHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/InstanceHandler.cs index a9418df46e..beca97f733 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/InstanceHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/InstanceHandler.cs @@ -59,7 +59,7 @@ public static void HandleCUFProfiles(Packet packet) packet.ReadInt16("BottomOffset", i); packet.ReadInt16("LeftOffset", i); - packet.ReadWoWString("Name", strlen, i); + packet.ReadWoWString_Sanitize("Name", strlen, i); } } } diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/MiscellaneousHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/MiscellaneousHandler.cs index 820754c0d5..cef6997b73 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/MiscellaneousHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/MiscellaneousHandler.cs @@ -21,8 +21,8 @@ public static void HandleFeatureSystemStatus(Packet packet) packet.ReadUInt32("ScrollOfResurrectionRequestsRemaining"); packet.ReadUInt32("ScrollOfResurrectionMaxRequestsPerDay"); - packet.ReadUInt32("CfgRealmID"); - packet.ReadInt32("CfgRealmRecID"); + packet.ReadUInt32_Sanitize("CfgRealmID"); + packet.ReadInt32_Sanitize("CfgRealmRecID"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V8_2_5_31921)) { @@ -193,7 +193,7 @@ public static void HandleLightningStorm(Packet packet) public static void HandleQueryPlayerNameByCommunityID(Packet packet) { packet.ReadPackedGuid128("BNetAccountGUID"); - packet.ReadUInt64("CommunityDbID"); + packet.ReadUInt64_Sanitize("CommunityDbID"); } [Parser(Opcode.SMSG_UPDATE_EXPANSION_LEVEL)] @@ -227,14 +227,14 @@ public static void ReadWhoEntry(Packet packet, params object[] idx) packet.ReadPackedGuid128("GuildGUID", idx); - packet.ReadUInt32("GuildVirtualRealmAddress", idx); + packet.ReadUInt32_Sanitize("GuildVirtualRealmAddress", idx); packet.ReadInt32("AreaID", idx); packet.ResetBitReader(); var guildNameLen = packet.ReadBits(7); packet.ReadBit("IsGM", idx); - packet.ReadWoWString("GuildName", guildNameLen, idx); + packet.ReadWoWString_Sanitize("GuildName", guildNameLen, idx); } [Parser(Opcode.SMSG_WHO)] diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/SessionHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/SessionHandler.cs index 843a208b56..19e4a94ee3 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/SessionHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/SessionHandler.cs @@ -11,14 +11,14 @@ public static void HandleUpdateBnetSessionKey(Packet packet) { var sessionKeyLength = (int) packet.ReadBits(7); - packet.ReadBytes("Digest", 32); - packet.ReadBytes("SessionKey", sessionKeyLength); + packet.ReadBytes_Sanitize("Digest", 32); + packet.ReadBytes_Sanitize("SessionKey", sessionKeyLength); } [Parser(Opcode.SMSG_REALM_QUERY_RESPONSE, ClientVersionBuild.V8_1_0_28724)] public static void HandleRealmQueryResponse(Packet packet) { - packet.ReadUInt32("VirtualRealmAddress"); + packet.ReadUInt32_Sanitize("VirtualRealmAddress"); var state = packet.ReadByte("LookupState"); if (state == 0) @@ -32,8 +32,8 @@ public static void HandleRealmQueryResponse(Packet packet) var bits258 = packet.ReadBits(9); packet.ReadBit(); - packet.ReadWoWString("RealmNameActual", bits2); - packet.ReadWoWString("RealmNameNormalized", bits258); + packet.ReadWoWString_Sanitize("RealmNameActual", bits2); + packet.ReadWoWString_Sanitize("RealmNameNormalized", bits258); } } @@ -47,7 +47,7 @@ public static void HandleBattleNetConnectionStatus(Packet packet) [Parser(Opcode.SMSG_ENTER_ENCRYPTED_MODE, ClientVersionBuild.V8_2_0_30898)] public static void HandleEnterEncryptedMode(Packet packet) { - packet.ReadBytes("EncryptionKey (RSA encrypted)", 256); + packet.ReadBytes_Sanitize("EncryptionKey (RSA encrypted)", 256); packet.ResetBitReader(); packet.ReadBit("Enabled"); } @@ -55,19 +55,19 @@ public static void HandleEnterEncryptedMode(Packet packet) [Parser(Opcode.SMSG_CONNECT_TO, ClientVersionBuild.V8_2_0_30898)] public static void HandleRedirectClient(Packet packet) { - packet.ReadBytes("Where (RSA encrypted)", 256); + packet.ReadBytes_Sanitize("Where (RSA encrypted)", 256); AddressType type = packet.ReadByteE("Type"); switch (type) { case AddressType.IPv4: - packet.ReadIPAddress("Address"); + packet.ReadIPAddress_Sanitize("Address"); break; case AddressType.IPv6: - packet.ReadIPv6Address("Address"); + packet.ReadIPv6Address_Sanitize("Address"); break; case AddressType.NamedSocket: - packet.ReadWoWString("Address", 128); + packet.ReadWoWString_Sanitize("Address", 128); break; default: break; @@ -76,7 +76,7 @@ public static void HandleRedirectClient(Packet packet) packet.ReadUInt16("Port"); packet.ReadUInt32E("Serial"); packet.ReadByte("Con"); - packet.ReadUInt64("Key"); + packet.ReadUInt64_Sanitize("Key"); } } } diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/SpellHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/SpellHandler.cs index fa516a16fd..c8d6a3e4be 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/SpellHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/SpellHandler.cs @@ -83,7 +83,7 @@ public static void ReadSpellTargetData(Packet packet, PacketSpellData packetSpel } } - packet.ReadWoWString("Name", nameLength, idx); + packet.ReadWoWString_Sanitize("Name", nameLength, idx); } public static void ReadTalentGroupInfo(Packet packet, params object[] idx) diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/TicketHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/TicketHandler.cs index 4e69948d4b..ada8f60d6f 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/TicketHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/TicketHandler.cs @@ -18,12 +18,12 @@ public static void ReadHorusChatLine(Packet packet, params object[] indexes) var textLen = packet.ReadBits(12); if (hasClubID) - packet.ReadUInt64("ClubID", indexes); + packet.ReadUInt64_Sanitize("ClubID", indexes); if (hasChannelGUID) packet.ReadPackedGuid128("ChannelGUID", indexes); if (hasRealmAddress) { - packet.ReadUInt32("VirtualRealmAddress", indexes); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", indexes); packet.ReadUInt16("field_4", indexes); packet.ReadByte("field_6", indexes); } @@ -42,11 +42,11 @@ public static void ReadHorusChatLog(Packet packet, params object[] indexes) public static void ReadClubFinderResult(Packet packet, params object[] indexes) { - packet.ReadUInt64("ClubFinderPostingID", indexes); - packet.ReadUInt64("ClubID ", indexes); + packet.ReadUInt64_Sanitize("ClubFinderPostingID", indexes); + packet.ReadUInt64_Sanitize("ClubID ", indexes); packet.ReadPackedGuid128("ClubFinderGUID", indexes); var nameLen = packet.ReadBits(12); - packet.ReadWoWString("ClubName", nameLen, indexes); + packet.ReadWoWString_Sanitize("ClubName", nameLen, indexes); } public static void ReadUnused910(Packet packet, params object[] indexes) diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler810.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler810.cs index 304dff97c8..33b6712ea5 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler810.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler810.cs @@ -1531,7 +1531,7 @@ public override IPlayerData ReadCreatePlayerData(Packet packet, UpdateFieldFlag } data.PlayerTitle = packet.ReadInt32("PlayerTitle", indexes); data.FakeInebriation = packet.ReadInt32("FakeInebriation", indexes); - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); data.CurrentSpecID = packet.ReadUInt32("CurrentSpecID", indexes); data.TaxiMountAnimKitID = packet.ReadInt32("TaxiMountAnimKitID", indexes); for (var i = 0; i < 4; ++i) @@ -1672,7 +1672,7 @@ public override IPlayerData ReadUpdatePlayerData(Packet packet, params object[] } if (changesMask[24]) { - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); } if (changesMask[25]) { diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler815.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler815.cs index b2c5e610d5..c66630961b 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler815.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler815.cs @@ -1534,7 +1534,7 @@ public override IPlayerData ReadCreatePlayerData(Packet packet, UpdateFieldFlag } data.PlayerTitle = packet.ReadInt32("PlayerTitle", indexes); data.FakeInebriation = packet.ReadInt32("FakeInebriation", indexes); - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); data.CurrentSpecID = packet.ReadUInt32("CurrentSpecID", indexes); data.TaxiMountAnimKitID = packet.ReadInt32("TaxiMountAnimKitID", indexes); for (var i = 0; i < 4; ++i) @@ -1675,7 +1675,7 @@ public override IPlayerData ReadUpdatePlayerData(Packet packet, params object[] } if (changesMask[24]) { - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); } if (changesMask[25]) { diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler820.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler820.cs index 9c46dfd8db..497500a47f 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler820.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler820.cs @@ -1660,7 +1660,7 @@ public override IPlayerData ReadCreatePlayerData(Packet packet, UpdateFieldFlag } data.PlayerTitle = packet.ReadInt32("PlayerTitle", indexes); data.FakeInebriation = packet.ReadInt32("FakeInebriation", indexes); - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); data.CurrentSpecID = packet.ReadUInt32("CurrentSpecID", indexes); data.TaxiMountAnimKitID = packet.ReadInt32("TaxiMountAnimKitID", indexes); for (var i = 0; i < 4; ++i) @@ -1801,7 +1801,7 @@ public override IPlayerData ReadUpdatePlayerData(Packet packet, params object[] } if (changesMask[24]) { - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); } if (changesMask[25]) { diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler825.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler825.cs index f082f8a6f0..10999e9e6d 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler825.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler825.cs @@ -1667,7 +1667,7 @@ public override IPlayerData ReadCreatePlayerData(Packet packet, UpdateFieldFlag } data.PlayerTitle = packet.ReadInt32("PlayerTitle", indexes); data.FakeInebriation = packet.ReadInt32("FakeInebriation", indexes); - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); data.CurrentSpecID = packet.ReadUInt32("CurrentSpecID", indexes); data.TaxiMountAnimKitID = packet.ReadInt32("TaxiMountAnimKitID", indexes); for (var i = 0; i < 4; ++i) @@ -1849,7 +1849,7 @@ public override IPlayerData ReadUpdatePlayerData(Packet packet, params object[] } if (changesMask[27]) { - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); } if (changesMask[28]) { diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler830.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler830.cs index 6d0b3ac290..f41b7e2295 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler830.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateFieldsHandler830.cs @@ -1672,7 +1672,7 @@ public override IPlayerData ReadCreatePlayerData(Packet packet, UpdateFieldFlag } data.PlayerTitle = packet.ReadInt32("PlayerTitle", indexes); data.FakeInebriation = packet.ReadInt32("FakeInebriation", indexes); - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); data.CurrentSpecID = packet.ReadUInt32("CurrentSpecID", indexes); data.TaxiMountAnimKitID = packet.ReadInt32("TaxiMountAnimKitID", indexes); for (var i = 0; i < 4; ++i) @@ -1854,7 +1854,7 @@ public override IPlayerData ReadUpdatePlayerData(Packet packet, params object[] } if (changesMask[27]) { - data.VirtualPlayerRealm = packet.ReadUInt32("VirtualPlayerRealm", indexes); + data.VirtualPlayerRealm = packet.ReadUInt32_Sanitize("VirtualPlayerRealm", indexes); } if (changesMask[28]) { diff --git a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateHandler.cs b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateHandler.cs index f6fcf470a0..e7530ea848 100644 --- a/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateHandler.cs +++ b/WowPacketParserModule.V8_0_1_27101/Parsers/UpdateHandler.cs @@ -67,9 +67,11 @@ public static void HandleUpdateObject(Packet packet) { var updatefieldSize = packet.ReadUInt32(); var handler = CoreFields.UpdateFields.GetHandler(); + var startPositionPacket = packet.BaseStream.Position; updateValues.Fields = new(); using (var fieldsData = new Packet(packet.ReadBytes((int)updatefieldSize), packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName)) { + var startPositionFieldsData = fieldsData.BaseStream.Position; WoWObject obj; Storage.Objects.TryGetValue(guid, out obj); @@ -135,6 +137,15 @@ public static void HandleUpdateObject(Packet packet) else if (conversation != null) conversation.ConversationData = data; } + + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + packet.BaseStream.Position = startPositionPacket; + fieldsData.BaseStream.Position = startPositionFieldsData; + + // Update the original packet with the sanitized fieldData + packet.BinaryWriter.Write(fieldsData.ReadBytes((int)updatefieldSize)); + } } } else @@ -175,8 +186,10 @@ private static void ReadCreateObjectBlock(Packet packet, CreateObject createObje { createObject.Values.Fields = new(); var updatefieldSize = packet.ReadUInt32(); + var startPositionPacket = packet.BaseStream.Position; using (var fieldsData = new Packet(packet.ReadBytes((int)updatefieldSize), packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName)) { + var startPositionFieldsData = fieldsData.BaseStream.Position; var flags = fieldsData.ReadByteE("FieldFlags", index); var handler = CoreFields.UpdateFields.GetHandler(); obj.ObjectData = handler.ReadCreateObjectData(fieldsData, flags, index); @@ -235,6 +248,15 @@ private static void ReadCreateObjectBlock(Packet packet, CreateObject createObje (obj as ConversationTemplate).ConversationData = handler.ReadCreateConversationData(fieldsData, flags, index); break; } + + if (Settings.DumpFormat == DumpFormatType.SanitizedPkt) + { + packet.BaseStream.Position = startPositionPacket; + fieldsData.BaseStream.Position = startPositionFieldsData; + + // Update the original packet with the sanitized fieldData + packet.BinaryWriter.Write(fieldsData.ReadBytes((int)updatefieldSize)); + } } } else diff --git a/WowPacketParserModule.V9_0_1_36216/Parsers/AuthenticationHandler.cs b/WowPacketParserModule.V9_0_1_36216/Parsers/AuthenticationHandler.cs index 8c10b9cd65..ca22199b11 100644 --- a/WowPacketParserModule.V9_0_1_36216/Parsers/AuthenticationHandler.cs +++ b/WowPacketParserModule.V9_0_1_36216/Parsers/AuthenticationHandler.cs @@ -9,7 +9,7 @@ public static class AuthenticationHandler [Parser(Opcode.SMSG_ENTER_ENCRYPTED_MODE, ClientVersionBuild.V9_2_7_45114)] public static void HandleEnterEncryptedMode(Packet packet) { - packet.ReadBytes("Signature (ED25519)", 64); + packet.ReadBytes_Sanitize("Signature (ED25519)", 64); packet.ReadBit("Enabled"); } } diff --git a/WowPacketParserModule.V9_0_1_36216/Parsers/CharacterHandler.cs b/WowPacketParserModule.V9_0_1_36216/Parsers/CharacterHandler.cs index eb8a242ab2..d0497f5706 100644 --- a/WowPacketParserModule.V9_0_1_36216/Parsers/CharacterHandler.cs +++ b/WowPacketParserModule.V9_0_1_36216/Parsers/CharacterHandler.cs @@ -19,7 +19,7 @@ public static void ReadCharactersListEntry(Packet packet, params object[] idx) { var playerGuid = packet.ReadPackedGuid128("Guid", idx); - packet.ReadUInt64("GuildClubMemberID", idx); + packet.ReadUInt64_Sanitize("GuildClubMemberID", idx); packet.ReadByte("ListPosition", idx); var race = packet.ReadByteE("RaceID", idx); @@ -85,9 +85,9 @@ public static void ReadCharactersListEntry(Packet packet, params object[] idx) for (var j = 0; j < mailSenderLengths.Length; ++j) if (mailSenderLengths[j] > 1) - packet.ReadDynamicString("MailSender", mailSenderLengths[j], idx); + packet.ReadDynamicString_Sanitize("MailSender", mailSenderLengths[j], idx); - var name = packet.ReadWoWString("Character Name", nameLength, idx); + var name = packet.ReadWoWString_Sanitize("Character Name", nameLength, idx); if (firstLogin) { @@ -113,7 +113,7 @@ public static void ReadPlayerModelDisplayInfo(Packet packet, params object[] idx packet.ReadByteE("Race", idx); packet.ReadByteE("ClassID", idx); var customizationCount = packet.ReadUInt32(); - packet.ReadWoWString("Name", nameLen, idx); + packet.ReadWoWString_Sanitize("Name", nameLen, idx); for (var j = 0u; j < customizationCount; ++j) ReadChrCustomizationChoice(packet, idx, "Customizations", j); @@ -237,7 +237,7 @@ public static void HandleClientCharCreate(Packet packet) var customizationCount = packet.ReadUInt32(); - packet.ReadWoWString("Name", nameLen); + packet.ReadWoWString_Sanitize("Name", nameLen); if (hasTemplateSet) packet.ReadInt32("TemplateSetID"); @@ -257,7 +257,7 @@ public static void HandleCheckCharacterNameAvailabilityResult(Packet packet) public static void HandleCheckCharacterNameAvailability(Packet packet) { packet.ReadUInt32("SequenceIndex"); - packet.ReadWoWString("Character Name", packet.ReadBits(6)); + packet.ReadWoWString_Sanitize("Character Name", packet.ReadBits(6)); } } } diff --git a/WowPacketParserModule.V9_0_1_36216/Parsers/ChatHandler.cs b/WowPacketParserModule.V9_0_1_36216/Parsers/ChatHandler.cs index c9df2119a5..d83f041251 100644 --- a/WowPacketParserModule.V9_0_1_36216/Parsers/ChatHandler.cs +++ b/WowPacketParserModule.V9_0_1_36216/Parsers/ChatHandler.cs @@ -23,8 +23,8 @@ public static void HandleServerChatMessage(Packet packet) packet.ReadPackedGuid128("SenderGuildGUID"); packet.ReadPackedGuid128("WowAccountGUID"); text.ReceiverGUID = packet.ReadPackedGuid128("TargetGUID"); - packet.ReadUInt32("TargetVirtualAddress"); - packet.ReadUInt32("SenderVirtualAddress"); + packet.ReadUInt32_Sanitize("TargetVirtualAddress"); + packet.ReadUInt32_Sanitize("SenderVirtualAddress"); packet.ReadPackedGuid128("PartyGUID"); packet.ReadInt32("AchievementID"); packet.ReadSingle("DisplayTime"); @@ -43,16 +43,28 @@ public static void HandleServerChatMessage(Packet packet) if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_1_0_39185)) hasChannelGuid = packet.ReadBit("HasChannelGUID"); - text.SenderName = packet.ReadWoWString("Sender Name", senderNameLen); - text.ReceiverName = packet.ReadWoWString("Receiver Name", receiverNameLen); - packet.ReadWoWString("Addon Message Prefix", prefixLen); - packet.ReadWoWString("Channel Name", channelLen); + text.SenderName = packet.ReadWoWString_Sanitize("Sender Name", senderNameLen); + text.ReceiverName = packet.ReadWoWString_Sanitize("Receiver Name", receiverNameLen); + packet.ReadWoWString_Sanitize("Addon Message Prefix", prefixLen); + packet.ReadWoWString_Sanitize("Channel Name", channelLen); - chatPacket.Text = text.Text = packet.ReadWoWString("Text", textLen); + uint entry = 0; + if (text.SenderGUID.GetObjectType() == ObjectType.Unit) + entry = text.SenderGUID.GetEntry(); + else if (text.ReceiverGUID.GetObjectType() == ObjectType.Unit) + entry = text.ReceiverGUID.GetEntry(); + + if (entry != 0) + { + chatPacket.Text = text.Text = packet.ReadWoWString("Text", textLen); + Storage.CreatureTexts.Add(entry, text, packet.TimeSpan); + } + else + chatPacket.Text = text.Text = packet.ReadWoWString_Sanitize("Text", textLen); chatPacket.Sender = text.SenderGUID.ToUniversalGuid(); chatPacket.Target = text.ReceiverGUID.ToUniversalGuid(); - chatPacket.Language = (int) text.Language; - chatPacket.Type = (int) text.Type; + chatPacket.Language = (int)text.Language; + chatPacket.Type = (int)text.Type; chatPacket.Flags = flags; if (unk801bit) @@ -61,14 +73,6 @@ public static void HandleServerChatMessage(Packet packet) if (hasChannelGuid) packet.ReadPackedGuid128("ChannelGUID"); - uint entry = 0; - if (text.SenderGUID.GetObjectType() == ObjectType.Unit) - entry = text.SenderGUID.GetEntry(); - else if (text.ReceiverGUID.GetObjectType() == ObjectType.Unit) - entry = text.ReceiverGUID.GetEntry(); - - if (entry != 0) - Storage.CreatureTexts.Add(entry, text, packet.TimeSpan); } [Parser(Opcode.SMSG_EMOTE)] diff --git a/WowPacketParserModule.V9_0_1_36216/Parsers/GuildHandler.cs b/WowPacketParserModule.V9_0_1_36216/Parsers/GuildHandler.cs index b709b01807..24f1bc737a 100644 --- a/WowPacketParserModule.V9_0_1_36216/Parsers/GuildHandler.cs +++ b/WowPacketParserModule.V9_0_1_36216/Parsers/GuildHandler.cs @@ -12,7 +12,7 @@ public static void HandleGuildInviteByName(Packet packet) var nameLength = packet.ReadBits(9); var hasArenaTeamId = packet.ReadBit("HasArenaTeamId"); - packet.ReadWoWString("Name", nameLength); + packet.ReadWoWString_Sanitize("Name", nameLength); if (hasArenaTeamId) packet.ReadInt32("ArenaTeamId"); @@ -48,7 +48,7 @@ public static void HandleGuildRoster(Packet packet) packet.ReadUInt32("Step", i, j); } - packet.ReadUInt32("VirtualRealmAddress", i); + packet.ReadUInt32_Sanitize("VirtualRealmAddress", i); packet.ReadByteE("Status", i); packet.ReadByte("Level", i); diff --git a/WowPacketParserModule.V9_0_1_36216/Parsers/HotfixHandler.cs b/WowPacketParserModule.V9_0_1_36216/Parsers/HotfixHandler.cs index ad444902a8..54ebd5afae 100644 --- a/WowPacketParserModule.V9_0_1_36216/Parsers/HotfixHandler.cs +++ b/WowPacketParserModule.V9_0_1_36216/Parsers/HotfixHandler.cs @@ -330,7 +330,7 @@ public static void HandleHotfixRequest905(Packet packet) [Parser(Opcode.SMSG_AVAILABLE_HOTFIXES, ClientVersionBuild.V9_0_5_37503, ClientVersionBuild.V9_1_5_40772)] public static void HandleAvailableHotfixes905(Packet packet) { - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var hotfixCount = packet.ReadUInt32("HotfixCount"); for (var i = 0u; i < hotfixCount; ++i) packet.ReadInt32("HotfixID", i); @@ -339,7 +339,7 @@ public static void HandleAvailableHotfixes905(Packet packet) [Parser(Opcode.SMSG_AVAILABLE_HOTFIXES, ClientVersionBuild.V9_1_5_40772)] public static void HandleAvailableHotfixes915(Packet packet) { - packet.ReadInt32("VirtualRealmAddress"); + packet.ReadInt32_Sanitize("VirtualRealmAddress"); var hotfixCount = packet.ReadUInt32("HotfixCount"); for (var i = 0u; i < hotfixCount; ++i) { diff --git a/WowPacketParserModule.V9_0_1_36216/Parsers/MiscellaneousHandler.cs b/WowPacketParserModule.V9_0_1_36216/Parsers/MiscellaneousHandler.cs index 5999ccd4c8..3defa7e43f 100644 --- a/WowPacketParserModule.V9_0_1_36216/Parsers/MiscellaneousHandler.cs +++ b/WowPacketParserModule.V9_0_1_36216/Parsers/MiscellaneousHandler.cs @@ -22,8 +22,8 @@ public static void HandleFeatureSystemStatus(Packet packet) packet.ReadUInt32("ScrollOfResurrectionRequestsRemaining"); packet.ReadUInt32("ScrollOfResurrectionMaxRequestsPerDay"); - packet.ReadUInt32("CfgRealmID"); - packet.ReadInt32("CfgRealmRecID"); + packet.ReadUInt32_Sanitize("CfgRealmID"); + packet.ReadInt32_Sanitize("CfgRealmRecID"); packet.ReadUInt32("MaxRecruits", "RAFSystem"); packet.ReadUInt32("MaxRecruitMonths", "RAFSystem"); packet.ReadUInt32("MaxRecruitmentUses", "RAFSystem");