public void NatFullConeTest() { // clean all stuff in database new RedisClient().Db.Execute("FLUSHALL"); var serverMock = new Mock <IServer>(); serverMock.Setup(s => s.ServerID).Returns(new System.Guid()); serverMock.Setup(s => s.ServerName).Returns("NatNegotiation"); serverMock.Setup(s => s.Endpoint).Returns(new IPEndPoint(IPAddress.Any, 99)); var clientSessionMock = new Mock <IUdpSession>(); clientSessionMock.Setup(s => s.RemoteIPEndPoint).Returns(new IPEndPoint(IPAddress.Parse("192.168.1.2"), 9999)); clientSessionMock.Setup(s => s.Server).Returns(serverMock.Object); clientSessionMock.Setup(s => s.ConnectionType).Returns(NetworkConnectionType.Udp); clientSessionMock.Setup(s => s.SessionExistedTime).Returns(new System.TimeSpan(0, 0, 0, 0, 0)); var client = new Client(clientSessionMock.Object); var serverSessionMock = new Mock <IUdpSession>(); serverSessionMock.Setup(s => s.RemoteIPEndPoint).Returns(new IPEndPoint(IPAddress.Parse("192.168.1.3"), 9999)); serverSessionMock.Setup(s => s.Server).Returns(serverMock.Object); serverSessionMock.Setup(s => s.ConnectionType).Returns(NetworkConnectionType.Udp); serverSessionMock.Setup(s => s.SessionExistedTime).Returns(new System.TimeSpan(0, 0, 0, 0, 0)); var server = new Client(serverSessionMock.Object); var clientInitGP = new byte[] { 0xFD, 0xFC, 0x1E, 0x66, 0x6A, 0xB2, 0x03, 0x00, 0x00, 0x00, 0x02, 0x9A, 0x00, 0x00, 0x01, 0x7F, 0x00, 0x01, 0x01, 0x00, 0x00, 0x67, 0x6D, 0x74, 0x65, 0x73, 0x74, 0x00 }; var clientInitNN1 = new byte[] { 0xFD, 0xFC, 0x1E, 0x66, 0x6A, 0xB2, 0x03, 0x00, 0x00, 0x00, 0x02, 0x9A, 0x01, 0x00, 0x01, 0x7F, 0x00, 0x01, 0x01, 0x00, 0x00, 0x67, 0x6D, 0x74, 0x65, 0x73, 0x74, 0x00 }; var clientInitNN2 = new byte[] { 0xFD, 0xFC, 0x1E, 0x66, 0x6A, 0xB2, 0x03, 0x00, 0x00, 0x00, 0x02, 0x9A, 0x02, 0x00, 0x01, 0x7F, 0x00, 0x01, 0x01, 0xBB, 0x37, 0x67, 0x6D, 0x74, 0x65, 0x73, 0x74, 0x00 }; var clientInitNN3 = new byte[] { 0xFD, 0xFC, 0x1E, 0x66, 0x6A, 0xB2, 0x03, 0x00, 0x00, 0x00, 0x02, 0x9A, 0x03, 0x00, 0x01, 0x7F, 0x00, 0x01, 0x01, 0xBB, 0x37, 0x67, 0x6D, 0x74, 0x65, 0x73, 0x74, 0x00 }; var serverInitGP = new byte[] { 0xFD, 0xFC, 0x1E, 0x66, 0x6A, 0xB2, 0x03, 0x00, 0x00, 0x00, 0x02, 0x9A, 0x00, 0x01, 0x01, 0x7F, 0x00, 0x01, 0x01, 0x00, 0x00, 0x67, 0x6D, 0x74, 0x65, 0x73, 0x74, 0x00 }; var serverInitNN1 = new byte[] { 0xFD, 0xFC, 0x1E, 0x66, 0x6A, 0xB2, 0x03, 0x00, 0x00, 0x00, 0x02, 0x9A, 0x01, 0x01, 0x01, 0x7F, 0x00, 0x01, 0x01, 0x00, 0x00, 0x67, 0x6D, 0x74, 0x65, 0x73, 0x74, 0x00 }; var serverInitNN2 = new byte[] { 0xFD, 0xFC, 0x1E, 0x66, 0x6A, 0xB2, 0x03, 0x00, 0x00, 0x00, 0x02, 0x9A, 0x02, 0x01, 0x01, 0x7F, 0x00, 0x01, 0x01, 0xD2, 0xAE, 0x67, 0x6D, 0x74, 0x65, 0x73, 0x74, 0x00 }; var serverInitNN3 = new byte[] { 0xFD, 0xFC, 0x1E, 0x66, 0x6A, 0xB2, 0x03, 0x00, 0x00, 0x00, 0x02, 0x9A, 0x03, 0x01, 0x01, 0x7F, 0x00, 0x01, 0x01, 0xD2, 0xAE, 0x67, 0x6D, 0x74, 0x65, 0x73, 0x74, 0x00 }; var clientRequests = new List <byte[]> { clientInitGP, clientInitNN1, clientInitNN2, clientInitNN3 }; var serverRequests = new List <byte[]> { serverInitGP, serverInitNN1, serverInitNN2, serverInitNN3 }; Client.ClientPool.Add(client.Session.RemoteIPEndPoint, client); Client.ClientPool.Add(server.Session.RemoteIPEndPoint, server); foreach (var request in clientRequests) { var switcher = new CmdSwitcher(client, request); switcher.Switch(); } foreach (var request in serverRequests) { var switcher = new CmdSwitcher(server, request); switcher.Switch(); } }
public void Worms3d() { var raw = new byte[] { 0x03, 0x51, 0x5d, 0xa0 , 0xe8, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x70, 0x30, 0x00, 0x31, 0x39, 0x32, 0x2e, 0x31, 0x36 , 0x38, 0x2e, 0x30, 0x2e, 0x36, 0x30, 0x00, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x70, 0x6f, 0x72, 0x74 , 0x00, 0x36, 0x35, 0x30, 0x30, 0x00, 0x6e, 0x61, 0x74, 0x6e, 0x65, 0x67, 0x00, 0x31, 0x00, 0x73 , 0x74, 0x61, 0x74, 0x65, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x00, 0x33, 0x00, 0x67, 0x61 , 0x6d, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x77, 0x6f, 0x72, 0x6d, 0x73, 0x33, 0x00, 0x68, 0x6f , 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x74, 0x65, 0x73, 0x74, 0x00, 0x67, 0x61, 0x6d, 0x65 , 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x6f, 0x70, 0x65, 0x6e, 0x73, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67 , 0x00, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x64, 0x00, 0x36, 0x32, 0x32, 0x00, 0x6e, 0x75, 0x6d , 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x31, 0x00, 0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61 , 0x79, 0x65, 0x72, 0x73, 0x00, 0x32, 0x00, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x00 , 0x74, 0x65, 0x73, 0x74, 0x00, 0x68, 0x6f, 0x73, 0x74, 0x70, 0x6f, 0x72, 0x74, 0x00, 0x00, 0x6d , 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x32, 0x00, 0x6e, 0x75, 0x6d, 0x70 , 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x31, 0x00, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x43 , 0x68, 0x61, 0x6e, 0x67, 0x69, 0x6e, 0x67, 0x00, 0x30, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65 , 0x72, 0x00, 0x31, 0x30, 0x37, 0x33, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x00 , 0x00, 0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x66, 0x69, 0x72, 0x65, 0x77, 0x61 , 0x6c, 0x6c, 0x00, 0x30, 0x00, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x69, 0x70, 0x00, 0x32, 0x35 , 0x35, 0x2e, 0x32, 0x35, 0x35, 0x2e, 0x32, 0x35, 0x35, 0x2e, 0x32, 0x35, 0x35, 0x00, 0x70, 0x72 , 0x69, 0x76, 0x61, 0x74, 0x65, 0x69, 0x70, 0x00, 0x31, 0x39, 0x32, 0x2e, 0x31, 0x36, 0x38, 0x2e , 0x30, 0x2e, 0x36, 0x30, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x6f, 0x70 , 0x65, 0x6e, 0x73, 0x74, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x00, 0x76, 0x61, 0x6c, 0x00, 0x30, 0x00 , 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x70, 0x6c , 0x61, 0x79, 0x65, 0x72, 0x5f, 0x00, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x68, 0x6f, 0x73, 0x74 , 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x68, 0x6f, 0x73, 0x74, 0x70, 0x6f, 0x72, 0x74, 0x00, 0x6d, 0x61 , 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79 , 0x65, 0x72, 0x73, 0x00, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x69 , 0x6e, 0x67, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x74 , 0x79, 0x70, 0x65, 0x00, 0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x66, 0x69, 0x72, 0x65 , 0x77, 0x61, 0x6c, 0x6c, 0x00, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x69, 0x70, 0x00, 0x70, 0x72 , 0x69, 0x76, 0x61, 0x74, 0x65, 0x69, 0x70, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x6d, 0x6f, 0x64, 0x65 , 0x00, 0x76, 0x61, 0x6c, 0x00, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x00, 0x00, 0x77 , 0x6f, 0x72, 0x6d, 0x73, 0x31, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x30 , 0x37, 0x33, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x35, 0x35, 0x2e, 0x32, 0x35, 0x35, 0x2e, 0x32 , 0x35, 0x35, 0x2e, 0x32, 0x35, 0x35, 0x00, 0x31, 0x39, 0x32, 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x30 , 0x2e, 0x36, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61 , 0x6d, 0x65, 0x00, 0x68, 0x6f, 0x73, 0x74, 0x70, 0x6f, 0x72, 0x74, 0x00, 0x6d, 0x61, 0x78, 0x70 , 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72 , 0x73, 0x00, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x69, 0x6e, 0x67 , 0x00, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x74, 0x79, 0x70 , 0x65, 0x00, 0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x66, 0x69, 0x72, 0x65, 0x77, 0x61 , 0x6c, 0x6c, 0x00, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x69, 0x70, 0x00, 0x70, 0x72, 0x69, 0x76 , 0x61, 0x74, 0x65, 0x69, 0x70, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x76 , 0x61, 0x6c, 0x00, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x00, 0x00 }; var switcher = new CmdSwitcher(_client, raw); switcher.Switch(); }
public void FaltOut2() { var raw = new byte[] { 0x03, 0xc2, 0x94, 0x1c, 0xe7, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x70, 0x30, 0x00, 0x31, 0x39 , 0x32, 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x30, 0x2e, 0x35, 0x30, 0x00, 0x6c, 0x6f, 0x63, 0x61, 0x6c , 0x69, 0x70, 0x31, 0x00, 0x31, 0x37, 0x32, 0x2e, 0x31, 0x36, 0x2e, 0x37, 0x34, 0x2e, 0x31, 0x00 , 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x70, 0x32, 0x00, 0x31, 0x37, 0x32, 0x2e, 0x31, 0x37, 0x2e , 0x30, 0x2e, 0x31, 0x00, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x70, 0x33, 0x00, 0x31, 0x39, 0x32 , 0x2e, 0x31, 0x36, 0x38, 0x2e, 0x31, 0x32, 0x32, 0x2e, 0x31, 0x00, 0x6c, 0x6f, 0x63, 0x61, 0x6c , 0x69, 0x70, 0x34, 0x00, 0x31, 0x37, 0x32, 0x2e, 0x31, 0x36, 0x2e, 0x36, 0x35, 0x2e, 0x31, 0x00 , 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x00, 0x32, 0x33, 0x37, 0x35, 0x36, 0x00 , 0x6e, 0x61, 0x74, 0x6e, 0x65, 0x67, 0x00, 0x31, 0x00, 0x73, 0x74, 0x61, 0x74, 0x65, 0x63, 0x68 , 0x61, 0x6e, 0x67, 0x65, 0x64, 0x00, 0x31, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x6e, 0x61, 0x6d, 0x65 , 0x00, 0x66, 0x6c, 0x61, 0x74, 0x6f, 0x75, 0x74, 0x32, 0x70, 0x63, 0x00, 0x70, 0x75, 0x62, 0x6c , 0x69, 0x63, 0x69, 0x70, 0x00, 0x30, 0x00, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x70, 0x6f, 0x72 , 0x74, 0x00, 0x30, 0x00, 0x68, 0x6f, 0x73, 0x74, 0x6b, 0x65, 0x79, 0x00, 0x2d, 0x38, 0x32, 0x30 , 0x39, 0x36, 0x36, 0x33, 0x32, 0x32, 0x00, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x00 , 0x53, 0x70, 0x6f, 0x72, 0x65, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x00, 0x46, 0x4f , 0x31, 0x34, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x00, 0x72, 0x61, 0x63, 0x65 , 0x00, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x00, 0x6e, 0x6f, 0x72 , 0x6d, 0x61, 0x6c, 0x5f, 0x72, 0x61, 0x63, 0x65, 0x00, 0x67, 0x61, 0x6d, 0x65, 0x6d, 0x6f, 0x64 , 0x65, 0x00, 0x6f, 0x70, 0x65, 0x6e, 0x77, 0x61, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x00, 0x6e, 0x75 , 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x31, 0x00, 0x6d, 0x61, 0x78, 0x70, 0x6c , 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x38, 0x00, 0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x00 , 0x54, 0x69, 0x6d, 0x62, 0x65, 0x72, 0x6c, 0x61, 0x6e, 0x64, 0x73, 0x5f, 0x31, 0x00, 0x74, 0x69 , 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x00, 0x30, 0x00, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f , 0x72, 0x64, 0x00, 0x30, 0x00, 0x63, 0x61, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x00, 0x30, 0x00 , 0x63, 0x61, 0x72, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x00, 0x30, 0x00, 0x72, 0x61, 0x63, 0x65 , 0x73, 0x5f, 0x70, 0x00, 0x31, 0x30, 0x30, 0x00, 0x64, 0x65, 0x72, 0x62, 0x69, 0x65, 0x73, 0x5f , 0x70, 0x00, 0x30, 0x00, 0x73, 0x74, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x70, 0x00, 0x30, 0x00, 0x6e , 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x5f, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x70, 0x00, 0x31, 0x30, 0x30 , 0x00, 0x70, 0x6f, 0x6e, 0x67, 0x5f, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x70, 0x00, 0x30, 0x00, 0x77 , 0x72, 0x65, 0x63, 0x6b, 0x5f, 0x64, 0x65, 0x72, 0x62, 0x79, 0x5f, 0x70, 0x00, 0x30, 0x00, 0x73 , 0x75, 0x72, 0x76, 0x69, 0x76, 0x6f, 0x72, 0x5f, 0x64, 0x65, 0x72, 0x62, 0x79, 0x5f, 0x70, 0x00 , 0x30, 0x00, 0x66, 0x72, 0x61, 0x67, 0x5f, 0x64, 0x65, 0x72, 0x62, 0x79, 0x5f, 0x70, 0x00, 0x30 , 0x00, 0x74, 0x61, 0x67, 0x5f, 0x70, 0x00, 0x30, 0x00, 0x75, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65 , 0x73, 0x00, 0x32, 0x00, 0x6e, 0x69, 0x74, 0x72, 0x6f, 0x5f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x65 , 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x32, 0x00, 0x64, 0x61, 0x6d, 0x61, 0x67, 0x65, 0x5f , 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x00, 0x32, 0x00, 0x64, 0x65, 0x72, 0x62, 0x79, 0x5f, 0x64, 0x61 , 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x00, 0x31, 0x00, 0x6e, 0x65, 0x78 , 0x74, 0x5f, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x00, 0x6e, 0x6f, 0x72, 0x6d , 0x61, 0x6c, 0x5f, 0x72, 0x61, 0x63, 0x65, 0x00, 0x6c, 0x61, 0x70, 0x73, 0x5f, 0x6f, 0x72, 0x5f , 0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x00, 0x34, 0x00, 0x6e, 0x75, 0x6d, 0x5f , 0x72, 0x61, 0x63, 0x65, 0x73, 0x00, 0x31, 0x00, 0x6e, 0x75, 0x6d, 0x5f, 0x64, 0x65, 0x72, 0x62 , 0x69, 0x65, 0x73, 0x00, 0x30, 0x00, 0x6e, 0x75, 0x6d, 0x5f, 0x73, 0x74, 0x75, 0x6e, 0x74, 0x73 , 0x00, 0x30, 0x00, 0x64, 0x61, 0x74, 0x61, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x00 , 0x33, 0x35, 0x34, 0x36, 0x64, 0x35, 0x38, 0x30, 0x39, 0x33, 0x32, 0x33, 0x37, 0x65, 0x62, 0x33 , 0x33, 0x62, 0x32, 0x61, 0x39, 0x36, 0x62, 0x62, 0x38, 0x31, 0x33, 0x33, 0x37, 0x30, 0x64, 0x38 , 0x34, 0x36, 0x66, 0x66, 0x63, 0x65, 0x63, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; var switcher = new CmdSwitcher(_client, raw); switcher.Switch(); }
public void SwitcherTest() { // Given var requests = new List <string>() { RawRequests.LoginProfile, RawRequests.LoginPs3Cert, RawRequests.LoginRemoteAuth, RawRequests.LoginUniqueNick }; foreach (var req in requests) { var requestMock = new Mock <IHttpRequest>(); requestMock.Setup(r => r.Body).Returns(req); var sw = new CmdSwitcher(_client, requestMock.Object); sw.Switch(); } }