ncouture/MockSSH
ncouture/MockSSH has 130 GitHub stars and 25 forks. Star changes are not measured yet. Last checked 2026-11-14 01:55 UTC. Last push 2026-11-07.
측정된 스타 증가
- in 24h
- 기록 수집 중
- in 7 days
- 기록 수집 중
- in 15 days
- 기록 수집 중
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
소개
Mock an SSH server and define all commands it supports (Python, Twisted)
보안README.md
OriginalMockSSH
Mock SSH servers and all commands they support.
Purpose
This project was developed to emulate operating systems behind SSH servers in order to test task automation without having access to the real servers.
Finally Mock SSH has been fully modernized as of version 2.0.0, requiring Python 3.12+ and featuring a robust, type-safe architecture with modern testing and linting (pytest, Ruff). It provides a threaded version for performing end-to-end unit tests against mocked SSH services.
Installation
MockSSH requires Python 3.12+. It uses a modern pyproject.toml based build system.
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
Development
The project provides several development commands via make:
To install the development dependencies (Ruff, mypy, pytest, pre-commit):
pip install -e ".[dev]"
To run the linters and format the code (using Ruff):
make fix
make lint
To run static type checking (using mypy):
make typecheck
To run the tests:
make test
To build source and wheel distributions:
make build
To install the pre-commit hooks:
pre-commit install
Mock SSH in Python
MockSSH aims to be as easy to use as possible.
Refer to the mock_cisco.py and mock_F5.py in the examples/ directory for an overview on how to use it.
Mock SSH in LISP
Efforts were invested in simplifying the use of MockSSH with HyLang.
As a result a DSL is released with this project and resides in the mocksshy/ directory.
Using the DSL will allow you to Mock SSH by writing something that is closer to a configuration file than a program.
For comparison, here are two ways to Mock SSH servers implementations providing the same functionality:
Python
import MockSSH
def passwd_change_protocol_prompt(instance):
instance.protocol.prompt = "hostname #"
instance.protocol.password_input = False
def passwd_write_password_to_transport(instance):
instance.writeln("MockSSH: password is %s" % instance.valid_password)
command_passwd = MockSSH.PromptingCommand(
name='passwd',
password='1234',
prompt="Password: ",
success_callbacks=[passwd_change_protocol_prompt],
failure_callbacks=[passwd_write_password_to_transport])
users = {'admin': '1234'}
commands = [command_passwd]
MockSSH.runServer(commands,
prompt="hostname>",
interface='127.0.0.1',
port=2222,
**users)
HyLang
(import MockSSH)
(require mocksshy.language)
(mock-ssh :users {"testuser" "1234"}
:host "127.0.0.1"
:port 2222
:prompt "hostname>"
:commands [
(command :name "passwd"
:type "prompt"
:output "Password: "
:required-input "1234"
:on-success ["prompt" "hostname#"]
:on-failure ["write" "Pass is 1234..."]))
Unit Testing with MockSSH
As shown from the unit tests in the tests/ directory, it is possible to use a threaded MockSSH server to perform end-to-end unit tests against mocked SSH services.
MockSSH now uses pytest and pytest-twisted to manage the Twisted reactor lifecycle cleanly. This allows the entire test suite to run in a single process.
Documentation (Wiki)
Comprehensive documentation is available in the docs/wiki/ directory,
covering foundational concepts, architecture, custom command definition,
and testing strategies.
AI-Powered Automation
MockSSH is integrated with the Gemini CLI to automate routine development tasks:
- Automated Issue Triage: New issues are automatically analyzed and labeled.
- Intelligent Code Review: Pull requests receive an initial automated review from Gemini.
- Autonomous Implementation: Approved plans can be executed by Gemini to speed up development.
Refer to GEMINI.md for more details on the automation workflows.
Security
MockSSH is designed for testing and emulation. When implementing custom commands:
- Avoid Sensitive Logging: Do not use
print()orlogto output raw user input or passwords. - Host Key Permissions: Ensure your host keys (in
generated-keys/) have restricted permissions (chmod 600). - Secret Management: Do not store sensitive credentials (like Service Account keys) in the repository.
License
MockSSH is released under the LGPL-3.0-or-later license.
Credits
MockSSH was inspired by kippo, an SSH honeypot, and @HyLang
관련 프로젝트 살펴보기
trimstray/the-book-of-secret-knowledge
영감을 주는 목록, 매뉴얼, 치트시트, 블로그, 팁, 원라이너, CLI/웹 도구 등을 모은 컬렉션.
258,303 스타Hack-with-Github/Awesome-Hacking
해커, 펜테스터, 보안 연구자를 위한 다양한 Awesome 목록 모음.
125,461 스타swisskyrepo/PayloadsAllTheThings
웹 애플리케이션 보안과 모의 침투 테스트/CTF에 유용한 페이로드 및 우회 방법 목록.
82,661 스타caddyserver/caddy
빠르고 확장 가능한 멀티플랫폼 HTTP/1-2-3 웹 서버이며, 자동 HTTPS를 지원합니다
79,027 스타