TeleRemBash
TeleRemBash is a Telegram Bot for executing scripts on a remote system, baked with TOTP Authentication for a secure and easy setup (QR codes).
To keep things simple TeleRamBash allows a single Telegram user after a successful TOTP Authentication to execute a pre-defined (bash) script by sending a command to the Bot in a Telegram chat, like this:
/do some-script optional-param1
Usage
To install from pypi:
pip install telerembash
First create a configuration for your Telegram Bot instance by specifying the bot’s API_TOKEN and the Telegram username of the whitelisted user:
telerem init --api-token API_TOKEN --username USERNAME
this should create a telerem.config.yaml in the current directory and output a QR Code to be scanned in your TOTP Authenticator App (i.e. Google Authenticator, andOTP, etc).
To see all available options, try:
telerem --help
you can edit telerem.config.yaml by hand or call telerem init multiple times, to tweak the config. Note the scripts_root in the config - this is the location (absolute or relative to the current working directory) of the directory containing the script your bot will execute.
To start the bot:
telerem start --config config.yaml
Once your bot is running, you should add it in a chat. It will ignore all your messages until it sees a
/auth <code>
command, where <code> is the authentication code generated by your TOTP Authenticator.
And once you are successfully authenticated, you can execute a script by sending a Telegram message like this:
/do some-script-name param1 param2
The bot will reply to a /do command by looking under scripts_root for a file with the name some-script-name or some-script-name.sh and executing it (with the provided optional parameters).
Run as a Service (WIP)
You can also create a systemd service or a daemon script for running your bot in the background like this:
telerem install --systemd | sudo bash # for systemd
telerem install --initd | sudo bash # otherwise
this will:
create a system user teleremd
setup a python venv under /home/teleremd/
create a service (either systemd or init.d):
systemd service unit /etc/systemd/system/teleremd.service
deamon script /etc/init.d/teleremd
populate the daemon configuration under /etc/teleremd.config.yaml
and finally:
sudo systemctl daemon-reload # for systemd
sudo systemctl start teleremd
NEWS
21.Jan.2021 - available on pypi
16.Jan.2021 - install as a systemd service (init.d still WIP)
15.Jan.2021 - README: Usage instructions
09.Jan.2021 - initial commit
LICENSE
MIT. See License File.
Resources
Telegram - Telegram BOT API
PyOTP - The Python One-Time Password Library
python-qrcode - QR code generator for text terminals
Metadata
Release files for telerembash 0.2.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| telerembash-0.2.8.tar.gz | 13.5 kB | Without provenance | Details for telerembash-0.2.8.tar.gz |
Release files / telerembash-0.2.8.tar.gz
| Download URL | telerembash-0.2.8.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7efdb918f4df0d88c594916c8231bce2461b206e1b24b9e0361bedaa71139e13
|
|
BLAKE2b-256 checksum How to use checksums |
5aa8522e266f3f86e34781fbc225cd1d9f2d92de520fe15542f6238b7be16d87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.1
|
Security for telerembash 0.2.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.