Adding banner functionality
This commit is contained in:
parent
2690a90ccb
commit
985c3069fb
|
@ -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
|
||||
|
@ -62,6 +63,9 @@ class AuthHandler (object):
|
|||
else:
|
||||
return self.username
|
||||
|
||||
def get_banner(self):
|
||||
return self.banner
|
||||
|
||||
def auth_none(self, username, event):
|
||||
self.transport.lock.acquire()
|
||||
try:
|
||||
|
@ -375,6 +379,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.
|
||||
|
|
|
@ -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.get_banner()
|
||||
|
||||
def auth_none(self, username):
|
||||
"""
|
||||
Try to authenticate to the server using no authentication at all.
|
||||
|
|
Loading…
Reference in New Issue