From cd73246a297c7d65a420bbe790fb4a10ce5bc845 Mon Sep 17 00:00:00 2001 From: Marius Burz Date: Tue, 20 Jun 2023 13:45:21 +0200 Subject: [PATCH] Added support for TOTP password prompts, as used by google-authenticator-libpam --- docs/changelog.rst | 1 + mitogen/ssh.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index da5cc5e4e..f4330f693 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -28,6 +28,7 @@ v0.3.4.dev0 resource leaks. * :gh:issue:`659` Removed :mod:`mitogen.compat.simplejson`, not needed with Python 2.7+, contained Python 3.x syntax errors * :gh:issue:`983` CI: Removed PyPI faulthandler requirement from tests +* :gh:issue:`998` SSH: Added support for TOTP password prompts (i.e. 'Verification code: '), as used by google-authenticator-libpam v0.3.3 (2022-06-03) ------------------- diff --git a/mitogen/ssh.py b/mitogen/ssh.py index 656dc72ca..ec9d4cc0f 100644 --- a/mitogen/ssh.py +++ b/mitogen/ssh.py @@ -66,8 +66,12 @@ ) # sshpass uses 'assword' because it doesn't lowercase the input. +# 'password': standard password prompt +# 'verification code': TOTP prompt(as used by e.g. google-authenticator-libpam) +# These should also match 'password & verification code' for password and TOTP +# prompt (as used by e.g. google-authenticator-libpam) PASSWORD_PROMPT_PATTERN = re.compile( - b('password'), + b('(password|verification code)'), re.I )