demo.py 文件源码

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

项目:_ 作者: zengchunyun 项目源码 文件源码
def agent_auth(transport, username):
    """
    Attempt to authenticate to the given transport using any of the private
    keys available from an SSH agent.
    """

    agent = paramiko.Agent()
    agent_keys = agent.get_keys()
    if len(agent_keys) == 0:
        return

    for key in agent_keys:
        print('Trying ssh-agent key %s' % hexlify(key.get_fingerprint()))
        try:
            transport.auth_publickey(username, key)
            print('... success!')
            return
        except paramiko.SSHException:
            print('... nope.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号