feat: secure password/passphrase input via getpass; interactive SSH auth menu (key/passphrase/password/temp-key); fix missing do_transfer call

This commit is contained in:
2026-05-22 23:42:52 +04:00
parent 4d6c7ef506
commit 6d6418c059
3 changed files with 18 additions and 4 deletions
+3 -2
View File
@@ -82,7 +82,7 @@ def test_keys_against_target(host, user, port, keys):
else:
# Проверим, не passphrase ли
if "passphrase" in err.lower() or "password" in err.lower():
warn(f" ! Ключ '{label}' требует passphrase (зашифрован). Пропускаем (нужен ssh-agent).")
warn(f" ! Ключ '{label}' требует passphrase (зашифрован). Можно ввести passphrase позже.")
else:
info(f" ✗ Ключ '{label}' не подходит ({err.strip()[:60]}).")
return working
@@ -225,7 +225,8 @@ def pick_or_setup_ssh_key(host, user, port):
ok, _, err = check_ssh_connectivity(host, user, port, key_path=k["private"])
if not ok and ("passphrase" in err.lower() or "password" in err.lower()):
if confirm(f"Ключ '{label}' зашифрован. Ввести passphrase и попробовать", default="y"):
pw = prompt(f"Passphrase для {label} (ввод скрыт)")
from core.color import prompt_password
pw = prompt_password(f"Passphrase для {label}")
if pw and try_key_with_passphrase(k["private"], pw):
# После ssh-add ключ должен работать
ok2, _, _ = check_ssh_connectivity(host, user, port, key_path=k["private"])