Esempio n. 1
0
        private void SimulateTownTeleports(Packet packet, Context context, Context remote_context, Context local_context)
        {
            DNSecurityAPI.Packet fakePacket = new DNSecurityAPI.Packet(0x02, 0x01);
            fakePacket.WriteUInt8Array(packet.ReadUInt8Array(0x04));          //World server ID probably?
            fakePacket.WriteUInt8Array(Encoding.ASCII.GetBytes("127.0.0.1")); //remote IP to connect to
            string remIP = Encoding.ASCII.GetString(packet.ReadUInt8Array(14));

            fakePacket.WriteUInt8Array(new byte[23]); //IP padding
            packet.ReadUInt8Array(18);
            ushort remPort    = packet.ReadUInt16();
            int    _localPort = FreeTcpPort();

            fakePacket.WriteUInt16(_localPort);                    //remote port
            fakePacket.WriteUInt8Array(packet.ReadUInt8Array(14)); //Rest of the packet.
            Utility.Hexdump(fakePacket, true);
            Console.WriteLine($"Should connect to {remIP}:{remPort}");
            new Thread(() => Program.Proxy(remIP, remPort, _localPort)).Start();
            Thread.Sleep(1000);
            context.RelaySecurity.Send(fakePacket);
        }