A Python library to mock SSH servers and define custom commands for testing automation scripts.
MockSSH is a Python library that allows developers to create mock SSH servers with custom-defined commands. It solves the problem of testing SSH-based automation scripts without needing access to real servers, enabling end-to-end unit testing in controlled environments.
Developers and DevOps engineers who need to test SSH automation scripts, network tools, or infrastructure code that interacts with SSH servers.
Developers choose MockSSH because it provides a lightweight, programmable way to emulate SSH servers with full control over command behavior, making it ideal for testing scenarios where real servers are unavailable or impractical.
Mock an SSH server and define all commands it supports (Python, Twisted)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows defining custom SSH commands with specific outputs, prompts, and behaviors, as demonstrated in the Python and HyLang examples in the README, enabling realistic server simulation.
Provides a threaded server version for end-to-end unit testing of SSH-based workflows, mentioned in the Purpose and Unit Testing sections, facilitating automated testing without real servers.
Offers an optional HyLang domain-specific language that makes server definitions more configuration-like and easier to write, as shown in the comparison examples, reducing code verbosity.
Supports user authentication with username/password validation, enabling testing of secure SSH connections, as outlined in the Key Features and example code.
MockSSH requires Python 2, as stated in the Installation section, which limits its use in modern Python 3 environments and poses maintenance risks.
The README notes that only one Twisted reactor can run at a time and reactors cannot be restarted, restricting concurrent testing or complex, multi-server scenarios.
Building on Twisted and offering an optional HyLang DSL adds complexity, requiring developers to learn additional technologies beyond standard Python.