Skip to content

A python script to remotely control a terminal in a linux pc from Telegram

Notifications You must be signed in to change notification settings

RodrigoDePool/Terminal_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Terminal bot


This python script allows to execute commands remotely on a linux terminal from telegram.

Setup


First we must create a telegram bot: Access telegram and look for the user @BotFather, send him the command "/newbot" and follow the instructions. Please store the token given, we will use it later on.

Now let's setup the script. First we need to install the python wrapper python-telegram-bot. Once installed we are almost ready to go. We need to open the terminalbot.py and change "A" for the token given by @BotFather:

TOK = 'A'

Also we need to change 0 for our personal telegram id:

usr_id = 0

If we do not know it we can execute the script, open a conversation with our bot in telegram and send him the command "/userid". This will return us the telegram user id. Now we may change it in the code and once again run the script. Done! You can now execute commands from telegram in your linux terminal.

To execute the script: python terminalbot.py

To kill the script: Ctrl+C

Known bugs


We cannot execute sudo commands or open new terminals of any kind (python, bash, ...). Possibly there are more commands that can't be executed through telegram.

About

A python script to remotely control a terminal in a linux pc from Telegram

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages