Exemplo n.º 1
0
 public static string smethod_1(byte byte_0)
 {
     byte[] array = new byte[]
     {
         byte_0
     };
     return(GClass124.smethod_3(array, false, array.Length));
 }
Exemplo n.º 2
0
 public static string smethod_2(byte[] byte_0, bool bool_0)
 {
     if (byte_0 == null)
     {
         throw new ArgumentNullException("data");
     }
     return(GClass124.smethod_3(byte_0, bool_0, byte_0.Length));
 }
Exemplo n.º 3
0
    public void Connect(string host, int port, bool forceNonLoopback = true, ProxySettings proxySettings = null)
    {
        this.method_8();
        this.method_4(new TcpClient());
        if (proxySettings != null)
        {
            try
            {
                GClass124 gclass = new GClass124(proxySettings.Host, proxySettings.Port, proxySettings.User, proxySettings.Password);
                this.method_4(gclass.imethod_7(host, port));
                goto IL_AC;
            }
            catch (Exception exception)
            {
                GClass91.GClass92.GDelegate6 disconnected = this.Disconnected;
                if (disconnected != null)
                {
                    disconnected(this, ErrorReason.ProxyError, exception);
                }
                return;
            }
        }
        if (forceNonLoopback)
        {
            this.method_3().Client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            GClass91.smethod_0(this.method_3().Client);
        }
        try
        {
            this.method_3().Connect(host, port);
        }
        catch (Exception exception2)
        {
            GClass91.GClass92.GDelegate6 disconnected2 = this.Disconnected;
            if (disconnected2 != null)
            {
                disconnected2(this, ErrorReason.ConnectionLost, exception2);
            }
            return;
        }
IL_AC:
        this.method_6(new Thread(new ThreadStart(this.method_7)));
        this.method_5().IsBackground = true;
        this.method_5().Start();
    }
Exemplo n.º 4
0
    private void method_9(byte[] byte_0, string string_3, int int_1)
    {
        byte b = byte_0[1];

        switch (byte_0[3])
        {
        case 1:
        {
            byte[] array = new byte[4];
            for (int i = 0; i < 4; i++)
            {
                array[i] = byte_0[i + 4];
            }
            new IPAddress(array).ToString();
            BitConverter.ToInt16(new byte[]
                {
                    byte_0[9],
                    byte_0[8]
                }, 0);
            break;
        }

        case 3:
        {
            int    num    = Convert.ToInt32(byte_0[4]);
            byte[] array2 = new byte[num];
            for (int j = 0; j < num; j++)
            {
                array2[j] = byte_0[j + 5];
            }
            Encoding.ASCII.GetString(array2);
            BitConverter.ToInt16(new byte[]
                {
                    byte_0[6 + num],
                    byte_0[5 + num]
                }, 0);
            break;
        }

        case 4:
        {
            byte[] array3 = new byte[16];
            for (int k = 0; k < 16; k++)
            {
                array3[k] = byte_0[k + 4];
            }
            new IPAddress(array3).ToString();
            BitConverter.ToInt16(new byte[]
                {
                    byte_0[21],
                    byte_0[20]
                }, 0);
            break;
        }
        }
        string text;

        switch (b)
        {
        case 1:
            text = "a general socks destination failure occurred";
            break;

        case 2:
            text = "the connection is not allowed by proxy destination rule set";
            break;

        case 3:
            text = "the network was unreachable";
            break;

        case 4:
            text = "the host was unreachable";
            break;

        case 5:
            text = "the connection was refused by the remote network";
            break;

        case 6:
            text = "the time to live (TTL) has expired";
            break;

        case 7:
            text = "the command issued by the proxy client is not supported by the proxy destination";
            break;

        case 8:
            text = "the address type specified is not supported";
            break;

        default:
            text = string.Format(CultureInfo.InvariantCulture, "an unknown SOCKS reply with the code value '{0}' was received", b.ToString(CultureInfo.InvariantCulture));
            break;
        }
        string text2 = (byte_0 != null) ? GClass124.smethod_0(byte_0) : "";

        throw new GException0(string.Format(CultureInfo.InvariantCulture, "proxy error: {0} for destination host {1} port number {2}.  Server response (hex): {3}.", new object[]
        {
            text,
            string_3,
            int_1,
            text2
        }));
    }