+
+To use the program, you need to provide a TLS cert. You can request a free [Let's Encrypt](https://letsencrypt.org/) cert or use a self-signed cert. The program currently does not support user authentication. Therefore, do not run it in untrusted networks or leave it running. A probably safe use of the program is to run ```ssh```. Please ensure that you do not automatically login to the ssh server (e.g., via key authentication).
+
+___AGAIN, Do NOT run this in an untrusted network. You will expose your
+shell to anyone that can access your network and Do NOT leave
+the server running.___
This program is written in the go programming language, using the
Gin web framework, gorilla/websocket, pty, and xterm.js!
The workflow is simple, the client will initiate a terminal
-window (xterm.js) and create a websocket with the server. On
-the server side, it serves the basic HTML/JS/CSS files and
-websockets (by shovling the data between pty and xterm).
-
-___It is amazing what you can do with 270 lines of go code.___
-
-To use the program, download/clone the code, and in the web_terminal
-directory, run ```go build .```, this will create the binary called
-web_terminal. Then, go to the tls directory and create a self-signed
-certificate according to the instructions in README.
-
-To run it, use ```./web_terminal cmd options_to_cmd```.
-If no cmd and options are given, web_terminal will run bash by default.
-You can run shells but also single programs, such as htop. For example,
-you can export the ssh shell, such as ```./web_terminal ssh 192.168.1.2 -l pi```.
+window (xterm.js) and create a websocket with the server, which relays the data between pty and xterm.
+## Installation
-The program
-has been tested on Linux, WSL2, Raspberry Pi 3B (Debian), and MacOSX.
+1. Install the [go](https://go.dev/) compiler.
+2. Download the release and unzip it, or clone the repo
+
+ ```git clone https://github.com/syssecfsu/web_terminal.git```
-***known bug***
+3. Go to the ```tls``` directory and create a self-signed cert
+
+ \# Generate a private key for a curve
-On MacOS X, running zsh with web_terminal will produce an extra %
-each time in Google Chrome. Consider it a ___feautre___, will not
-fix unless there is a pull request. Safari works fine though.
+ ```openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem```
+ \# Create a self-signed certificate
-**NOTE**
+ ```openssl req -new -x509 -key private-key.pem -out cert.pem -days 360```
-___Do NOT run this in an untrusted network. You will expose your
-shell to anyone that can access your network and Do NOT leave
-the server running.___
+4. Return to the root directory of the source code and build the program
+
+ ```go build .```
+
+5. Start the server and give it the command to run. The server listens on 8080, for example:
+
+ ```./web_terminal htop``` or
+
+ ```./web_terminal ssh From {{.ip}}, running {{.cmd}}
- View +From {{.Ip}}, running {{.Cmd}}, session ID: {{.Name}} +
+ View + Session