Logo

0x3d.Site

is designed for aggregating information.
Welcome
check repository here

Teleterm

Telegram Bot Exec Terminal Command

codecov Mentioned in Awesome Go
Go Reference Go report card

teleterm2-demo

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/bin

  2. Build From Source If your arch os is not listed in the prebuilt binary you can build from source.

    Required :

    • Go ^1.18
    • gcc

    How 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
  1. Setting Up Config

    To setup fresh teleterm run

    teleterm fresh
    

    Teleterm Fresh Configure

    teleterm will create folder on your home folder with name .teleterm contains :

    • config.yaml config yaml hold teleterm config :

      KeyValue
      telegram_tokentelegram token from bot father
      shell_executor/bin/bash or /bin/sh .etc default is /bin/bash

      example config.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

Available Bot Command

CommandDescExample
/refreshRefresh the bot system/refresh
/run <command>executing command/run ping -c 5 8.8.8.8
/getfile <filepath>transfer donwload file from bot server/getfile /home/raspi/myfile.txt
/addbutton <button_name>!!<command>add button shortcut/addbutton ping!!ping -c 5 8.8.8.8
/deletebutton <button_name>delete button shortcut/deletebutton ping

Run Command

To execute commands from telegram just send a message using the following format :

/run <command>

for example :

/run ping -c 5 8.8.8.8

output replied by telegram bot :

Run command

Add Button Shortcut

To execute commands from the telegram button, you need to add a button, just send a message using the following format :

/addbutton <button_name>!!<command>

for example :

/addbutton ping!!ping -c 5 8.8.8.8

output replied by telegram bot :

Add Button

a new button will appear :

Show Buttons

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:

/deletebutton <button_name>

for example :

/deletebutton ping

output replied by telegram bot :

Delete Button

then updated buttons will appear.

Uploading File

To upload a file just send the document on telegram :

Upload File

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

Download file

To download the file simply send a message using the following format :

/getfile <filepath>

Filepath is the filepath where teleterm runs

for example :

/getfile /home/raspi/hello.txt

output replied by telegram bot :

Downloaded File

Golang
Golang
Golang, or Go, is a statically typed programming language developed by Google. It’s known for its simplicity, performance, and support for concurrent programming. Go is widely used in cloud computing, server-side applications, and microservices.
GitHub - goyek/goyek: Task automation Go library
GitHub - goyek/goyek: Task automation Go library
gommon/color at master · labstack/gommon
gommon/color at master · labstack/gommon
GitHub - blevesearch/bleve: A modern text/numeric/geo-spatial/vector indexing library for go
GitHub - blevesearch/bleve: A modern text/numeric/geo-spatial/vector indexing library for go
GitHub - schollz/progressbar: A really basic thread-safe progress bar for Golang applications
GitHub - schollz/progressbar: A really basic thread-safe progress bar for Golang applications
GitHub - free/concurrent-writer: Highly concurrent drop-in replacement for bufio.Writer
GitHub - free/concurrent-writer: Highly concurrent drop-in replacement for bufio.Writer
GitHub - mattn/go-colorable
GitHub - mattn/go-colorable
GitHub - StudioSol/set: A simple Set data structure implementation in Go (Golang) using LinkedHashMap.
GitHub - StudioSol/set: A simple Set data structure implementation in Go (Golang) using LinkedHashMap.
GitHub - essentialkaos/branca: Authenticated encrypted API tokens (IETF XChaCha20-Poly1305 AEAD) for Golang
GitHub - essentialkaos/branca: Authenticated encrypted API tokens (IETF XChaCha20-Poly1305 AEAD) for Golang
Cloud Native Computing Foundation
Cloud Native Computing Foundation
GitHub - sakirsensoy/genv: Genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables to be loaded from the .env file.
GitHub - sakirsensoy/genv: Genv is a library for Go (golang) that makes it easy to read and use environment variables in your projects. It also allows environment variables to be loaded from the .env file.
GitHub - heetch/confita: Load configuration in cascade from multiple backends into a struct
GitHub - heetch/confita: Load configuration in cascade from multiple backends into a struct
GitHub - brianvoe/sjwt: Simple JWT Golang
GitHub - brianvoe/sjwt: Simple JWT Golang
GitHub - subpop/go-ini: Go package that encodes and decodes INI-files
GitHub - subpop/go-ini: Go package that encodes and decodes INI-files
GitHub - DylanMeeus/GoAudio: Go tools for audio processing & creation 🎶
GitHub - DylanMeeus/GoAudio: Go tools for audio processing & creation 🎶
GitHub - daviddengcn/go-colortext: Change the color of console text.
GitHub - daviddengcn/go-colortext: Change the color of console text.
GitHub - andOTP/andOTP: [Unmaintained] Open source two-factor authentication for Android
GitHub - andOTP/andOTP: [Unmaintained] Open source two-factor authentication for Android
GitHub - alfiankan/crab-config-files-templating: Dynamic configuration file templating tool for kubernetes manifest or general configuration files
GitHub - alfiankan/crab-config-files-templating: Dynamic configuration file templating tool for kubernetes manifest or general configuration files
GitHub - viney-shih/go-cache: A flexible multi-layer Go caching library to deal with in-memory and shared cache by adopting Cache-Aside pattern.
GitHub - viney-shih/go-cache: A flexible multi-layer Go caching library to deal with in-memory and shared cache by adopting Cache-Aside pattern.
GitHub - TreyBastian/colourize: An ANSI colour terminal package for Go
GitHub - TreyBastian/colourize: An ANSI colour terminal package for Go
GitHub - Evertras/bubble-table: A customizable, interactive table component for the Bubble Tea framework
GitHub - Evertras/bubble-table: A customizable, interactive table component for the Bubble Tea framework
GitHub - deatil/go-array: A Go package that read or set data from map, slice or json
GitHub - deatil/go-array: A Go package that read or set data from map, slice or json
GitHub - cometbft/cometbft: CometBFT (fork of Tendermint Core): A distributed, Byzantine fault-tolerant, deterministic state machine replication engine
GitHub - cometbft/cometbft: CometBFT (fork of Tendermint Core): A distributed, Byzantine fault-tolerant, deterministic state machine replication engine
GitHub - icza/session: Go session management for web servers (including support for Google App Engine - GAE).
GitHub - icza/session: Go session management for web servers (including support for Google App Engine - GAE).
GitHub - cristalhq/jwt: Safe, simple and fast JSON Web Tokens for Go
GitHub - cristalhq/jwt: Safe, simple and fast JSON Web Tokens for Go
GitHub - lrita/cmap: a thread-safe concurrent map for go
GitHub - lrita/cmap: a thread-safe concurrent map for go
GitHub - wzshiming/ctc: Console Text Colors - The non-invasive cross-platform terminal color library does not need to modify the Print method
GitHub - wzshiming/ctc: Console Text Colors - The non-invasive cross-platform terminal color library does not need to modify the Print method
GitHub - goradd/maps: map library using Go generics that offers a standard interface, go routine synchronization, and sorting
GitHub - goradd/maps: map library using Go generics that offers a standard interface, go routine synchronization, and sorting
GitHub - alfiankan/teleterm: Telegram Bot Exec Terminal Command
GitHub - alfiankan/teleterm: Telegram Bot Exec Terminal Command
GitHub - JeremyLoy/config: 12 factor configuration as a typesafe struct in as little as two function calls
GitHub - JeremyLoy/config: 12 factor configuration as a typesafe struct in as little as two function calls
GitHub - goraz/onion: Layer based configuration for golang
GitHub - goraz/onion: Layer based configuration for golang
Golang
More on Golang

Programming Tips & Tricks

Code smarter, not harder—insider tips and tricks for developers.

Error Solutions

Turn frustration into progress—fix errors faster than ever.

Shortcuts

The art of speed—shortcuts to supercharge your workflow.
  1. Collections 😎
  2. Frequently Asked Question's 🤯

Tools

available to use.

Made with ❤️

to provide resources in various ares.