Ejemplo n.º 1
0
        public ProtocolOptions Import(ProtocolOptions src)
        {
            //((Debug.Assert(src._folder.Id==_folder.Id);

            //SSHŠÖŒW
            _retainsPassphrase = src._retainsPassphrase;

            _cipherAlgorithmOrder           = src._cipherAlgorithmOrder;
            _cipherAlgorithmOrderWasChecked = false;
            _hostKeyAlgorithmOrder          = src._hostKeyAlgorithmOrder;
            _sshWindowSize = src._sshWindowSize;
            _sshCheckMAC   = src._sshCheckMAC;
            _hostKeyCheckerVerifierTypeName = src._hostKeyCheckerVerifierTypeName;
            _logSSHEvents = src._logSSHEvents;

            _socketConnectTimeout = src._socketConnectTimeout;
            _ipVersionPriority    = src._ipVersionPriority;

            //SOCKSŠÖŒW
            _useSocks        = src._useSocks;
            _socksServer     = src._socksServer;
            _socksPort       = src._socksPort;
            _socksAccount    = src._socksAccount;
            _socksPassword   = src._socksPassword;
            _socksNANetworks = src._socksNANetworks;

            _socketBufferSize       = src._socketBufferSize;
            _readSerializedPassword = src._readSerializedPassword;
            _savePassword           = src._savePassword;
            _savePlainTextPassword  = src._savePlainTextPassword;

            return(this);
        }
Ejemplo n.º 2
0
        public ConsoleMain()
        {
            //_instance = this;
            _protocolOptionsSupplier = new ProtocolOptions("");
            _protocolOptionsSupplier.DefineItems();
            _passphraseCache = new PassphraseCache();
            //_poderosaLog = new PoderosaLog(); // ((IPoderosaApplication)poderosa.GetAdapter(typeof(IPoderosaApplication))).PoderosaLog;
            //_netCategory = new PoderosaLogCategoryImpl("Network");

            //IConnectionResultEventHandler is not needed now
            //_connectionResultEventHandler = new KeyAgent(); //IConnectionResultEventHandler();
            //new ISSHHostKeyVerifier
        }
Ejemplo n.º 3
0
        protected virtual void MakeConnection()
        {
            //‚Ü‚¸SOCKS‚ðŽg‚¤‚ׂ«‚©‚Ç‚¤‚©‚ð”»’è‚·‚é
            IProtocolOptions opt = new ProtocolOptions(""); // ProtocolsPlugin.Instance.ProtocolOptions;

            if (opt.UseSocks && SocksApplicapable(opt.SocksNANetworks, IPAddressList.SilentGetAddress(_host)))
            {
                _socks            = new Socks();
                _socks.Account    = opt.SocksAccount;
                _socks.Password   = opt.SocksPassword;
                _socks.DestName   = _host;
                _socks.DestPort   = (short)_port;
                _socks.ServerName = opt.SocksServer;
                _socks.ServerPort = (short)opt.SocksPort;
            }

            string dest = _socks == null? _host : _socks.ServerName;
            int    port = _socks == null? _port : _socks.ServerPort;

            IPAddress address = null;

            if (IPAddress.TryParse(dest, out address))
            {
                _addressSet = new IPAddressList(address); //Å‰‚©‚çIPƒAƒhƒŒƒXŒ`Ž®‚Ì‚Æ‚«‚ÍŽè‚Å•ÏŠ·B‚»‚¤‚Å‚È‚¢‚ÆDNS‚Ì‹tˆø‚«‚ð‚µ‚Äƒ^ƒCƒ€ƒAƒEƒgA‚Æ‚©‚â‚₱‚µ‚¢‚±‚Æ‚ª‹N‚±‚é
            }
            else                                          //ƒzƒXƒg–¼Œ`Ž®
            {
                StartOverridingErrorMessage(String.Format("Message.AddressNotResolved", dest));
                _addressSet = new IPAddressList(dest);
                EndOverridingErrorMessage();
            }

            StartOverridingErrorMessage(String.Format("Message.FailedToConnectPort", dest, port));
            _socket = _NetUtil.ConnectTCPSocket(_addressSet, port);
            EndOverridingErrorMessage();
            _connectedAddress = ((IPEndPoint)_socket.RemoteEndPoint).Address;

            if (_socks != null)
            {
                _errorMessage = "An error occurred in SOCKS negotiation.";
                _socks.Connect(_socket);
                //Ú‘±¬Œ÷‚µ‚½‚ç_host,_port‚ðŒ³‚É–ß‚·
                _host = _socks.DestName;
                _port = _socks.DestPort;
            }

            _tcpConnected = true;
        }
Ejemplo n.º 4
0
        protected void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    if (_passphraseCache != null)
                    {
                        _passphraseCache = null;
                    }
                    if (_protocolOptionsSupplier != null)
                    {
                        _protocolOptionsSupplier = null;
                    }
                }

                //free unmanaged objects
                //AdditionalCleanup();

                this.disposed = true;
            }
        }
Ejemplo n.º 5
0
 public void InitializePreference(String folder)
 {
     _originalFolder  = folder;
     _originalOptions = new ProtocolOptions(folder);
     _originalOptions.DefineItems();
 }