{"id":24653758,"url":"https://github.com/wsapsan/tg_wg_bot","last_synced_at":"2026-04-13T10:31:54.086Z","repository":{"id":259375879,"uuid":"870578693","full_name":"wSapsaN/TG_WG_bot","owner":"wSapsaN","description":"This Telegram bot is for easy management of Wireguard on a remote server","archived":false,"fork":false,"pushed_at":"2025-01-24T02:26:46.000Z","size":66,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T00:42:30.655Z","etag":null,"topics":["api","bash","bash-script","c","linux","linux-app","linux-shell","python3","socket","sql","sqlite3","telegram-bot","wireguard"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wSapsaN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-10-10T09:46:36.000Z","updated_at":"2025-01-24T02:26:49.000Z","dependencies_parsed_at":"2024-10-24T23:53:40.600Z","dependency_job_id":"1d333e74-a9fb-49e3-a937-fb46620842f4","html_url":"https://github.com/wSapsaN/TG_WG_bot","commit_stats":null,"previous_names":["python-pars/tg_wg_bot","wsapsan/tg_wg_bot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wSapsaN%2FTG_WG_bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wSapsaN%2FTG_WG_bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wSapsaN%2FTG_WG_bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wSapsaN%2FTG_WG_bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wSapsaN","download_url":"https://codeload.github.com/wSapsaN/TG_WG_bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244717347,"owners_count":20498283,"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":["api","bash","bash-script","c","linux","linux-app","linux-shell","python3","socket","sql","sqlite3","telegram-bot","wireguard"],"created_at":"2025-01-25T21:13:58.548Z","updated_at":"2025-12-31T00:03:43.654Z","avatar_url":"https://github.com/wSapsaN.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TG_WG_bot\nThis Telegram bot is for easy management of Wireguard on a remote server\n\nThe bot only works on adding and removing clients.\nThis development can make its add-ons up to a commercial project.\n\nThe bot is a framework for something bigger.\n\n---\n# DataBase\n\nThe bot has a single database table that is connected using the ORM system.\n\nThe ORM will allow you to easily switch to another DB such as: MySQL or Postgresql\n\n# Server\n\nOn the server, your user must first have access to the rights to execute the following commands as the superuser:\n* wg\n* cat\n* systemctl\n* chown\n\nOn the VPN server itself, there will be a TCP server that accepts requests from the bot (client) to add a user and enter settings into the config files. The TCP server simply accepts a command that needs to be executed on the server itself, then the bash script runs.\n\nAfter TCP, the server returns the user's private certificate to send him the settings.\nIt is also assumed that it will work inside the VNP network and, if desired, you can connect SSL for greater security.\n\n**However, you may encounter a problem associated with the fact that when applying new settings, the VPN is restarted, which can, in theory, break the TCP connection. Therefore, you can use a separate VPN tunnel.**\n\nIt is also assumed that the bot accepts requests from Reverse Nginx.\n\n## How setup WireGuard?\n\nTopic:\n- [ruSetup](https://youtu.be/5Aql0V-ta8A?si=34Wcg4AgwSvE2fFX)\n- [enSetup](https://youtu.be/bVKNSf1p1d0?si=E6KMjJOb7xEkbKbu)\n\n# Launch the application\n\nThis describes how to run the bot locally.\nBut the code assumes that it will run on separate workstations.\n\n## Preparing the settings\n\nCreate a config.py file in the bot directory.\nThe following variables must be written in this file:\n```python\nTOKEN='YOUR BOT TOKEN'\n\n# this for webhook\nWEBHOOK_SSL_CERT=\"cert/YOURPUBLIC.pem\"\nWEBHOOK_SSL_PRIV=\"cert/YOURPRIVATE.key\"\n\n# setup for client\nIP_SERVER=\"IP YOUR SERVER OR LOCALHOST\"\nPORT=8580\n```\n\nCheck your bash script settings in advance:\n* server/wireguard_setup/server_addUS.sh \n* bot/bot_createUS.sh\n\n## Let's launch\n\nCompile and launch our server:\n```bash\ngcc server/server.c -o ./server/server\nsudo ./server/server\n```\n\nWe check that it works on the port specified in config.py.\n\nIf this is not the case, I recommend changing the port in this file.\nThis file is relevant only for python code.\n\nWhat's the problem?\n\nThe thing is that the requested port is not always free.\nAnd so the kernel issues another port for the application to run.\n\nNow we prepare the python:\n```bash\npython3 -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\n```\n\nRun:\n```bash\npython3 bot/app.py\n```\n\nAnd another very important point.\nIn the file bot/create_accsess.py on line 8 there is a variable that specifies the path to the file server/wireguard_setup/server_addUS.sh.\n\nIf necessary, edit this to suit your needs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwsapsan%2Ftg_wg_bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwsapsan%2Ftg_wg_bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwsapsan%2Ftg_wg_bot/lists"}