Пример #1
0
        private void SaveAccountButton_Click(object sender, RoutedEventArgs e)
        {
            if (UsernameTextBox.Text == null || UsernameTextBox.Text.Trim() == "")
            {
                return;
            }
            Account account = new Account(UsernameTextBox.Text.Trim());

            if (PasswordTextBox.Password != "" && PasswordTextBox.Password != null)
            {
                account.Password = PasswordTextBox.Password;
            }
            if (IsBlueServer)
            {
                account.Server = "BLUE";
            }
            else
            {
                account.Server = "RED";
            }
            if (HasProxy)
            {
                SocksVersion socksVersion = SocksVersion.None;
                if (ProxyVersion == 4)
                {
                    socksVersion = SocksVersion.Socks4;
                }
                else if (ProxyVersion == 5)
                {
                    socksVersion = SocksVersion.Socks5;
                }
                account.Socks.Version = socksVersion;
                if (ProxyHostTextBox.Text != null && ProxyHostTextBox.Text.Trim() != "")
                {
                    account.Socks.Host = ProxyHostTextBox.Text.Trim();
                }
                if (ProxyPortTextBox.Text != null && ProxyPortTextBox.Text.Trim() != "")
                {
                    int port;
                    if (int.TryParse(ProxyPortTextBox.Text.Trim(), out port))
                    {
                        account.Socks.Port = port;
                    }
                }
                if (ProxyUsernameTextBox.Text != null && ProxyUsernameTextBox.Text.Trim() != "")
                {
                    account.Socks.Username = ProxyUsernameTextBox.Text.Trim();
                }
                if (ProxyPasswordTextBox.Password != null && ProxyPasswordTextBox.Password != "")
                {
                    account.Socks.Password = ProxyPasswordTextBox.Password;
                }
            }
            lock (_bot)
            {
                _bot.AccountManager.Accounts[account.Name] = account;
                _bot.AccountManager.SaveAccount(account.Name);
            }
            RefreshAccountList();
        }
Пример #2
0
        public void Process()
        {
            SocksVersion = (SocksVersion)Receive(1)[0];
            switch (SocksVersion)
            {
            case SocksVersion.Socks4:
            {
                CommandCode = (CommandCode)Receive(1)[0];
                Port        = ReadPort();
                byte[] ipv4Address = Receive(4);
                UserID = ReadNullTerminated();

                // SOCKS4a allows for a domain name
                // to be included
                if (IsSocks4aAddress(ipv4Address))
                {
                    DestinationAddress = ReadNullTerminated();
                    DomainSpecified    = true;
                }
                else
                {
                    DestinationAddress = ipv4Address;
                }
                break;
            }

            case SocksVersion.Socks5:
            default:
                break;
            }
        }
Пример #3
0
 public ProxyConfig(IPAddress httpIP, int httpPort, IPAddress socksIP, int socksPort, SocksVersion version)
 {
     HttpAddress  = httpIP;
     HttpPort     = httpPort;
     SocksAddress = socksIP;
     SocksPort    = socksPort;
     Version      = version;
 }
 /// <param name="Version">The version of the socks to use</param>
 /// <param name="HostIp">The destination proxy ip</param>
 /// <param name="HostPort">The destination proxy port</param>
 /// <param name="Username">The username to authenicate the proxy</param>
 /// <param name="Password">The password to authenicate the proxy</param>
 public ProxySettings(SocksVersion Version, string HostIp, ushort HostPort, string Username, string Password)
 {
     this.Version  = Version;
     this.HostIp   = HostIp;
     this.HostPort = HostPort;
     this.Username = Username;
     this.Password = Password;
 }
Пример #5
0
 public ProxyConfig(IPAddress httpIP, int httpPort, IPAddress socksIP, int socksPort, SocksVersion version, string username, string password)
 {
     HttpAddress  = httpIP;
     HttpPort     = httpPort;
     SocksAddress = socksIP;
     SocksPort    = socksPort;
     Version      = version;
     Username     = username;
     Password     = password;
 }
Пример #6
0
 public ProxyConfig(IPAddress httpIP, int httpPort, IPAddress socksIP, int socksPort, SocksVersion version, string username, string password)
 {
     HttpAddress = httpIP;
     HttpPort = httpPort;
     SocksAddress = socksIP;
     SocksPort = socksPort;
     Version = version;
     Username = username;
     Password = password;
 }
Пример #7
0
 public ProxyConfig(IPAddress httpIP, int httpPort,IPAddress socksIP,int socksPort,SocksVersion version)
 {
     HttpAddress = httpIP;
     HttpPort = httpPort;
     SocksAddress = socksIP;
     SocksPort = socksPort;
     Version = version;
     Username = "";
     Password = "";
 }
 private static void LogKnownVersion(IChannelHandlerContext context, SocksVersion version)
 {
     Log.Debug($"{context.Channel} Protocol version: ({version})");
 }
 /// <param name="Version">The version of the socks to use</param>
 /// <param name="HostIp">The destination proxy ip</param>
 /// <param name="HostPort">The destination proxy port</param>
 public ProxySettings(SocksVersion Version, string HostIp, ushort HostPort)
 {
     this.Version  = Version;
     this.HostIp   = HostIp;
     this.HostPort = HostPort;
 }