public static void HandleCommand(Networking.Client client, IMessage packet)
        {
            var type = packet.GetType();

            if (type == typeof(ReverseProxyConnect))
            {
                client.ConnectReverseProxy((ReverseProxyConnect)packet);
            }
            else if (type == typeof(ReverseProxyData))
            {
                ReverseProxyData   dataCommand = (ReverseProxyData)packet;
                ReverseProxyClient proxyClient = client.GetReverseProxyByConnectionId(dataCommand.ConnectionId);

                if (proxyClient != null)
                {
                    proxyClient.SendToTargetServer(dataCommand.Data);
                }
            }
            else if (type == typeof(ReverseProxyDisconnect))
            {
                ReverseProxyDisconnect disconnectCommand = (ReverseProxyDisconnect)packet;
                ReverseProxyClient     socksClient       = client.GetReverseProxyByConnectionId(disconnectCommand.ConnectionId);

                if (socksClient != null)
                {
                    socksClient.Disconnect();
                }
            }
        }
Ejemplo n.º 2
0
        // Token: 0x0600056C RID: 1388 RVA: 0x00012E8C File Offset: 0x0001108C
        public static void HandleCommand(Client client, IPacket packet)
        {
            Type type = packet.GetType();

            if (type == typeof(ReverseProxyConnect))
            {
                client.ConnectReverseProxy((ReverseProxyConnect)packet);
                return;
            }
            if (type == typeof(ReverseProxyData))
            {
                ReverseProxyData   reverseProxyData           = (ReverseProxyData)packet;
                ReverseProxyClient reverseProxyByConnectionId = client.GetReverseProxyByConnectionId(reverseProxyData.ConnectionId);
                if (reverseProxyByConnectionId != null)
                {
                    reverseProxyByConnectionId.SendToTargetServer(reverseProxyData.Data);
                    return;
                }
            }
            else if (type == typeof(ReverseProxyDisconnect))
            {
                ReverseProxyDisconnect reverseProxyDisconnect      = (ReverseProxyDisconnect)packet;
                ReverseProxyClient     reverseProxyByConnectionId2 = client.GetReverseProxyByConnectionId(reverseProxyDisconnect.ConnectionId);
                if (reverseProxyByConnectionId2 != null)
                {
                    reverseProxyByConnectionId2.Disconnect();
                }
            }
        }
Ejemplo n.º 3
0
        public static void HandleCommand(Client client, IPacket packet)
        {
            var type = packet.GetType();

            if (type == typeof(ReverseProxyConnectResponse))
            {
                ReverseProxyConnectResponse response = (ReverseProxyConnectResponse)packet;
                if (client.Value.ProxyServer != null)
                {
                    ReverseProxyClient socksClient =
                        client.Value.ProxyServer.GetClientByConnectionId(response.ConnectionId);
                    if (socksClient != null)
                    {
                        socksClient.CommandResponse(response);
                    }
                }
            }
            else if (type == typeof(ReverseProxyData))
            {
                ReverseProxyData   dataCommand = (ReverseProxyData)packet;
                ReverseProxyClient socksClient =
                    client.Value.ProxyServer.GetClientByConnectionId(dataCommand.ConnectionId);

                if (socksClient != null)
                {
                    socksClient.SendToClient(dataCommand.Data);
                }
            }
            else if (type == typeof(ReverseProxyDisconnect))
            {
                ReverseProxyDisconnect disconnectCommand = (ReverseProxyDisconnect)packet;
                ReverseProxyClient     socksClient       =
                    client.Value.ProxyServer.GetClientByConnectionId(disconnectCommand.ConnectionId);

                if (socksClient != null)
                {
                    socksClient.Disconnect();
                }
            }
        }
Ejemplo n.º 4
0
        private void Execute(ISender client, ReverseProxyDisconnect message)
        {
            ReverseProxyClient socksClient = _socksServer.GetClientByConnectionId(message.ConnectionId);

            socksClient?.Disconnect();
        }