Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alfiankan/teleterm
Telegram Bot Exec Terminal Command
https://github.com/alfiankan/teleterm
bot go golang ssh telegram telegram-bot terminal
Last synced: about 2 months ago
JSON representation
Telegram Bot Exec Terminal Command
- Host: GitHub
- URL: https://github.com/alfiankan/teleterm
- Owner: alfiankan
- License: mit
- Created: 2020-12-31T22:34:18.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-02T16:35:56.000Z (over 1 year ago)
- Last Synced: 2024-07-31T20:37:10.156Z (4 months ago)
- Topics: bot, go, golang, ssh, telegram, telegram-bot, terminal
- Language: Go
- Homepage:
- Size: 23.7 MB
- Stars: 34
- Watchers: 2
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-go - teleterm - Telegram Bot Exec Terminal Command. (Bot Building)
- fucking-awesome-go - teleterm - Telegram Bot Exec Terminal Command. (Bot Building)
- awesome-go - teleterm - Telegram Bot Exec Terminal Command. (Bot Building)
- awesome-go - teleterm - Telegram Bot Exec Terminal Command. (Bot Building)
- awesome-go-extra - teleterm - 12-31T22:34:18Z|2022-07-12T02:46:52Z| (Bot Building / Free e-books)
- awesome-go-with-stars - teleterm - Telegram Bot Exec Terminal Command. (Bot Building)
- awesome-go-cn - teleterm
- awesome-go-plus - teleterm - Telegram Bot Exec Terminal Command. ![stars](https://img.shields.io/badge/stars-38-blue) (Bot Building)
- awesome-go-plus - teleterm - Telegram Bot Exec Terminal Command. ![stars](https://img.shields.io/badge/stars-38-blue) (Bot Building)
README
# Teleterm
Telegram Bot Exec Terminal Command[![codecov](https://codecov.io/gh/alfiankan/teleterm/branch/main/graph/badge.svg?token=ZQ4Z1ZU4EM)](https://codecov.io/gh/alfiankan/teleterm)
[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)
[![Go Reference](https://pkg.go.dev/badge/github.com/alfiankan/teleterm/v2.svg)](https://pkg.go.dev/github.com/alfiankan/teleterm/v2)
[![Go report card](https://goreportcard.com/badge/github.com/alfiankan/teleterm)](https://goreportcard.com/badge/github.com/alfiankan/teleterm)![teleterm2-demo](https://user-images.githubusercontent.com/40946917/178386328-3795dc02-b30a-437a-a46b-20db141601d5.gif)
## Use Case
- Running command on IoT Device through telegram bot
- Transfering Files through telegram bot## How To Install
1. Prebuilt Binary
you can download prebuild binary depends on your os and arch, available prebuilts here:https://github.com/alfiankan/teleterm/releases/tag/v2.1.0
Once the binary is downloaded, you can move the binary to /usr/local/bin2. Build From Source
If your arch os is not listed in the prebuilt binary you can build from source.
Required :
- Go ^1.18
- gccHow to build :
- clone `git clone https://github.com/alfiankan/teleterm`
- build `go build -o teleterm-bin ./cmd...`## How To Run :
Required :
- Telegram bot tokens, to get tokens please refer to [Telegram Docs](https://core.telegram.org/bots#6-botfather)1. Setting Up Config
To setup fresh teleterm run
```bash
teleterm fresh
```
![Teleterm Fresh Configure](docs/teleterm-running.png)teleterm will create folder on your home folder with name `.teleterm` contains :
- config.yaml
config yaml hold teleterm config :| Key |Value |
| ------------- |-------------|
| telegram_token | telegram token from bot father |
| shell_executor | `/bin/bash` or `/bin/sh` .etc default is `/bin/bash`|example config.yaml
```yaml
teleterm:
telegram_token: "my_tele_token"
shell_executor: "/bin/bash"
```2. Run teleterm
To run teleterm simply run `teleterm` and log info will displayed.
![Teleterm Running](docs/teleterm-running-on.png)
## Available Bot Command
| Command |Desc |Example |
| ------------- |:-------------|:-------------|
|/refresh |Refresh the bot system | /refresh |
| /run ``| executing command | /run ping -c 5 8.8.8.8 |
| /getfile ``| transfer donwload file from bot server | /getfile /home/raspi/myfile.txt |
|/addbutton `!!`| add button shortcut | /addbutton ping!!ping -c 5 8.8.8.8 |
|/deletebutton ``|delete button shortcut | /deletebutton ping |## Run Command
To execute commands from telegram just send a message using the following format :
```bash
/run
```
for example :
```bash
/run ping -c 5 8.8.8.8
```
output replied by telegram bot :![Run command](docs/teleterm-run-cmd.png)
## Add Button Shortcut
To execute commands from the telegram button, you need to add a button, just send a message using the following format :
```bash
/addbutton !!
```
for example :
```bash
/addbutton ping!!ping -c 5 8.8.8.8
```
output replied by telegram bot :![Add Button](docs/teleterm-addbutton.png)
a new button will appear :
![Show Buttons](docs/teleterm-buttons.png)
## Shortcut Button
To run a command using a shortcut just click the telegram button the bot will find the exec command from the database.## Delete Button Shortcut
To remove a shortcut simply send a message using the following format:
```bash
/deletebutton
```
for example :
```bash
/deletebutton ping
```
output replied by telegram bot :![Delete Button](docs/teleterm-deletebutton.png)
then updated buttons will appear.
## Uploading File
To upload a file just send the document on telegram :![Upload File](docs/teleterm-upload.png)
By default it will upload in cwd path if you don't add target path on file mention.
output replied by telegram bot :
![Upload Success](docs/teleterm-upload-success.png)
## Download file
To download the file simply send a message using the following format :
```bash
/getfile
```Filepath is the filepath where teleterm runs
for example :
```bash
/getfile /home/raspi/hello.txt
```
output replied by telegram bot :![Downloaded File](docs/teleterm-downloadfile.png)