mirror of
https://github.com/damp11113/PyserSSH.git
synced 2025-04-27 22:48:11 +00:00
Update README.md
This commit is contained in:
parent
50e5983931
commit
16dc6b9a6e
41
README.md
41
README.md
@ -1,7 +1,44 @@
|
|||||||
# PyserSSH
|
# What is PyserSSH
|
||||||
Part from [damp11113](https://github.com/damp11113/damp11113-library)
|
|
||||||
|
PyserSSH is a library for remote control your code with ssh client. The aim is to provide a scriptable SSH server which can be made to behave like any SSH-enabled device.
|
||||||
|
|
||||||
|
This project is part from [damp11113-library](https://github.com/damp11113/damp11113-library)
|
||||||
|
|
||||||
|
This Server use port **2222** for default port
|
||||||
|
|
||||||
|
# Install
|
||||||
|
Install from pypi
|
||||||
|
```bash
|
||||||
|
pip install PyserSSH
|
||||||
|
```
|
||||||
|
Install from github
|
||||||
|
```bash
|
||||||
|
pip install git+https://github.com/damp11113/PyserSSH.git
|
||||||
|
```
|
||||||
|
# Quick Example
|
||||||
|
```py
|
||||||
|
import os
|
||||||
|
|
||||||
|
from PyserSSH import Server, Send, AccountManager
|
||||||
|
|
||||||
|
useraccount = AccountManager()
|
||||||
|
useraccount.add_account("admin", "") # create user without password
|
||||||
|
|
||||||
|
ssh = Server(useraccount)
|
||||||
|
|
||||||
|
@ssh.on_user("command")
|
||||||
|
def command(channel, command: str, client):
|
||||||
|
if command == "hello":
|
||||||
|
Send(channel, "world!")
|
||||||
|
|
||||||
|
ssh.run(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'private_key.pem'))
|
||||||
|
```
|
||||||
|
This example you can connect with `ssh admin@localhost -p 2222` and press enter on login
|
||||||
|
If you input `hello` the response is `world`
|
||||||
|
|
||||||
# Demo
|
# Demo
|
||||||
See [server.py](https://github.com/damp11113/PyserSSH/blob/main/demo/server.py)
|
See [server.py](https://github.com/damp11113/PyserSSH/blob/main/demo/server.py)
|
||||||
|
|
||||||
I intend to leaked private key because that key i generated new. I recommend to generate new key if you want to use on your host because that key is for demo only.
|
I intend to leaked private key because that key i generated new. I recommend to generate new key if you want to use on your host because that key is for demo only.
|
||||||
|
why i talk about this? because when i push private key into this repo in next 5 min++ i getting new email from GitGuardian. in that email say "
|
||||||
|
GitGuardian has detected the following RSA Private Key exposed within your GitHub account" i dont knows what is GitGuardian and i not install this app into my account.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user