Recent

Author Topic: Shell remote via telegram bot  (Read 5434 times)

Renat.Su

  • Full Member
  • ***
  • Posts: 230
    • Renat.Su
Shell remote via telegram bot
« on: January 06, 2019, 09:20:01 am »
Anyone interested to manage a remote computer (a web server or a regular computer with access to the Internet) via telegram client, I made a working example of the program with source code https://github.com/Al-Muhandis/ShellRemoteBot
Actively tested on Linux (Debian), but should work on Windows. Instead of webhooks, longpolling is used to get updates from telegram server, respectively, the program can work not only on a web server, but also on any home computer.
It is convenient to manage a web server via telegram in the phone (of course you can search for SSH client on the phone, but if you already have telegram, you can use this service).
The program can run as a console program that runs manually and as a service/daemon
« Last Edit: September 09, 2021, 03:15:19 am by Renat.Su »

Renat.Su

  • Full Member
  • ***
  • Posts: 230
    • Renat.Su
Re: SSH emulator via telegram
« Reply #1 on: January 06, 2019, 09:24:24 am »
Thanks to Edson for tips about SIGnals

Renat.Su

  • Full Member
  • ***
  • Posts: 230
    • Renat.Su
Re: SSH emulator via telegram
« Reply #2 on: February 15, 2020, 03:08:30 pm »
Add HTTPS proxy support... ;)

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));
https://forum.lazarus.freepascal.org/index.php/topic,43574.msg349074.html#msg349074

Renat.Su

  • Full Member
  • ***
  • Posts: 230
    • Renat.Su
Re: SSH emulator via telegram
« Reply #3 on: May 17, 2020, 01:42:34 am »
Made an update (https://github.com/Al-Muhandis/ShellRemoteBot#script-files-macros) in the Shell Remote bot. So you can save frequent scripts for managing your server for use by the inline button

BillyKerk

  • Newbie
  • Posts: 2
Re: SSH emulator via telegram
« Reply #4 on: July 07, 2020, 01:22:00 pm »
wow...gret idea! Thank you for your work! A very useful solution. Telegram has become a multifunctional messenger that is developing into functional software ;)

Renat.Su

  • Full Member
  • ***
  • Posts: 230
    • Renat.Su
Re: SSH emulator via telegram
« Reply #5 on: July 07, 2020, 01:31:58 pm »
wow...gret idea! Thank you for your work! A very useful solution. Telegram has become a multifunctional messenger that is developing into functional software ;)
Yes, telegram as universal client... very useful. I use this code to manage my web server in any place (phone/computer)
« Last Edit: July 07, 2020, 09:07:01 pm by Renat.Su »

Renat.Su

  • Full Member
  • ***
  • Posts: 230
    • Renat.Su
Re: SSH emulator via telegram
« Reply #6 on: August 14, 2020, 10:11:39 pm »
Make first release (https://github.com/Al-Muhandis/ShellRemoteBot/releases/tag/1.0) with binaries for ShellRemoteBot (https://github.com/Al-Muhandis/ShellRemoteBot) (Telegram bot shell emulator).
Last changes - File manager functionality has been implemented. So now ShellRemoteBot you can use also as remote file manager via telegram.

While service can to browse directories and download files

Renat.Su

  • Full Member
  • ***
  • Posts: 230
    • Renat.Su
Re: SSH emulator via telegram
« Reply #7 on: August 27, 2021, 08:02:35 pm »
For Debian/UBUNTU OS, etc. added a DEB package https://github.com/Al-Muhandis/ShellRemoteBot/releases/tag/1.2  tgsh_1. 2-1_amd64.deb
The settings file is now stored separately from the binary in the place (for Linux): /etc/tgshd/tgshd.ini
You can return portable version as it was if you enable the compilation key -dPortable
The package includes the possibility of demonization: to do this, it is enough to turn on the service and run it:
Code: Bash  [Select][+][-]
  1. systemctl enable tgshd
  2. systemctl start tgshd

Renat.Su

  • Full Member
  • ***
  • Posts: 230
    • Renat.Su
Re: Shell remote via telegram bot
« Reply #8 on: October 29, 2022, 01:38:30 pm »
Uncritical errors of launching prepared scripts have been fixed https://github.com/Al-Muhandis/ShellRemoteBot/releases/tag/1.2.4
 Thank you for the feedback that helped fix a small bug in the program.
I remind you that with this program you can remotely control your computer or server via telegram messenger (file manager, ready-made scripts, console emulator)

 

TinyPortal © 2005-2018