- Saved searches
- Use saved searches to filter your results more quickly
- License
- LouisJin/WakeOnLan-Python
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- wakeonlan 3.0.0
- Installation
- Usage
- As a python module
- As a standalone script
- Dependencies
- wakeonlan¶
- Installation¶
- Usage¶
- As a python module¶
- As a standalone script¶
- Dependencies¶
- Saved searches
- Use saved searches to filter your results more quickly
- License
- Suzhou65/Python-Wake-on-LAN
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Only input the mac address which device you want to wakeup, It will easy to wakeup on lan immediately.
License
LouisJin/WakeOnLan-Python
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
wol.py tiny python3 script input the mac address only wakeup most windows or linux devices on the lan
The device which will be wakeup requires the following conditions
- Control Panel -> Network Connections -> Network Card -> Properties -> Configure -> Advance Wake on magic packet : Enabled
- Control Panel -> Network Connections -> Network Card -> Properties -> Configure -> Power Management uncheck «Allow the computer to turn off this device to save power» or check above but also check «Allow this device to wake the computer»
- Control Panel -> Power Options -> Choose what the power buttons do -> Change settings that are currently unavailable uncheck «Turn on fast start-up»
- Enter BIOS advance settings,each motherboard has different fields,if you found one of «wake on lan»,»Resume on lan»,»Power on PME»,»Power on by PCI-E device» or «Power on by Onboard LAN», make it enable.
Usage: wol.py [-m mac_address] Options: -?,-h : this help -v : show version and exit -m mac_address : where the magic packet will send to. (eg. 2C-4D-54-CF-9E-50 or 2C:4D:54:CF:9E:50)
About
Only input the mac address which device you want to wakeup, It will easy to wakeup on lan immediately.
wakeonlan 3.0.0
For more information on the wake on lan protocol please take a look at Wikipedia.
Installation
Usage
To wake up a computer using wake on lan it must first be enabled in the BIOS settings. Please note the computer you are trying to power on does not have an ip address, but it does have a mac address. The package needs to be sent as a broadcast package.
As a python module
>>> from wakeonlan import send_magic_packet
Wake up a single computer by its mac address
>>> send_magic_packet('ff.ff.ff.ff.ff.ff')
Wake up multiple computers by their mac addresses.
>>> send_magic_packet('ff.ff.ff.ff.ff.ff', . '00-00-00-00-00-00', . 'FFFFFFFFFFFF')
An external host may be specified. Do note that port forwarding on that host is required. The default ip address is 255.255.255.255 and the default port is 9.
>>> send_magic_packet('ff.ff.ff.ff.ff.ff', . ip_address='example.com', . port=1337)
A network adapter may be specified. The magic packet will be routed through this interface.
>>> send_magic_packet('ff.ff.ff.ff.ff.ff', . interface='192.168.0.2')
As a standalone script
usage: wakeonlan [-h] [-i ip] [-p port] [-n interface] mac address [mac address . ] Wake one or more computers using the wake on lan protocol. positional arguments: mac address The mac addresses of the computers you are trying to wake. optional arguments: -h, --help show this help message and exit -i ip The ip address of the host to send the magic packet to. (default 255.255.255.255) -p port The port of the host to send the magic packet to. (default 9) -n interface The ip address of the network adapter to route the magic packet through. (optional)
Dependencies
wakeonlan¶
For more information on the wake on lan protocol please take a look at Wikipedia.
Installation¶
Usage¶
To wake up a computer using wake on lan it must first be enabled in the BIOS settings. Please note the computer you are trying to power on does not have an ip address, but it does have a mac address. The package needs to be sent as a broadcast package.
As a python module¶
>>> from wakeonlan import send_magic_packet
Wake up a single computer by its mac address
>>> send_magic_packet('ff.ff.ff.ff.ff.ff')
Wake up multiple computers by their mac addresses.
>>> send_magic_packet('ff.ff.ff.ff.ff.ff', . '00-00-00-00-00-00', . 'FFFFFFFFFFFF')
An external host may be specified. Do note that port forwarding on that host is required. The default ip address is 255.255.255.255 and the default port is 9.
>>> send_magic_packet('ff.ff.ff.ff.ff.ff', . ip_address='example.com', . port=1337)
A network adapter may be specified. The magic packet will be routed through this interface.
>>> send_magic_packet('ff.ff.ff.ff.ff.ff', . interface='192.168.0.2')
As a standalone script¶
usage: wakeonlan [-h] [-i ip] [-p port] [-n interface] mac address [mac address . ] Wake one or more computers using the wake on lan protocol. positional arguments: mac address The mac addresses of the computers you are trying to wake. optional arguments: -h, --help show this help message and exit -i ip The ip address of the host to send the magic packet to. (default 255.255.255.255) -p port The port of the host to send the magic packet to. (default 9) -n interface The ip address of the network adapter to route the magic packet through. (optional)
Dependencies¶
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Using Python sending Magic Packet, or forwarding it.
License
Suzhou65/Python-Wake-on-LAN
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Using Python sending Magic Packet, or forwarding it.
- Python Running Wake-on-LAN
- Contents
- Usage
- Port Forwarding
- Root Privileges
- Terminal multiplexer
- Port Forwarding Status Monitor
- Wake-on-LAN CLI
- Wake-on-LAN GUI
- Wake-on-LAN Forwarding
- Wake-on-LAN Forwarding Nolog
- Wake-on-LAN Status
- Python version
- Python module
- Apache HTTP Server
You need to setting router port forwarding function, set Port 9 | UDP forward to the device you running Magic Packet forwarding program. Port 9 is the defult port number sending and receiving Magic Packet, but sometimes you need to switch it due to some limited.
TCP/UDP ports below 1024 are privileged, so bind socket below 1024 need root privileges. If you didn’t using sudo command, you will see the alert message likes below.
2020-08-13 17:21:57 | Ports below 1024 are privileged, require root privileges !
If you dont’t have root privileges, or cannot using sudo command, please switch the receive_protocol port over 1024. For example:
try: # Get Host receive_host = wakeonlan.host_info() # Listening socket config receive_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0) receive_protocol = 9 receive_socket.bind((receive_host, receive_protocol)) # If ports below 1024 require root privileges except PermissionError: print(f"time_start> | Ports below 1024 are privileged, require root privileges !") sys.exit(0)
GNU Screen is recommended, it can let you running Magic Packet forwarding program at background.
Port Forwarding Status Monitor
Apache HTTP Server, and php 7.3 is necessary, after install, you need to enable php function at Apache.
sudo apt install php sudo apt install libapache2-mod-php7.3 sudo a2enmod php7.3 sudo systemctl restart apache2
wakeonlan_status.php is a simple monitoring web page, it didn’t have any secure protection. If you value you MAC address as personal privacy, please running it on LAN network environments only, or added some protection function, see the example GitHub Gist.
Command-line interface version.
pi@raspberrypi:~/python_script $ python wakeonlan_script_cli.py
2020-08-13 17:22:52 | Python wakeonlan Enter MAC Address: 2A-61-C8-B1-5E-46 Enter IP Address ( Default is Broadcast ) : 192.168.0.5
It will sending magic packet, and printing:
2020-08-13 17:22:57 | Magic Packet Sending .
If set as broadcasting, it will printing:
2020-08-13 17:23:05 | Magic Packet Broadcasting .
Graphical User Interface version.
pi@raspberrypi:~/python_script $ python wakeonlan_script_gui.py
It will pop up a graphical user interface windows.
Forwarding Magic Packet and broadcasting.
pi@raspberrypi:~/python_script $ python wakeonlan_forwarding.py
If initialize successfully, it will print this:
2020-08-13 17:22:52 | Initialize complete. Record file create 2020-08-13 17:22:52 | Now monitoring 10.0.1.2, pressing CTRL+C to exit
Now it will monitoring the network, and forwarding Magic Packet by broadcasting, it also record the receiving data.
If you want to terminate the Program, pressing CTRL+C, it will print this:
^C 2020-08-13 17:23:28 | Thank you for using the Wakeup forwarding. GoodBye .
The receiving Magic Packet will be translate into MAC address, recording as CSV file with receiving time. The file also recording program start / terminate time, and error occurred time when receiving incomplete packet.
stamp,address 2020-11-10 12:08:39,70-a7-af-3d-17-c5 2020-12-24 14:29:08,5b-0c-f1-c1-4c-b0 2020-12-25 15:36:46,Omit 2020-12-28 11:06:24,70-a7-af-3d-17-c5 2021-01-09 21:27:29,Omit 2021-01-11 14:40:34,5b-0c-f1-c1-4c-b0 2021-01-18 19:45:58,Omit Reveille
You can also setting Ignore wakeup all configuration, this configuration is inside the forwarding script.
# Ignore wakeup all ignroe_reveille = True
Wake-on-LAN Forwarding Nolog
Forwarding Magic Packet and broadcasting.
pi@raspberrypi:~/python_script $ python wakeonlan_forwarding_nolog.py
Same function as previous python script, but this one won’t generated any record file, it won’t logging.
You can also setting Ignore wakeup all configuration, this configuration is inside the forwarding script.
# Ignore wakeup all ignroe_reveille = True
View Magic Packet Magic forwarding status on web browser.
// File path as you python script location if ($file = fopen("/python_script_location/wakeup_record.csv","r"))< while (($line = fgetcsv($file)) !== false)< echo " "; foreach ($line as $cell) echo " " . htmlspecialchars($cell) . " ";> echo " \n";> fclose($file);
File path depend on you python script location.