{"id":23394279,"url":"https://github.com/al-muhandis/shellremotebot","last_synced_at":"2025-04-11T12:53:30.164Z","repository":{"id":90606718,"uuid":"161829456","full_name":"Al-Muhandis/ShellRemoteBot","owner":"Al-Muhandis","description":"Shell remote control from telegram (SSH/terminal emulator)","archived":false,"fork":false,"pushed_at":"2024-12-17T12:56:35.000Z","size":2933,"stargazers_count":44,"open_issues_count":0,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-25T09:11:50.181Z","etag":null,"topics":["bash","daemon","freepascal","lazarus","pascal","shell","ssh","telegram","telegram-bot","terminal-emulators"],"latest_commit_sha":null,"homepage":"","language":"Pascal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Al-Muhandis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-14T19:09:15.000Z","updated_at":"2025-03-14T14:56:57.000Z","dependencies_parsed_at":"2024-11-19T03:55:33.751Z","dependency_job_id":null,"html_url":"https://github.com/Al-Muhandis/ShellRemoteBot","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Al-Muhandis%2FShellRemoteBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Al-Muhandis%2FShellRemoteBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Al-Muhandis%2FShellRemoteBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Al-Muhandis%2FShellRemoteBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Al-Muhandis","download_url":"https://codeload.github.com/Al-Muhandis/ShellRemoteBot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248403607,"owners_count":21097553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","daemon","freepascal","lazarus","pascal","shell","ssh","telegram","telegram-bot","terminal-emulators"],"created_at":"2024-12-22T06:14:15.653Z","updated_at":"2025-04-11T12:53:30.141Z","avatar_url":"https://github.com/Al-Muhandis.png","language":"Pascal","readme":"# Shell remote control from telegram\n\n## Description of the ShellRemoteBot\n\nHelps 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.\n\nIt 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.\n\nThe program can run as a regular console program or run as a daemon/service.\n\nTested in Linux but You can try to use in other OS also. Developed with FreePascal. It depends on fp-telegram lib .\n\n## Script files (macros)\nYou can specify predefined shell scripts. Create script file with extention `.script` in the same folder where INI file is located. \nGet the script menu by command `/scripts`. Click the selected script.\n\n## File manager\nYou 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).\n\nYou can set the default value in the configuration file (`DefaultDir` in `[File]` section)\n\n## Installation\n\n1. Create bot https://core.telegram.org/bots/#3-how-do-i-create-a-bot . You must select (keep default) longpolling method for getting updates.\n2. Create config ini file `tgshd.ini` in app folder:\n\n``` INI\n[API]\n;; Specify Your token\nToken=\n;; Actual if telegram server is blocked in server/computer region\nEndpoint=https://api.telegram.org/bot\n;; Timeout for lognpolling requests while getting updates\nTimeout=20\n\n[Users]\n;; Specify all admin users (Telegram UserID [Integer]). For example: \n;;123456789=a\n;; where 'a' character is means administrator, 'b' - banned\nYOUR_User_ID=a\n[Proxy]\n;; If You can want to use HTTP proxy please use tgsynapsehttpclientbroker\nHost=\nPort=\nUsername=\nPassword=\n\n[Scripts]\n;; You can specify directory for script file folder. Default value equal configuration file directory\nDirectory=\n\n[File]\n;; You can specify default initial directory path for file manager called by /dir command\nDefaultDir=\n```\n\n3. Run as a console program or daemon/service.\n\n### DEB package\nYou can easily install/upgrade using a .deb file on Debian/Ubuntu/etc.\n\n#### installation with deb \nDownload deb package from release section https://github.com/Al-Muhandis/ShellRemoteBot/releases\nThen install for example:\n```SH\nsudo dpkg --install tgshd_1.2.5-2_amd64.deb\n# After package installation set up at least token and admin user id in the INI file located at /etc/tgshd/tgshd.ini\n# for example with Nano editor\nsudo nano /etc/tgshd/tgshd.ini\n# Now You can run /usr/bin/tgshd -r\n# Or is better enable and run as a daemon (service file for systemd inlcluded in the DEB package)\nsystemctl enable tgshd\nsystemctl start tgshd\n```\n#### Upgrade with deb\n\n```SH\nsudo systemctl stop tgshd\nsudo dpkg --install tgshd_1.2.5-2_amd64.deb\nsudo systemctl daemon-reload\nsystemctl start tgshd\n```\n\n## Users rights and telegram user ID\nYou 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.\nYou can add more than one administrator.\nIf any _simple_ telegram user sends any message, command etc to the bot then the bot will reply `You cannot access to this bot!`.\nif You add a line `user_id=b` then user will banned and the bot will not respond anything\n\nThere are some ways to determine your user_id but You can simply send `/myid` to [@HelloLazarusBot](https://t.me/hellolazarusbot) chat\n\n## Telegram bot commands\n### /read\nReads messages from the shell console.\nSometimes 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.\n### /sig and /sigXXXX\nIt is worked under Unix systems. You can send POSIX signal to terminal. \nFor example, `/sig 9` where 9 is kill sig number or You can send commands `/sigint`, `/sigkill`, `/sigquit` and `/sigterm`.\n### /scripts\nCalls 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,\nor you can set the folder in the settings in the the `[Scripts]` section / `Directory`\n### /dir\nCalls the file Manager. You can set the default value in the configuration file\n### /delete\nWith the command (`/delete` `/fullpath/to/file`) You can delete file\n\n## Possible problems\n\nIn case of a similar error: `[Error] [HTTP Post JSON] Httpclient: Invalid Protocol`\nYou may be able to install SSL libraries on the system (for Linux):\n```sh\nsudo apt install libssl-dev\n```\n\n\n## HTTP proxy\nIf you want to add HTTP proxy support, then:\n+ add `laz_synapse.lpk` depending on the project\n+ add `tgsynapsehttpclientbroker` to the `uses` block\n+ set the proxy data in the `INI` file.\nNote: The native FPHTTPClient does not yet have full HTTPS proxy support. So in the case of synapse HTTP client, \nto 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.\n`// Port := IntToStr(ResolvePort(Port));`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-muhandis%2Fshellremotebot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fal-muhandis%2Fshellremotebot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fal-muhandis%2Fshellremotebot/lists"}