From 446345bec14a24b3475d43b11700d94d1ee22b6b Mon Sep 17 00:00:00 2001 From: dharm pimsen <64675096+damp11113@users.noreply.github.com> Date: Sun, 17 Mar 2024 20:42:54 +0700 Subject: [PATCH] Updated Home (markdown) --- Home.md | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/Home.md b/Home.md index ead2607..70f0ed9 100644 --- a/Home.md +++ b/Home.md @@ -1 +1,40 @@ -Welcome to the PyserSSH wiki! +# What is PyserSSH + +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 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 +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.