ssh_client.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Daytse.bundle 作者: shvets 项目源码 文件源码
def __init__(self, host, port, username, password, key=None, passphrase=None):
        self.username = username
        self.password = password

        self.ssh = paramiko.SSHClient()
        # ssh.load_system_host_keys()
        self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        # ssh.set_missing_host_key_policy(paramiko.WarningPolicy())

        if key is not None:
            key = paramiko.RSAKey.from_private_key(StringIO(key), password=passphrase)
        self.ssh.connect(host, port, username=username, password=password, pkey=key, timeout=self.TIMEOUT)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号