Giter VIP home page Giter VIP logo

telegram-shell-bot's Introduction

Telegram Shell Bot

This is a Telegram Bot to run shell commands.

Requirments

  • Python 3.8+
  • Poetry

Install

  1. Create a bot and get token from BotFather bot

  2. Clone Telegram Shell Bot

     git clone https://github.com/vicalloy/telegram-shell-bot.git
    
  3. Copy settings.py.sample to settings.py and config it.

    • TOKEN Bot token generated by BotFather
    • ENABLED_USERS Your telegram user id. Only enabled users can use this bot.
      • -999999 will disable authentication. Public bot is very danger for your server, dont's use root to run this bot. You must add settings CMD_WHITE_LIST or ONLY_SHORTCUT_CMD=True(recommend) for a public bot.
    • CMD_WHITE_LIST Only command in CMD_WHITE_LIST can be execute. Let it empty if no restriction.
    • CMD_BLACK_LIST Ignore command in CMD_BLACK_LIST.
    • CMD_BLACK_CHARS Ignore command contain char in CMD_BLACK_LIST.
    • PROXY_URL Proxy url.
    • SC_MENU_ITEM_ROWS Command shortcut config.
    • ONLY_SHORTCUT_CMD Run command by shortcut menu only. Other commands will be ignored.
  4. Create a virtual environment and install required packages

     poetry install --only main
     poetry shell
    

Run

poetry shell
python bot.py

Run with pm2

pm2 is one of the best tools today for server production and make your bot for remote online 24/7 hours

install and doc for pm2 in https://pm2.keymetrics.io/

start bot with

pm2 start telegram-shell-bot.yml
pm2 save # save runing command
pm2 startup # for autostart on bot

Usage

  1. Talk to the bot. Every message will be treated as a shell command.

  2. /tasks to show all running tasks

  3. /kill to kill a running task

  4. /download to download file from server. ex: /download README.md

  5. The file send to bot will upload to folder ./upload/ .

  6. /sudo_login to call sudo

  7. /script to run scripts in ./scripts directory

  8. The bot sends first 3sec's output for every command. You can add oa in command to send all output. E.g.:

     oa;ping google.com
     /script oa;demo.py
    

telegram-shell-bot's People

Contributors

vicalloy avatar tobigod123 avatar dependabot[bot] avatar oldherl avatar mohamad-supangat avatar

Forkers

mrlabani

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.