witty/README.md

49 lines
1.9 KiB
Markdown
Raw Normal View History

2022-01-06 00:04:37 +01:00
# Web Terminal
A (unsafe) technical demo to export a shell to web browser.
2022-01-07 15:00:44 +01:00
It is just a simple demo in case some people are interested in
how to setup xterm.js with websocket.
2022-01-06 00:04:37 +01:00
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).
2022-01-07 15:00:44 +01:00
___It is amazing what you can do with 270 lines of go code.___
2022-01-06 00:04:37 +01:00
2022-01-07 02:34:37 +01:00
To use the program, download/clone the code, and in the web_terminal
directory, run ```go build .```, this will create the binary called
2022-01-07 15:00:44 +01:00
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```.
2022-01-07 02:34:37 +01:00
If no cmd and options are given, web_terminal will run bash by default.
2022-01-07 15:00:44 +01:00
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```.
The program
2022-01-07 02:37:57 +01:00
has been tested on Linux, WSL2, Raspberry Pi 3B (Debian), and MacOSX.
2022-01-07 02:34:37 +01:00
***known bug***
2022-01-07 02:37:57 +01:00
2022-01-07 02:34:37 +01:00
On MacOS X, running zsh with web_terminal will produce an extra %
2022-01-07 15:04:10 +01:00
each time in Google Chrome. Consider it a ___feautre___, will not
fix unless there is a pull request. Safari works fine though.
2022-01-07 02:34:37 +01:00
2022-01-06 00:04:37 +01:00
**NOTE**
___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.___
2022-01-07 15:00:44 +01:00
Here is a screencast for sshing into Raspberry Pi running
2022-01-07 15:04:10 +01:00
[pi-hole](https://pi-hole.net/)
(```./web_terminal ssh 192.168.1.2 -l pi```,
web_terminal runs in a WSL2 VM on Windows):
2022-01-06 00:04:37 +01:00
2022-01-07 15:00:44 +01:00
<img src="https://github.com/syssecfsu/web_terminal/blob/master/extra/screencast.gif?raw=true" width="800px">