• Stars
    star
    192
  • Rank 202,019 (Top 4 %)
  • Language
    Python
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A telegram Bot to run shell commands

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
    

More Repositories

1

outline-docker-compose

Install a self-hosted Outline wiki instance in a couple of minutes
Shell
743
star
2

LBForum

LBForum is a forum engine written in Python using Django
Python
590
star
3

django-lb-workflow

Reusable workflow library for Django
Python
210
star
4

DPress

A simple blog powered by Django
Python
87
star
5

timeline-site

a site about timeline
JavaScript
83
star
6

lbforum-site

LBForum's Demo Site
Python
65
star
7

china-population

图表化中国人口统计数据
Python
46
star
8

dj-scaffold

dj-scaffold installs a script which allows the easy creation of a standard Django project layout
Python
34
star
9

carrot-box

Carrot box is a workflow platform. Ready to go.
Python
23
star
10

django-simple-todo

Python
21
star
11

lbplayer

a web music player, powered by jplayer and django.
JavaScript
21
star
12

daily-portrait

Automatically align portraits and create a time-lapse video. (photo a day)
Python
19
star
13

image-transformer

React App for style transfer using ONNX Runtime Web. (fast-neural-style / AnimeGANv2)
JavaScript
18
star
14

magpie

A stock tool, set stop-loss and revenue points for stocks, and initiate message pushes when stop-loss or revenue points are reached.
Python
16
star
15

lb-maze

A random maze generator, solver, and renderer.
CoffeeScript
12
star
16

django-simple-avatar

A reusable django application for handling Avatars.
Python
12
star
17

onlineuser

a django app output online users
Python
11
star
18

jobmonitor

招聘网站信息监控工具,监控招聘网站工作岗位更新情况并发送通知
Python
11
star
19

jstnote

Python
9
star
20

12306-ticket-checker

Python
8
star
21

docker-images

Dockerfiles for poetry/mlc-llm(rk3588)/...
Dockerfile
8
star
22

django-helper

a collection of useful middleware, template tags, etc
Python
8
star
23

django-lbattachment

A django app to manager attachments.
Python
7
star
24

oidc-server

A self-hosted OIDC server
Python
7
star
25

django-lb-attachments

A generic Django application to attach Files
Python
7
star
26

gaokao

历年高考人数及录取率 1977~2023
HTML
6
star
27

lbutils

A set of useful function/tags/filter for Django.
Python
3
star
28

lb.ting

C#
3
star
29

django-lb-adminlte

Reusable AdminLTE templates library for Django
JavaScript
2
star
30

scnews

汇聚各论坛二手数码交易信息
Python
2
star
31

dotfiles

vicalloy's dotfiles
Shell
1
star
32

jobmonitorweb

Python
1
star
33

html5gamedev

collect html5 game develop resource
1
star
34

html2markdown

JavaScript
1
star