Skip to content

casaisdev/r00tsh

Repository files navigation

r00tsh

A cinematic, terminal-only simulated web OS built with Next.js.

r00tsh is an interactive browser terminal that simulates a compromised Linux host end-to-end: boot sequence, shell navigation, network activity, service/process control, missions, and persistent state. It is intentionally terminal-only, with no desktop metaphors or GUI applications.

Live Demo

https://r00tsh.martincasais.com

Preview

r00tsh terminal preview

GIF placeholder: docs/r00tsh-demo.gif

Features

  • Terminal-only OS simulation with CRT/glow visual style and boot sequence
  • Stateful shell with cwd, prompt, history, env vars, pipes (|) and chaining (&&)
  • Context-aware Tab autocomplete for commands, files, and paths
  • Persistent simulated filesystem with read/write operations (touch, mkdir, rm, cp, mv, redirects)
  • Simulated users and permissions (su, sudo, chmod, chown, access checks)
  • Multi-host SSH simulation with isolated remote shell contexts
  • Simulated process table and live top mode
  • Service manager and log workflows (service, systemctl, journalctl, tail -f)
  • Mission/CTF workflow (mission list/start/hint/submit) with persistent progress
  • Fake package manager (rpk) with install/remove/info behavior
  • Persistent OS state in browser storage (save, reboot, reset --factory)
  • In-terminal nano-like editor with save/exit controls

Architecture

r00tsh follows a modular terminal engine:

  1. Presentation layer renders terminal UI, boot flow, cursor/input, and interaction modes.
  2. Command runtime parses commands, handles redirection/pipes/chaining, dispatches command handlers.
  3. OS simulation modules provide filesystem, shell context, network, processes, services, packages, missions, and persistence.
  4. State persistence layer snapshots and restores simulated OS data from browser storage.

This keeps high-frequency UI concerns in React components and simulation behavior in lib/*.

Key Modules

  • Terminal.tsx: terminal UI, input loop, autocomplete interaction, top/editor modes, reboot transition
  • BootSequence.tsx: startup cinematic and system boot reveal
  • Editor.tsx: nano-like in-terminal editor surface
  • commands.ts: parser/dispatcher and command handlers
  • shell.ts: shell session state, prompt, env, history, user context, remote stack
  • filesystem.ts: simulated Unix tree, metadata helpers, mutable FS operations
  • network.ts: host map, SSH targets, ping/curl/netstat/route/DNS simulation
  • processes.ts: dynamic process simulation, kill behavior, top snapshots
  • services.ts: service registry/state, status/start/stop/restart, journal sources
  • permissions.ts: user/group model and read/write/execute checks
  • missions.ts: mission definitions, progression, hints, answer validation
  • packages.ts: fake package manager and installable tool payloads
  • osState.ts: browser persistence and factory reset lifecycle
  • lore.ts: canonical narrative constants and story context

Command Examples

# shell + filesystem
pwd
ls -la /root
cat /var/log/auth.log
echo "incident marker" >> /tmp/notes.log
mkdir /tmp/evidence && cp /var/log/syslog /tmp/evidence/syslog.copy

# users + permissions
whoami
su ghost
sudo cat /etc/shadow
chmod 600 /tmp/notes.log
chown root:root /tmp/notes.log

# network + remote access
hosts
nmap 10.0.0.0/24
ssh 10.0.0.15
netstat -an
dig zetacorp-srv-04.zetacorp.com

# services + processes
service status
service stop beacon
systemctl status watchdog
journalctl -u beacon
ps aux
top

# missions + packages + persistence
mission list
mission start dropzone
mission hint
rpk list
rpk install scanner
save
reboot
reset --factory

Mission System

The mission layer turns the shell into a structured investigation flow:

  • mission list shows available objectives
  • mission start <id> activates a mission
  • mission status reports active/completed progress
  • mission hint gives directional clues without full answers
  • mission submit <answer> validates findings against simulated evidence

Current mission themes focus on:

  1. Identifying exfiltration infrastructure
  2. Finding and stopping malicious beacon activity
  3. Recovering and submitting the passphrase from host artifacts

Mission progress is persisted in browser storage with the rest of the OS state.

Local Development

Prerequisites

  • Node.js 20+
  • npm 10+ (or compatible package manager)

Run

npm install
npm run dev

Open: http://localhost:3000

Lint

npm run lint

Safety Note

All operating system, network, process, and service behavior in r00tsh is simulated in application code. There is no real host compromise, lateral movement, or network attack execution. The project is built for safe interactive storytelling, terminal UX engineering, and portfolio demonstration.

About

Cinematic browser terminal simulating a compromised Linux host. Next.js, shell navigation, filesystem, SSH, missions and persistent OS state.

Topics

Resources

License

Stars

Watchers

Forks

Contributors