-- Leo's gemini proxy
-- Connecting to gemini.dimakrasner.com:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
This is easily one of the ugliest pieces of software I've ever written.
┌────────────────────────────────────────────────────────────────────────────────┐ │ It is written in the Book of Lugh: │ │ │ │ After the Creation, the cruel god Moloch rebelled │ │ against the authority of Marduk the Creator. │ │ Moloch stole from Marduk the most powerful of all │ │ the artifacts of the gods, the Amulet of Yendor, │ │ and he hid it in the dark cavities of Gehennom, the │ │ Under World, where he now lurks, and bides his time. │ │ │ │ Your god Lugh seeks to possess the Amulet, and with it │ │ to gain deserved ascendance over the other gods. │ │ │ │ You, a newly trained Gallant, have been heralded │ │ from birth as the instrument of Lugh. You are destined │ │ to recover the Amulet for your deity, or die in the │ │ attempt. Your hour of destiny has come. For the sake │ │ of us all: Go bravely with Lugh! │ │ --More-- │ │ ........| │ │ |...@u..| │ │ --------- │ │ │ │Root the Gallant St:15 Dx:8 Co:12 In:7 Wi:16 Ch:17 Lawful │ │Dlvl:1 $:0 HP:16(16) Pw:4(4) AC:3 Xp:1 │ └────────────────────────────────────────────────────────────────────────────────┘
It consists of:
NetHack, running in a chroot environment
A seccomp-based sandbox that runs the game under a pty, injects commands received through a Unix socket into the game's stdin and splice()s the game's raw output (with terminal escape sequences) to stdout
A Go tool with the sandbox stdout as its stdin, which emulates a VT100 and dumps the 80x24 terminal contents to a file every second
gmnisrv with CGI that starts the game, reads the dump, or sends input to the sandbox
-- Response ended
-- Page fetched on Fri May 10 08:30:35 2024