【发布时间】:2015-07-08 16:32:11
【问题描述】:
我有一个使用 Paramiko 库用 Python 编写的自动化 SFTP 程序。如果我建立连接,我可以显示传输使用的密码和密钥交换算法。但是,我不确定这与可用的算法和密码是否相同。
例子:
>>> import paramiko
>>> ssh = paramiko.SSHClient()
>>> ssh.load_system_host_keys()
>>> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
>>> ssh.connect("myhost.example.com", 22, username="xyzzy")
>>> t = ssh.get_transport()
>>> so = t.get_security_options()
>>> so.kex
('diffie-hellman-group14-sha1', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group1-sha1')
>>> so.ciphers
('aes128-ctr', 'aes256-ctr', 'aes128-cbc', 'blowfish-cbc', 'aes256-cbc', '3des-cbc', 'arcfour128', 'arcfour256')
这与 available 是一样的吗?如果没有,有没有办法以编程方式确定可用的内容?
【问题讨论】:
标签: python encryption ssh paramiko