mirror of
https://github.com/seriousm4x/UpSnap.git
synced 2026-04-05 00:43:45 -04:00
13 lines
301 B
Python
13 lines
301 B
Python
import ipaddress
|
|
import wakeonlan
|
|
import subprocess
|
|
|
|
|
|
def wake(mac, ip, netmask):
|
|
subnet = ipaddress.ip_network(
|
|
f"{ip}/{netmask}", strict=False).broadcast_address
|
|
wakeonlan.send_magic_packet(mac, ip_address=str(subnet))
|
|
|
|
def shutdown(command):
|
|
subprocess.run(command, shell=True)
|