mirror of
https://github.com/huashengdun/webssh.git
synced 2026-05-06 01:17:15 +00:00
Updated test_app.py and sshserver.py
This commit is contained in:
@@ -55,7 +55,7 @@ class Server (paramiko.ServerInterface):
|
||||
return paramiko.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
|
||||
|
||||
def check_auth_password(self, username, password):
|
||||
if (username == 'robey') and (password == 'foo'):
|
||||
if (username in ['robey', 'bar']) and (password == 'foo'):
|
||||
return paramiko.AUTH_SUCCESSFUL
|
||||
return paramiko.AUTH_FAILED
|
||||
|
||||
@@ -104,7 +104,8 @@ def run_ssh_server(port=2200, running=True):
|
||||
print('*** No channel.')
|
||||
continue
|
||||
|
||||
print('Authenticated!')
|
||||
username = t.get_username()
|
||||
print('{} Authenticated!'.format(username))
|
||||
|
||||
server.event.wait(10)
|
||||
if not server.event.is_set():
|
||||
@@ -112,6 +113,9 @@ def run_ssh_server(port=2200, running=True):
|
||||
continue
|
||||
|
||||
chan.send('\r\n\r\nWelcome!\r\n\r\n')
|
||||
if username == 'bar':
|
||||
print(chan.recv(1024))
|
||||
chan.close()
|
||||
|
||||
try:
|
||||
sock.close()
|
||||
|
||||
Reference in New Issue
Block a user