public void InjectPacket(byte[] Packet = null) { Shared.Streams.BitStream bs = new Shared.Streams.BitStream(); if (Packet == null) { BitStreamEditor.BitStreamAnalyzerForm _bseditor = new BitStreamEditor.BitStreamAnalyzerForm(bs); Application.Run(_bseditor); while (_bseditor.Visible) Thread.Sleep(100); } else { foreach (byte b in Packet) bs.WriteByte(b); } NetHandler.AuxServer.Broadcast(bs.ToByteArray()); StringBuilder _logEntry = new StringBuilder(); _logEntry.AppendLine("Packet Injected"); _logEntry.AppendLine(((bs.Length32 > 1) ? "[BitStream]\n" : "BitStream: ") + bs.ToString()); _logEntry.AppendLine("[Hex]\n" + DeepLogic.Core.HexUtils.HexView(bs.ToByteArray())); _logEntry.AppendLine(); DeepLogic.Core.ErrorHandler.Log("BitStream_BNET", "Notice", _logEntry.ToString()); if (!DeepLogic.Core.ErrorHandler.stdout) { Console.WriteLine(_logEntry.ToString()); } }
//Methods public void InspectStream(byte[] Data, DeepLogic.Object_Wrappers.NetworkClient User) { Shared.Streams.BitStream bs = new Shared.Streams.BitStream(); foreach (byte b in Data) bs.WriteByte(b); Application.Run(new BitStreamEditor.BitStreamAnalyzerForm(bs)); }
public void QueuePacket(byte[] Packet = null) { Shared.Streams.BitStream bs = new Shared.Streams.BitStream(); if (Packet == null) { BitStreamEditor.BitStreamAnalyzerForm _bseditor = new BitStreamEditor.BitStreamAnalyzerForm(bs); Application.Run(_bseditor); while (_bseditor.Visible) Thread.Sleep(100); } else { foreach (byte b in Packet) bs.WriteByte(b); } NetHandler.AuxServer.ReceivedDataHandler -= NetHandler.ProcessPacket; NetHandler.AuxServer.ReceivedDataHandler -= QueuePacket_Callback; NetHandler.AuxServer.ReceivedDataHandler += QueuePacket_Callback; PacketQueue.Enqueue(bs.ToByteArray()); StringBuilder _logEntry = new StringBuilder(); _logEntry.AppendLine("Packet Queued (" + PacketQueue.Count + " in queue)"); _logEntry.AppendLine(((bs.Length32 > 1)? "[BitStream]\n" : "BitStream: ") + bs.ToString()); _logEntry.AppendLine("[Hex]\n" + DeepLogic.Core.HexUtils.HexView(bs.ToByteArray())); _logEntry.AppendLine(); DeepLogic.Core.ErrorHandler.Log("BitStream_BNET", "Notice", _logEntry.ToString()); if (!DeepLogic.Core.ErrorHandler.stdout) { Console.WriteLine(_logEntry.ToString()); } }