Skip to content

lbeckman314/demonic-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

demonic logo

demonic-server

The backend for a web-based terminal to run commands and code snippets in a sandboxed environment.

Try it out at liambeckman.com/code/demonic.

demonic in action

Inspired By

Demonic was inspired by the following cool projects:

Installation

# get code
git clone https://github.com/lbeckman314/demonic-server
cd demonic-server

# install dependencies
npm install

# copy example config
cp src/config-example.js src/config.js

# edit key, certificate, and passphrase information
vim src/config.js

# run server (if no port number is provided, 12345 in this example, the server will default to port 8181)
npm run start -- 12345

# then you can connect to the server from a demonic client.

Uninstallation

# remove this directory
rm -rf demonic-server

Message Protocol

  1. Connection is established between client and server. Client displays user prompt.
user @ demonic >
  1. Client sends user input to the server.
user @ demonic > echo "Wow, I'm in a shell!"\n
  1. Server searches for echo in the list of allowed programs. If found, server spawns the echo process.

  2. Server sends client the output of the command.

{ out: "Wow, I'm in a shell!" }
  1. Client displays output of the command to the user.
user @ demonic > echo "Wow, I'm in a shell!"\n
Wow, I'm in a shell!
  1. Server sends client the exit status of the command.
{ exit: 0 }
  • Client displays user prompt on terminal. Ready for next command!