当前位置: 首页>>代码示例>>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;未经允许,请勿转载。