Event Handles
To handle the event can use on_user()
decorator
ssh = Server()
@ssh.on_user("...")
def ...(...output...):
...
return ..return..
event lists
channel is socket
client is client manager
connect
Called when user connected to server and authenticated
output channel, client
connectsftp
Called when user connected to server and authenticated with sftp
output channel, client
auth
Called when user press enter to server and authenticating
output data
return True/False
data
{
"username": ...,
"password": ...,
}
connectpty
Called when user connected to server and authenticated
output channel, data, client
data
{
"term": ...,
"width": ...,
"height": ...,
"pixelwidth": ...,
"pixelheight": ...,
"modes": ...
}
resized
Called when user resized terminal
output channel, data, client
data
{
"width": ...,
"height": ...,
"pixelwidth": ...,
"pixelheight": ...
}
command
Called when user entered command
output channel, command, client
error
Called when inside command event error
output channel, error, client
disconnected
Called when inside command event error
output peername, client