Пример #1
0
        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());
            }
        }
Пример #2
0
        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());
            }
        }