[英]Getting error while connecting SSH using python
我正在嘗試使用python連接在Windows中運行的Virtual CentOS計算機之一。
我已經安裝了paramiko模塊來做。 但低於錯誤
C:\Users\xxxx\PycharmProjects\xxxx\venv\lib\site-packages\paramiko\kex_ecdh_nist.py:39: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
m.add_string(self.Q_C.public_numbers().encode_point())
C:\Users\xxx\PycharmProjects\xxxx\venv\lib\site-packages\paramiko\kex_ecdh_nist.py:96: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point
self.curve, Q_S_bytes
C:\Users\xxxx\PycharmProjects\xxxx\venv\lib\site-packages\paramiko\kex_ecdh_nist.py:111: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
hm.add_string(self.Q_C.public_numbers().encode_point())
下面是我的代碼:
import paramiko
ssh = paramiko.client.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect('10.xx.xx.xxx', username='root', password='xxxxx')
except paramiko.SSHException:
print("Connection Failed")
quit()
stdin, stdout, stderr = ssh.exec_command("ls /etc/")
for line in stdout.readlines():
print
line.strip()
ssh.close()
我使用PyCharm 2018.3社區版搜索並安裝了密碼學2.6.1和python版本3.7.1 。
請讓我知道我在這里做錯了
這些不是錯誤,這些是paramiko發出的警告,它們需要更新代碼以使用更多最新參數。 您的代碼仍然應該運行。 最好的選擇是查看paramiko軟件包的作者是否有更新版本或提出問題。
不推薦使用Paramiko使用的方法。 您應該考慮將Python降級到較低版本或下載Paramiko的更新版本(如果存在)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.