Skip to main content

python scriptable ssh server library. based on Paramiko

Project description

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 project is part from damp11113-library

This Server use port 2222 for default port

Install

Install from pypi

pip install PyserSSH

Install from github

pip install git+https://github.com/damp11113/PyserSSH.git

Optional Packages

Quick Example

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(client, command: str):
    if command == "hello":
        Send(client, "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

https://github.com/damp11113/PyserSSH/assets/64675096/49bef3e2-3b15-4b64-b88e-3ca84a955de7

See 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. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyserSSH-4.3.tar.gz (19.1 kB view details)

Uploaded Source

File details

Details for the file PyserSSH-4.3.tar.gz.

File metadata

  • Download URL: PyserSSH-4.3.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for PyserSSH-4.3.tar.gz
Algorithm Hash digest
SHA256 4f5525f79c3b75bd20001294330d02cf70a8dfc6bfa55aff4cb7ae23b9e37b6f
MD5 547f43d5443816ce30fc078d6b8c4f05
BLAKE2b-256 27c58d9bd69de346d8f13f350980bf5f0ece6796d4bf30b38e485541444956e3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page