Skip to content

simon-engledew/mock-ssh-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mock-ssh-server

Current status: early proof of concept

Usage: mock-ssh-server <starlark script>

This will spin up an SSH server on port 2222 that runs the specified Starlark script whenever anyone connects.

Starlark is a Python-like language used by Bazel for configuration.

mock-ssh-server currently exposes four built-in functions to the script:

Name Description
writeline(string) Send text and a newline to the connected client
write(string) Send text to the connected client
readline(string) Read a whole line from the client
matchline(string: regexp) Keep reading a line until the input matches a pattern, return the match and any capturing groups

Simple example:

writeline("What is your name?")
name = readline()
writeline("Hello " + name + "!")

image

Try it out with:

go get -u github.com/simon-engledew/mock-ssh-server

mock-ssh-server examples/helloworld.star 

About

Use Starlark scripts to create test SSH servers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published