diff options
-rw-r--r-- | dev-requirements.txt | 2 | ||||
-rw-r--r-- | paramiko/auth_handler.py | 2 | ||||
-rw-r--r-- | paramiko/transport.py | 12 | ||||
-rw-r--r-- | sites/www/changelog.rst | 2 |
4 files changed, 17 insertions, 1 deletions
diff --git a/dev-requirements.txt b/dev-requirements.txt index 89469175..72172183 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -7,4 +7,4 @@ invoke>=0.7.0 invocations>=0.4.4 sphinx>=1.1.3 alabaster>=0.3.0 -releases>=0.5.0 +releases>=0.5.1 diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py index acb7c8b8..57f25fac 100644 --- a/paramiko/auth_handler.py +++ b/paramiko/auth_handler.py @@ -45,6 +45,7 @@ class AuthHandler (object): self.authenticated = False self.auth_event = None self.auth_method = '' + self.banner = None self.password = None self.private_key = None self.interactive_handler = None @@ -375,6 +376,7 @@ class AuthHandler (object): def _parse_userauth_banner(self, m): banner = m.get_string() + self.banner = banner lang = m.get_string() self.transport._log(INFO, 'Auth banner: ' + banner) # who cares. diff --git a/paramiko/transport.py b/paramiko/transport.py index 3155d3f8..9dbfa816 100644 --- a/paramiko/transport.py +++ b/paramiko/transport.py @@ -1092,6 +1092,18 @@ class Transport (threading.Thread): return None return self.auth_handler.get_username() + def get_banner(self): + """ + Return the banner supplied by the server upon connect. If no banner is + supplied, this method returns C{None}. + + @return: server supplied banner, or C{None}. + @rtype: string + """ + if not self.active or (self.auth_handler is None): + return None + return self.auth_handler.banner + def auth_none(self, username): """ Try to authenticate to the server using no authentication at all. diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst index 47946a27..1b82c63b 100644 --- a/sites/www/changelog.rst +++ b/sites/www/changelog.rst @@ -2,6 +2,8 @@ Changelog ========= +* :feature:`58` Allow client code to access the stored SSH server banner via + ``Transport.get_banner()``. Thanks to ``@Jhoanor`` for the patch. * :bug:`34` (PR :issue:`35`) Fix SFTP prefetching incompatibility with some SFTP servers regarding request/response ordering. Thanks to Richard Kettlewell for catch & patch. |