public static XmlElement CreatePacketElement(XmlDocument doc, TORCapturedPacket packet) { XmlElement element = doc.CreateElement("Packet"); element.Attributes.Append(CreateAttribute(doc, "Type", packet.Type.ToString())); return(element); }
public void PacketReceived(byte[] data, PacketDirection direction) { // let's split that into chunks of byte arrays List <byte[]> packets; switch (State) { case 0: case 1: packets = new List <byte[]>(); packets.Add(data); if (State == 1 || State == 3) { decrypter.LoadKeys(); } break; case 2: packets = decrypter.Decrypt(data, direction == PacketDirection.Client2Server); break; default: packets = new List <byte[]>(); break; } if (State == 0 || State == 1) { State++; } foreach (byte[] pktarray in packets) { int newid = CapturedPackets.Count <TORCapturedPacket>() > 0 ? CapturedPackets.Last <TORCapturedPacket>().ID + 1 : 1; TORCapturedPacket tpkt = new TORCapturedPacket(newid, _type == 4 ? TORPacketType.Shard : TORPacketType.Proxy, pktarray, this, direction); // todo: get packet name and opcode /*uint opcode = PacketIds.GetData(pktarray); * if (opcode == 0x90F2D084) * { * tpkt.Name = "SMsg_ShardServerAddress"; * }*/ CapturedPackets.Add(tpkt); } }
public static XmlElement CreatePacketElement(XmlDocument doc, TORCapturedPacket packet) { XmlElement element = doc.CreateElement("Packet"); element.Attributes.Append(CreateAttribute(doc, "Type", packet.Type.ToString())); return element; }
public void PacketReceived(byte[] data, PacketDirection direction) { // let's split that into chunks of byte arrays List<byte[]> packets; switch (State) { case 0: case 1: packets = new List<byte[]>(); packets.Add(data); if (State == 1 || State == 3) { decrypter.LoadKeys(); } break; case 2: packets = decrypter.Decrypt(data, direction == PacketDirection.Client2Server); break; default: packets = new List<byte[]>(); break; } if (State == 0 || State == 1) State++; foreach (byte[] pktarray in packets) { int newid = CapturedPackets.Count<TORCapturedPacket>() > 0 ? CapturedPackets.Last<TORCapturedPacket>().ID + 1 : 1; TORCapturedPacket tpkt = new TORCapturedPacket(newid, _type == 4 ? TORPacketType.Shard : TORPacketType.Proxy, pktarray, this, direction); // todo: get packet name and opcode /*uint opcode = PacketIds.GetData(pktarray); if (opcode == 0x90F2D084) { tpkt.Name = "SMsg_ShardServerAddress"; }*/ CapturedPackets.Add(tpkt); } }