This repository has been archived on 2026-03-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
oubliette/internal/shell/shell.go
Torjus Håkestad 8189a108d1 feat: add shell interface, registry, and bash shell emulator
Implement Phase 1.4: replaces the hardcoded banner/timeout stub with a
proper shell system. Adds a Shell interface with weighted registry for
shell selection, a RecordingChannel wrapper (pass-through for now, prep
for Phase 2.3 replay), and a bash-like shell with fake filesystem,
terminal line reader, and command handling (pwd, ls, cd, cat, whoami,
hostname, id, uname, exit). Sessions now log command/output pairs to
the store and record the shell name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 20:24:48 +01:00

34 lines
815 B
Go

package shell
import (
"context"
"io"
"git.t-juice.club/torjus/oubliette/internal/storage"
)
// Shell is the interface that all honeypot shell implementations must satisfy.
type Shell interface {
Name() string
Description() string
Handle(ctx context.Context, sess *SessionContext, rw io.ReadWriteCloser) error
}
// SessionContext carries metadata about the current SSH session.
type SessionContext struct {
SessionID string
Username string
RemoteAddr string
ClientVersion string
Store storage.Store
ShellConfig map[string]any
CommonConfig ShellCommonConfig
}
// ShellCommonConfig holds settings shared across all shell types.
type ShellCommonConfig struct {
Hostname string
Banner string
FakeUser string // override username in prompt; empty = use authenticated user
}