當前位置: 首頁>>代碼示例>>Python>>正文


Python config.SSH_PORT屬性代碼示例

本文整理匯總了Python中paramiko.config.SSH_PORT屬性的典型用法代碼示例。如果您正苦於以下問題:Python config.SSH_PORT屬性的具體用法?Python config.SSH_PORT怎麽用?Python config.SSH_PORT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在paramiko.config的用法示例。


在下文中一共展示了config.SSH_PORT屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _connect

# 需要導入模塊: from paramiko import config [as 別名]
# 或者: from paramiko.config import SSH_PORT [as 別名]
def _connect(self):
        if 'proxycommand' in self.config:
            proxy = paramiko.ProxyCommand(self.config['proxycommand'])
            # TODO: check this code, needed?
            #subprocess.check_output(
            #    [os.environ['SHELL'], '-c',
            #        'echo %s' % self.config['proxycommand']]
            #).strip()
        else:
            proxy = None

        # Connect to server
        # Compression will not speedup picture transfers, but will help for
        # the initial remote hash download and for files that are compressible.
        # noinspection PyTypeChecker
        self.client.connect(
            self.config.get('hostname', self.hostname),
            username=self.user or self.config.get('user', None),
            password=self.password,
            port=self.config.get('port', SSH_PORT),
            sock=proxy,
            compress=True)

        transport = self.client.get_transport()
        # https://github.com/paramiko/paramiko/issues/175
        transport.window_size = 2147483647
        # 512MB -> 4GB, this is a security degradation
        transport.packetizer.REKEY_BYTES = pow(2, 32)

        self.sftp = self.client.open_sftp() 
開發者ID:wojas,項目名稱:hashedbackup,代碼行數:32,代碼來源:sftp.py

示例2: connect

# 需要導入模塊: from paramiko import config [as 別名]
# 或者: from paramiko.config import SSH_PORT [as 別名]
def connect(
            self,
            hostname,
            port=SSH_PORT,
            username=None,
            password=None,
            pkey=None,
            key_filename=None,
            timeout=None,
            allow_agent=True,
            look_for_keys=True,
            compress=False,
            sock=None,
            gss_auth=False,
            gss_kex=False,
            gss_deleg_creds=True,
            gss_host=None,
            banner_timeout=None):
        options = self.config.lookup(hostname)

        identity_file = options.get('identityfile', [key_filename])
        if identity_file:
            identity_file = identity_file[0]
        if identity_file and not identity_file.startswith('/'):
            identity_file = join(self.config_directory, identity_file)

        port = int(options.get('port', port))

        super().connect(
            hostname=options.get('hostname', hostname),
            port=port,
            username=options.get('user', username),
            password=options.get('password', password),
            pkey=pkey,
            key_filename=identity_file,
            timeout=options.get('connecttimeout', timeout),
            allow_agent=allow_agent,
            look_for_keys=look_for_keys,
            compress=compress,
            sock=sock,
            gss_auth=gss_auth,
            gss_kex=gss_kex,
            gss_deleg_creds=gss_deleg_creds,
            gss_host=gss_host,
            banner_timeout=banner_timeout
        )

        self._sftp_client = self.open_sftp() 
開發者ID:pylover,項目名稱:sqlalchemy-media,代碼行數:50,代碼來源:ssh.py


注:本文中的paramiko.config.SSH_PORT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。