View and control remote terminals from your browser
Project description
View and control remote terminals from your browser
Documentation: https://cs01.github.io/termpair
Source Code: https://github.com/cs01/termpair
What is TermPair?
TermPair lets developers share and control terminals in real time.
Usage
Start the TermPair server:
termpair share
Then share your terminal by running:
termpair share
A URL will be printed to the terminal, such as:
http://localhost:8000/?id=5a32e471453c0bb0c642acbbd6ee58f8
That URL is valid for the current terminal sharing session. The session ends when the process being broadcast ends, usually by typing quit
or exit
, or by closing the terminal window. At that time, the URL is no longer valid.
The session can be shared with others who you want to view and optionally control your terminal from a browser:
Pass the -a
flag to grant the browser control of the terminal:
termpair share -a
Quickstart
To quickly get up and running (without even having to install to your system!), use pipx to start the server:
pipx run termpair serve
Then share your client by running
pipx run termpair share -b
The -b
flag will automatically open a browser tab to view the shared terminal.
Installation
You can install using pipx or pip:
pipx install termpair
or
pip install termpair
API
To view the command line API reference, run:
termpair --help
Security Considerations
It should go without saying but this can be extremely dangerous if you use it improperly.
You should only broadcast a terminal session you want to be shared, and only share the URL with those you trust. No password is required after opening the URL, so consider it to be sensitive information!
By using TermPair, anyone with the sharable URL can:
- View every keystroke you make (even passwords that appear hidden in the terminal).
- View every character output by the terminal.
If you are in a public location, someone over your shoulder could see this url, or take a picture of it, providing them the ability to view or control your termpair session.
If you allow other users to control your terminal, they can:
- Run any commands.
- View/modify/delete any files.
- Restart or corrupt your computer.
- Install a virus.
If you run the server locally on the default host, it will not be accessible to anyone other than you. These security implications apply if you are exposing the port to others.
System Requirements
Operating System:
- To view/control from the browser: All operating systems are supported.
- To run the server,
termpair serve
: Tested on Linux. Should work on macOS. Might work on Windows. - To share your terminal,
termpair share
: Tested on Linux. Should work on macOS. Probably doesn't work on Windows.
Python: 3.6
How It Works
TermPair is built with Python and leverages asynchronous paradigms, so it's efficient and snappy. It uses the Bocadillo web framework on the backend.
Run Server
The server acts as a router between a unix terminal broadcasting and the browser(s) that are remotely viewing the terminal.
It must be started before a terminal session can be broadcast.
$ termpair serve
INFO: Started server process [16592]
INFO: Waiting for application startup.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Terminals can now broadcast to http://127.0.0.1:8000 🎉.
Broadcast Your Terminal
To let others view your terminal:
$ termpair share
Sharing all input and output of `bash -l`.
WARNING: Your terminal is viewable but NOT controllable from
localhost:8000/?id=e8a7c806102134022455ddd1841470ed
Type 'exit' to stop sharing.
When you are no longer sharing, you will see the secret string 'dxQDwwWms844' printed.
$ exit
logout
You are no longer broadcasting (dxQDwwWms844)
Your terminal is now viewable at localhost:8000/?id=e8a7c806102134022455ddd1841470ed
. 🎉
To let others view and remotely control your terminal:
$ termpair share -a
...
WARNING: Your terminal is viewable AND controllable from
localhost:8000/?id=e8a7c806102134022455ddd1841470ed
...
When you run this, a new pty process is started locally, and by default launches a new instance of the shell you are using, such as bash
. But it can run any executable, interactive or not, with any arguments you want to supply.
You can pass the --cmd
flag to specify the process that is shared in the terminal session.
termpair share # shares current SHELL. Can run anything from within here, like vim.
termpair share --cmd $SHELL # equivalent to the above command
termpair share --cmd "python"
termpair share --cmd "gdb"
termpair share --cmd "gdb -p 1234"
The sharing session ends when the process the terminal was sharing ends, usually by typing exit
or quit
. It can also be ended by closing the terminal itself. Each session is assigned a unique TermPair session id, which is a short string of characters. The session id is never shared with the server or any viewers watching the session.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file termpair-0.0.0.2.tar.gz
.
File metadata
- Download URL: termpair-0.0.0.2.tar.gz
- Upload date:
- Size: 407.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | db4be4127ee8ef1f1cdd6eaabc4917749b17fdfb22d2f171b57a9c6f6259c3e3 |
|
MD5 | 043b8cd67ce56a83336332be6197acd7 |
|
BLAKE2b-256 | c28ad88e2197b6c20eccd1447231c93e403d47897d76b92ff32aafa31abd4be3 |
File details
Details for the file termpair-0.0.0.2-py3-none-any.whl
.
File metadata
- Download URL: termpair-0.0.0.2-py3-none-any.whl
- Upload date:
- Size: 415.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d4bde5d906b5076fac98f1aa80a1b3b4383327a9166e74641f6edec087937a3 |
|
MD5 | 65722b04457c74514d218b8648908603 |
|
BLAKE2b-256 | fbfc866cea0c85c60e919c36cffd315c0ff6d4374fc2c95f8f160d790166b167 |