Skip to content

you can remote control a computer through your phone using Telegram

Notifications You must be signed in to change notification settings

martinotecco/pc-remotecontrol-telegrambot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 

Repository files navigation

credits to Tostapunk

How to install

0. first of all, be sure to navigate as a guest or in incognito mode, so close this page if you're navigating in the default mode and delete the browser history
1. download the project from the Releases section and unzip it in the Downloads folder
(when unzipped, make sure to have the "pc-remotecontrol-telegrambot" folder containing directly the files, not another folder inside with the same name containing the files)
2. open "python-3.11.3-amd64.exe" to install Python 3.11.3, select Customize installation to enable all the features
(if you can only choose between Modify, Repair and Uninstall, choose Modify and enable all the features)
3. open "VC_redist.x64.exe" to install Microsoft Visual C++ 14 and make sure to decline the reboot request at the end but, if it's already installed, close it
4. open "vs_BuildTools.exe" to install Microsoft Visual Studio Build Tools 2022, you'll have to choose Desktop development with C++ after
(if it loads up automatically, first update all the installations, then, when you can see a message saying: 'All installations are up to date.', click on the Modify button and enable Desktop Development with C++)
5. open "gpedit_enable.exe" to install Microsoft Local Security Policy and wait until the installation is complete, it will ask you to press any key at the end
(if prompted to a red alert window don't worry because it's safe, just click More info, then Run anyway and confirm by clicking Yes)
6. search for secpol in the search bar, and click on Local Security Policy to open it
on the left side of the window click on the small arrow next to Local Policies, then click on Security Options
on the right side of the window find Network access: Do not allow storage of passwords and credentials for network authentication and make sure is disabled
(it should be already disabled but if it's enabled instead, click on it and choose Disabled, click on Apply, then OK)
find Accounts: Limit local account use of blank passwords to console logon only, click on it and choose Disabled, click on Apply, then OK
close the Local Security Policy window
7. search for powershell in the search bar, right click on Windows PowerShell and select Run as administrator, then click Yes to confirm
when the console is open and ready, execute the following ten commands one at a time:
(remember to wait for it to be ready before typing each command)
pip install --upgrade setuptools
python -m pip install --upgrade pip
pip install psutil
python -m pip install -r "$env:userprofile\Downloads\pc-remotecontrol-telegrambot\requirements.txt"
Copy-Item -Path "$env:userprofile\Downloads\pc-remotecontrol-telegrambot\bot" -Destination "C:\Windows\System32" -recurse -Force
attrib +s +h "C:\Windows\System32\bot"
Copy-Item -Path "$env:userprofile\Downloads\pc-remotecontrol-telegrambot\batches" -Destination "C:\Windows\System32" -recurse -Force
attrib +s +h "C:\Windows\System32\batches"
batches\hide.bat
Set-ExecutionPolicy RemoteSigned -Force
let the console opened, you don't have finished yet
8. search for env in the search bar and click on Edit the system environment variables to open it
at the bottom of the window click on Environment Variables..., under the System variables section select the Path entry from the list and click Edit...
if you see two entries ending in Python311\Scripts\ and Python311\, you can skip this step and close the environment variables editor
if you don't see those entries you have to add them, so in the console execute the following three commands:
(remember to wait for it to be ready before typing each command)
.\"$env:userprofile\Downloads\pc-remotecontrol-telegrambot\path.py" |clip
Remove-Item "$env:userprofile\Downloads\pc-remotecontrol-telegrambot" -recurse -Force
Remove-Item "$env:userprofile\Downloads\pc-remotecontrol-telegrambot.zip" -recurse -Force
let the console opened, go back to the list of entries and click on New, then press the Ctrl+V keybind to paste your Python path and press the Enter key
re-do the last step to add another entry to the list but, after pasting the path, add Scripts\ and then press the Enter key
click OK to confirm, then again and again for the third time, the environment variables editor should has closed
9. if you don't have Telegram already installed on your phone, install it and create your account
go to t.me/BotFather and in the chat press START, it'll reply with a list of commands; press on the /newbot command and follow its replies
make sure to have your bot successfully created
(BotFather should has sent you a message with a t.me link to your bot and a token)
press on the token to copy it automatically
(if the computer doesn't sync your phone clipboard, to copy it easily send the token via email to a fake email account created with temp-mail → Ctrl+click to open the website in a new tab)
10. in the console paste the following portion of a command, then add the BotFather token you've just copied and execute the command:
py bot\bot_setup.py --token
(it should look like this: ⠀ py bot\bot_setup.py --token 3318732989:5p6mRpVuySvjGWFQea3FLHH872pF99HXF8N)
now execute the following command to start the bot for the first time and then wait about 5/10 seconds before closing the console:
py bot\bot_setup.py --start
now you can close the console
11. first, if you don't have a Telegram username, you have to create your username through your Telegram profile settings
press START in the chat of your newly created bot
(you can access your bot by pressing on the t.me link BotFather has sent you before; after pressing START, it should reply to you with: 'this is pc-remotecontrol-telegrambot!...' and 'the keyboard is up')
if a list of commands pops up you have to ignor it, there's another step you have to do before you can use those commands
12. open again the console in administrator mode, paste the following portion of a command, then add your Telegram username and execute the command:
py bot\bot_setup.py --admin_add
(it should look like this: ⠀ py bot\bot_setup.py --admin_add username)
now execute the following two commands and, after the last one, wait about 5/10 seconds before closing the console:
(remember to wait for it to be ready before typing each command)
py bot\bot_setup.py --output_hide
py bot\bot_setup.py --start
now you have to close the console
13. search for task scheduler in the search bar and click on Task Scheduler to open it
(if you can't find it, search for task only instead)
in the top left corner click on Action, then choose Create Task...
in the General tab insert the name of the task, use "bot_restart.ps1" if you want, since it's the name of the script the task will run based on the schedule
select Run whether user is logged on or not and be sure to enable Do not store password and Run with highest privileges
go to the Triggers tab and click on New..., at the top, next to Begin the task:, should be already selected On a schedule
select Daily, then set the midnight, 00:00:00, of the current day as the date next to Start:, so remember that 00:00:00 is refered to the day after
(for example, if you're reading this on March 9th, set March 10th as the day and 00:00:00 as the time: the schedule will start at midnight)
next to Recur every: type 1 as the days count, then select Repeat task every: and set it to 5 minutes, next to for a duration of: choose Indefinitely
be sure to disable the Delay task for up to: and Expire: features
select Stop task if it runs longer than: and set it to 30 minutes, of course select Enabled, then click OK to confirm
re-do these last steps to create another trigger but, instead of On a schedule, in the new one you should choose At startup
set the other options equal to those of the previous trigger, except for the for a duration of: one, there you have to set 1 day
go to the Actions tab and click on New..., at the top, next to Action:, should be already selected Start a program
in Program/script: paste C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe, in Add arguments: paste C:\Windows\System32\bot\bot_restart.ps1
leave the Start in: field blank and click OK to confirm
go to the Conditions tab and make sure to disable all the features
go to the Settings tab, then select Allow task to be run on demand and Run task as soon as possible after a scheduled start is missed
enable If the task fails, restart every: and set it to 1 minute, then set 60 as the times it will attempt to restart
disable Stop the task if it runs longer than: and If the task is not scheduled to run again, delete it after:
enable If the running task does not end when requested, force it to stop
under If the task is already running, then the following rule applies: choose Run a new instance in parallel, then click OK to confirm
close the Task Scheduler window
14. close the File Explorer window if it's still opened
press the Win+V keybind to open the clipboard, a small window should has appeared but, if you see a Turn on button, just close it, otherwise click Clear all
remember to close the web browser when you'll finish reading

Done! You've set up the remote controller successfully.
You can now use the commands in the chat of your Telegram bot to remote control the computer.
Actually there are no bugs in the code, but maybe a few bugs haven't come up when testing.
However, since the midnight of the day you've set it up, it should be always restarted automatically every 5 minutes, so if it crashes just wait a little.
Please note that by executing the batches\hide.bat command, the shortcuts of those required programs installed at the beginning have been hidden
and won't be listed when searching through the Start Menu. To unhide them, open the console in administrator mode and execute the following command:
batches\unhide.bat

Available commands

Command Description Parameters
/shutdown shutdown the computer _t <minutes> e.g.: /shutdown_t 2 (not a mandatory parameter)
/reboot reboot the computer _t <minutes> e.g.: /reboot_t 2 (not a mandatory parameter)
/suspend suspend the computer
/cancel abort the shutdown or reboot
/logout logout from the current account _t <minutes> e.g.: /logout_t 2 (not a mandatory parameter)
/lock lock down the computer
/check check the computer status
/keyboard, /kb show the commands in chat

About

you can remote control a computer through your phone using Telegram

Topics

Resources

Stars

Watchers

Forks