mirror of
https://github.com/damp11113/PyserSSH.git
synced 2025-04-28 06:58:12 +00:00
Created Event Handles (markdown)
parent
4524e91b41
commit
61dcf48ef8
78
Event-Handles.md
Normal file
78
Event-Handles.md
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# Event Handles
|
||||||
|
To handle the event can use `on_user()` decorator
|
||||||
|
```py
|
||||||
|
ssh = Server()
|
||||||
|
|
||||||
|
@ssh.on_user("...")
|
||||||
|
def ...(channel, data, client):
|
||||||
|
...
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
# event lists
|
||||||
|
channel is socket
|
||||||
|
|
||||||
|
client is client manager
|
||||||
|
|
||||||
|
## connect
|
||||||
|
Called when user connected to server and authenticated
|
||||||
|
|
||||||
|
**output** channel, client
|
||||||
|
|
||||||
|
**return** True/False
|
||||||
|
|
||||||
|
## auth
|
||||||
|
Called when user press enter to server and authenticating
|
||||||
|
|
||||||
|
**output** channel, data, client
|
||||||
|
### data
|
||||||
|
```py
|
||||||
|
{
|
||||||
|
"username": ...,
|
||||||
|
"password": ...,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## connectpty
|
||||||
|
Called when user connected to server and authenticated
|
||||||
|
|
||||||
|
**output** channel, data, client
|
||||||
|
### data
|
||||||
|
```py
|
||||||
|
{
|
||||||
|
"term": ...,
|
||||||
|
"width": ...,
|
||||||
|
"height": ...,
|
||||||
|
"pixelwidth": ...,
|
||||||
|
"pixelheight": ...,
|
||||||
|
"modes": ...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## resized
|
||||||
|
Called when user resized terminal
|
||||||
|
|
||||||
|
**output** channel, data, client
|
||||||
|
### data
|
||||||
|
```py
|
||||||
|
{
|
||||||
|
"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
|
Loading…
x
Reference in New Issue
Block a user