Can I turn on a pc with python? [closed]

0

I am working on a software with the python language, where I have to put an option where the user can turn on his PC from another one that has the software. I wanted to know if it can be done from python, or if it can be from another language and if so how can I connect it with python so it runs when the user presses the option.

    
asked by Kekty 07.11.2018 в 14:18
source

1 answer

3

The only way this would be possible is by setting Wake on LAN , but you have the limitation that the computer you want to turn on the other you need to be in the same local network or open ports (port forwarding) so you can receive packets from outside (which can be dangerous).

In most operating systems it is something native that can be configured (although it also depends on the support of the network card). Then, you can use the wakeonlan module (you can install it with pip using pip install wakeonlan ).

Using a MAC from the PC you want to turn on, you can do this to try to turn on the PC you want:

from wakeonlan import send_magic_packet

send_magic_packet('ff.ff.ff.ff.ff.ff')

You can also use IPs, you will find documentation here: link

Although there are other ways, they require additional or specific hardware. Wake on LAN is the most generic implementation out there.

    
answered by 07.11.2018 / 14:56
source