Mock SSH Server
Simple SSH Mock Server for E2E testing purposes, e.g. with Testcontainers.
Installation
Python
pip install ssh-mock
# Create commands.yml first
# Start Mock
ssh-mock
Docker
See docker-compose.yml or run:
# Create commands.yml first
# Run Mock Server:
docker run --rm -p 5050:5050 -v ./commands.yml:/usr/src/app/commands.yml ghcr.io/danielhabenicht/mock-ssh:0.2.2
# Try it out
ssh localhost -p 5050
exec echo Hello World!
YAML Configuration
version: "3.7"
commands:
# Simple command
- command: echo hello
stdout: "Hello World!"
returncode: 0
# Command matching regex
- command: interface.*
stdout: ""
# Return values from command via JINJA template
- command: exec echo.*
stdout_template: "{{command[9:]|trim|trim('''')|trim('\"')}}"
returncode: 0
# Modify the Hostname
- command: enable
stdout: "Password"
modify_host: HOST#
returncode: 0
# Use multiple lines
- command: show users
stdout: " Line User Host(s) Idle Location\n* 1 vty 0 rootuser idle 00:00:00\n example.test.de\n\n Interface User Mode Idle Peer Address\n\n"
returncode: 0
- command: show interfaces description
stdout: |
Interface Status Protocol Description
Vl1 up up
Vl308 up up
Gi1/0/1 up up Access Port
Gi1/0/12 down down Access Port
Gi1/1/1 down down
Gi1/1/2 down down
Te1/1/3 down down
Te1/1/4 up up
Thanks
This was initally a fork of https://github.com/d1618033/fake-ssh. Thanks David for your work!
Metadata
Release files for ssh-mock 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ssh_mock-0.3.1.tar.gz | 8.9 kB | Without provenance | Details for ssh_mock-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ssh_mock-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for ssh_mock-0.3.1-py3-none-any.whl |
Total release size: 18.4 kB
Release files / ssh_mock-0.3.1.tar.gz
| Download URL | ssh_mock-0.3.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20d75d0cc5f59f3d2c9c8432af43d5db247060255e4380b4a625c04b0b9b550a
|
|
BLAKE2b-256 checksum How to use checksums |
28480b51b645c4d211e44a0f57699e95afe06231ef515d7199ad55ec4c7535af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.10.14 Linux/6.5.0-1022-azure
|
Release files / ssh_mock-0.3.1-py3-none-any.whl
| Download URL | ssh_mock-0.3.1-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9517a06db876a030280edab191eb91d194d5cb89caf43f4787ef1f9fc0778e62
|
|
BLAKE2b-256 checksum How to use checksums |
6e46857cbd1e14f0b31d924023f5c32f636a7ae1fe27739acef4cfd106fc9b14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.6.1 CPython/3.10.14 Linux/6.5.0-1022-azure
|
Security for ssh-mock 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.