Skip to content

shchuko/tg-shell-bot

Repository files navigation

tg-shell-bot - Run shell commands remotely with Telegram bot

The bot allows to execute commands on remote machine it is deployed.

Features:

  • you can filter the users who can access the bot
  • process output (stderr & stdout) is auto-updated and displayed by bot
  • multiple processes can run in parallel
  • running processes can be terminated with button (use case: start ngrok, use it, terminate when all's done)

Configuration file is expected to present as $HOME/.config/tg-shell-bot/config.property and contain:

telegram.api.key=0000000000:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
telegram.users.allowed=foobar,foobaz
shell.path=/bin/bash

You can specify custom config path or override properties with commandline arguments:

./tg-shell-bot -config "$CONFIG_PATH" -allowedUsers "user0,user1,user2" -shellPath "/bin/sh"

image

image

image