Files
TrollSSH/README.md
T

119 lines
3.6 KiB
Markdown
Raw Normal View History

2026-07-13 21:13:32 +07:00
# 👻 TrollSSH
2026-07-13 15:12:04 +07:00
2026-07-13 23:05:55 +07:00
A fake SSH server that accepts any login and plays back video as colored
ASCII/Unicode art at whoever connects to it
2026-07-13 21:10:24 +07:00
![SSH Demo](assets/ssh.webp)
2026-07-13 23:07:19 +07:00
## Features
2026-07-13 21:10:24 +07:00
- **Accept any credentials**
2026-07-13 23:05:55 +07:00
- **Colored ASCII/Unicode video playback** - resized live to the client's
terminal, using a configurable character ramp, defaults to the Unicode block-character preset
2026-07-13 22:54:42 +07:00
- **Automatic color detection** - renders 24-bit truecolor, 256-color, or
2026-07-13 23:05:55 +07:00
plain grayscale depending on what the connecting client reports supporting
2026-07-13 21:10:24 +07:00
- **Multiple frame sets** - clients get a random one, arrow keys switch between
them (configurable)
- **Honeypot extras** - optional credential logging, per-IP and global
connection limits, handshake timeout, customizable banner / fake login /
goodbye text
## Quick start
Generate a frame set from a video through container image
```sh
docker run --rm -v ./video.mp4:/home/app/video.mp4 -v ./frames:/home/app/frames \
2026-07-29 19:33:20 +07:00
ghcr.io/yuzuzensai/trollssh:1.2.0 trollssh --generate --video video.mp4 --resolution 512
2026-07-13 21:10:24 +07:00
```
2026-07-13 22:54:42 +07:00
This writes `frames/<name>.tsf`, a simple container of color JPEG frames plus
the source fps. You can drop as many `.tsf` files into `frames/` as you like.
The server loads all of them.
2026-07-13 21:10:24 +07:00
Run the server with [`docker-compose.yaml`](docker-compose.yaml)
```sh
cp .env.example .env
docker compose up -d
```
`./data` persists host keys and text assets.
`./frames` holds the `.tsf` frame sets.
Then try it:
```sh
ssh anyone@localhost
```
## Configuration
2026-07-14 05:49:10 +07:00
Server configuration is via environment variables, loaded from a `.env` file
if one exists (see [`.env.example`](.env.example) for the full annotated
list). Durations are in milliseconds.
2026-07-13 21:10:24 +07:00
Host keys (`data/id_rsa`, `data/id_ed25519`) are generated on first run and
reused afterwards.
2026-07-14 05:49:10 +07:00
Frame generation is configured with flags:
| Flag | Default | Description |
| -------------------- | ------- | -------------------------------------------------- |
| `--generate`, `-g` | | Generate a `.tsf` frame set instead of serving |
| `--video`, `-v` | | Source video path |
| `--resolution`, `-r` | `512` | Stored frame max dimension in pixels. Higher = sharper but bigger `.tsf` files and slower rendering |
2026-07-13 21:10:24 +07:00
## Customization
Optional text files in `data/` (created next to the binary):
| File | Shown |
| -------------------- | --------------------------------------------------- |
| `data/banner.txt` | As the SSH banner, before authentication |
| `data/fakelogin.txt` | Right after "login", before playback |
| `data/goodbye.txt` | When the session ends after `MAX_LOOP` playthroughs |
## Development
Requirements: Go 1.25+ and `ffmpeg` / `ffprobe` on `PATH` (only for
`--generate`).
2026-07-16 23:29:14 +07:00
The entry point lives in [`cmd/trollssh`](cmd/trollssh); the packages it wires
together are under [`internal/`](internal) (`config`, `logx`, `render`, `tsf`,
`sshserver`).
2026-07-13 21:10:24 +07:00
```sh
2026-07-16 23:29:14 +07:00
go run ./cmd/trollssh --generate --video video.mp4 --resolution 512
go run ./cmd/trollssh
2026-07-13 21:10:24 +07:00
```
Or build a binary:
```sh
2026-07-16 23:29:14 +07:00
go build -o trollssh ./cmd/trollssh
2026-07-13 21:10:24 +07:00
./trollssh
```
CI runs the following checks on every push:
```sh
2026-07-16 23:29:14 +07:00
gofmt -l . # format
go vet ./... # vet
golangci-lint run ./... # lint, see https://golangci-lint.run
go test ./... # tests
```
To run them automatically before each commit, install
[lefthook](https://github.com/evilmartians/lefthook) and `golangci-lint`, then:
```sh
lefthook install
```
2026-07-13 21:10:24 +07:00
## License
[MIT](LICENSE)