key string to file obj

This commit is contained in:
Nguyen Huu Thuong
2020-08-15 15:11:13 +02:00
parent 06a4030088
commit 53c49d7130

2
app.py
View File

@@ -52,7 +52,7 @@ def connect():
if INPUT_KEY:
with tempfile.TemporaryFile() as fp:
fp.write(INPUT_KEY.encode())
p_key = paramiko.RSAKey.from_private_key(INPUT_KEY)
p_key = paramiko.RSAKey.from_private_key(file_obj=fp)
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(INPUT_HOST, port=INPUT_PORT, username=INPUT_USER,
pkey=p_key, password=INPUT_PASS,