https://github.com/coljac/home-terminal
Tool to expose an SSH server as a home page
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.1%) to scientific vocabulary
Repository
Tool to expose an SSH server as a home page
Basic Info
- Host: GitHub
- Owner: coljac
- License: mit
- Language: Python
- Default Branch: main
- Size: 677 KB
Statistics
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 0
Metadata Files
README.md
Home Terminal
Shamelessly copied from https://github.com/gleich/terminal and implemented in python.
This code sets up a server that listens for SSH connections and then makes available a menu of commands to serve out whatever information you wish. Think of it like a home page for the extra nerdy.

Deployment
Can be done with or without a container - container is probably easiest, especially given the presumably less than military grade security this afternoon's python coding has ensured.
- Clone the repo.
- Define the commands you want, as below.
- Install extra python dependencies if required for your commands.
- Run
term.py, specifyingSSH_PORT(default: 22) andTERM_COMMANDS_DIR(default:./commands) in the environment. Optionally, add aTERM_WELCOMEvar that points to a file to be sent on login. - It also needs a key pair to run, generate with
ssh-keygen -t rsa -f ./id_rsa. You can override the default with theTERM_KEYFILEenv var.
With docker:
docker build -t hometerm .
docker run hometerm -p 22:22 hometerm
This will make a key too.
Commands
Apart from the default help and exit commands, the rest of the options are defined at runtime from a commands directory (specified with the TERM_COMMANDS_DIR environment variable, default: ./commands):
- In a
commands()method, which returns an array of Command objects; - In any number of
hometerm.command.Commandsubclasses found.
The subclasses should initialize with a name and description, and override the execute method to return some text or Rich Text. The should have a constructor that takes no arguments.
For example, in the commands/ directory you might have commands.py:
```python
from hometerm.command import TextCommand, ImageCommand
def commands(): return [ TextCommand("about", "Some info about me", "commands/about.md"), ImageCommand("pic", "See what I look like", "commands/col.png", size=[42, 64]), ] ```
and/or some class defintions like mycommand.py:
```python from hometerm.command import Command
class MessageCommand(Command): def init(self): super().init("message", "Send me a message")
def execute(self, terminal):
terminal.send_rich("Enter your message (Press enter when done):")
terminal.console.print("\r\n> ", style="bold yellow", end=None)
# rest of the execution here
```
see command.py for details. The main thing is to either return the output, or operate on the terminal object passed in, which allows extra interactivity.
Owner
- Name: Colin Jacobs
- Login: coljac
- Kind: user
- Location: Melbourne, Australia
- Company: PoliQ
- Website: https://coljac.info
- Repositories: 86
- Profile: https://github.com/coljac
Python, astrophysics, ML/data stuff, and a bunch of hobby projects.
GitHub Events
Total
- Watch event: 1
- Push event: 1
Last Year
- Watch event: 1
- Push event: 1
Dependencies
- python 3.11-slim build
- paramiko *
- prompt-toolkit *
- python_dotenv *
- requests *
- rich *
- tabulate *
- termcolor *