All Projects → Al-Muhandis → ShellRemoteBot

Al-Muhandis / ShellRemoteBot

Licence: MIT license
Shell remote control from telegram (SSH/terminal emulator)

Programming Languages

pascal
1382 projects
shell
77523 projects

Projects that are alternatives of or similar to ShellRemoteBot

WebView4Delphi
WebView4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC for Windows.
Stars: ✭ 157 (+460.71%)
Mutual labels:  lazarus, freepascal
bcrypt
BCrypt is a password hashing function
Stars: ✭ 138 (+392.86%)
Mutual labels:  lazarus, freepascal
lazarus
Notepas sources and other derived lazarus projects using the editor module.
Stars: ✭ 26 (-7.14%)
Mutual labels:  lazarus, freepascal
setup-lazarus
Set up your GitHub Actions workflow with a specific version of Lazarus
Stars: ✭ 29 (+3.57%)
Mutual labels:  lazarus, freepascal
brookframework
Microframework which helps to develop web Pascal applications.
Stars: ✭ 161 (+475%)
Mutual labels:  lazarus, freepascal
Axes-Armour-Ale
A fantasy, ASCII dungeon crawler for Windows, Linux & OSX
Stars: ✭ 22 (-21.43%)
Mutual labels:  lazarus, freepascal
Ascension
A metaheuristic optimization framework
Stars: ✭ 24 (-14.29%)
Mutual labels:  lazarus, freepascal
xavier
Xavier is a small object-oriented XML library for Lazarus and Delphi
Stars: ✭ 38 (+35.71%)
Mutual labels:  lazarus, freepascal
sizectrl
TSizeCtrl v8.2
Stars: ✭ 16 (-42.86%)
Mutual labels:  lazarus, freepascal
fp-telegram
Wrapper classes library for telegram bots API (FreePascal)
Stars: ✭ 59 (+110.71%)
Mutual labels:  lazarus, freepascal
VALIS
Vote ALlocating Immune System, an immune-inspired classification algorithm
Stars: ✭ 21 (-25%)
Mutual labels:  lazarus, freepascal
torokernel
This repository contains the source code of the unikernel toro
Stars: ✭ 107 (+282.14%)
Mutual labels:  lazarus, freepascal
brook-telegram
Telegram plugin for brookframework
Stars: ✭ 23 (-17.86%)
Mutual labels:  lazarus, freepascal
DfmExtractor
Small command line utility which allows you to extract DFM, LFM and FRM forms from executable files compiled by Delphi, Lazarus and CodeTyphon.
Stars: ✭ 22 (-21.43%)
Mutual labels:  lazarus, freepascal
QQWry
Delphi interface for QQWry IP database
Stars: ✭ 14 (-50%)
Mutual labels:  lazarus, freepascal
PospoliteView
Pospolite View aims to be a simple HTML viewer engine fully made in Free Pascal.
Stars: ✭ 29 (+3.57%)
Mutual labels:  lazarus, freepascal
TLightFileStream
Implements a lightweight, high-performance, non-allocating advanced-record-based wrapper around the SysUtils file handling routines as an alternative to Classes.TFileStream.
Stars: ✭ 21 (-25%)
Mutual labels:  lazarus, freepascal
Bauglir-WebSocket-2
Copy of https://code.google.com/archive/p/bauglir-websocket/
Stars: ✭ 15 (-46.43%)
Mutual labels:  lazarus, freepascal
iocp-delphi
Windows I/O Completion Port wrapper class for Delphi and Free Pascal
Stars: ✭ 47 (+67.86%)
Mutual labels:  freepascal
libpascurl
libPasCURL is delphi and object pascal wrapper around cURL library. Library for transferring data with URL syntax, supporting HTTP, HTTPS, FTP, FTPS, GOPHER, TFTP, SCP, SFTP, SMB, TELNET, DICT, LDAP, LDAPS, FILE, IMAP, SMTP, POP3, RTSP and RTMP.
Stars: ✭ 58 (+107.14%)
Mutual labels:  freepascal

Shell remote control from telegram

Description of the ShellRemoteBot

Helps you work with your server (or remote computer) via telegram bot emulating terminal operations (sh for Linux and cmd for Windows) and a file manager functionality.

It is possible to work in the terminal from under any user in OS. You can configure access to several telegram users or only for You.

The program can run as a regular console program or run as a daemon/service.

Tested in Linux but You can try to use in other OS also. Developed with FreePascal. It depends on fp-telegram lib .

Script files (macros)

You can specify predefined shell scripts. Create script file with extention .script in the same folder where INI file is located. Get the script menu by command /scripts. Click the selected script.

File manager

You can call the file manager by /dir command then select directory inline button (select another folder) or file inline button (select the file to download).

You can set the default value in the configuration file (DefaultDir in [File] section)

Installation

  1. Create bot https://core.telegram.org/bots/#3-how-do-i-create-a-bot . You must select (keep default) longpolling method for getting updates.
  2. Create config ini file tgshd.ini in app folder:
[API]
;; Specify Your token
Token=
;; Actual if telegram server is blocked in server/computer region
Endpoint=https://api.telegram.org/bot
;; Timeout for lognpolling requests while getting updates
Timeout=20

[Users]
;; Specify all admin users (Telegram UserID [Integer]). For example: 
;;123456789=a
;; where 'a' character is means administrator, 'b' - banned
YOUR_User_ID=a
[Proxy]
;; If You can want to use HTTP proxy please use tgsynapsehttpclientbroker
Host=
Port=
Username=
Password=

[Scripts]
;; You can specify directory for script file folder. Default value equal configuration file directory
Directory=

[File]
;; You can specify default initial directory path for file manager called by /dir command
DefaultDir=
  1. Run as a console program or daemon/service.

DEB package

You can easily install using a .deb file on Debian/Ubuntu/etc. Download deb package from release section https://github.com/Al-Muhandis/ShellRemoteBot/releases Then install for example:

sudo dpkg --install tgsh_1.2-1_amd64.deb
# After package installation set up at least token and admin user id in the INI file located at /etc/tgshd/tgshd.ini
# for example with Nano editor
sudo nano /etc/tgshd/tgshd.ini
# Now You can run /usr/bin/tgshd -r
# Or is better enable and run as a daemon (service file for systemd inlcluded in the DEB package)
systemctl enable tgshd
systemctl start tgshd

Users rights and telegram user ID

You can define user access in configuration file tgshd.ini by adding string like user_id=a where user_id is telegram user id of administrator. You can add more than one administrator. If any simple telegram user sends any message, command etc to the bot then the bot will reply You cannot access to this bot!. if You add a line user_id=b then user will banned and the bot will not respond anything

There are some ways to determine your user_id but You can simply send /myid to @HelloLazarusBot chat

Telegram bot commands

/read

Reads messages from the shell console. Sometimes the program does not wait for a response immediately after execution in the console, and in this case, you can read the newly appeared messages by the /read command.

/sig and /sigXXXX

It is worked under Unix systems. You can send POSIX signal to terminal. For example, /sig 9 where 9 is kill sig number or You can send commands /sigint, /sigkill, /sigquit and /sigterm.

/scripts

Calls the menu for executing the prepared script from the list of files. Scripts must located in the same folder where the INI file is located, or you can set the folder in the settings in the the [Scripts] section / Directory

/dir

Calls the file Manager. You can set the default value in the configuration file

HTTP proxy

If you want to add HTTP proxy support, then:

  • add laz_synapse.lpk depending on the project
  • add tgsynapsehttpclientbroker to the uses block
  • set the proxy data in the INI file. Note: The native FPHTTPClient does not yet have full HTTPS proxy support. So in the case of synapse HTTP client, to make the HTTPs proxy work in Linux (laz_synapse.lpk v40.1), comment out the line in the blcksock.pas source unit of the synapse library. // Port := IntToStr(ResolvePort(Port));
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].