docs: Update README for new subcommand structure

- Document wake and sleep subcommands
- Update usage examples to reflect new command structure
- Clarify default ports for each command (wake: 9, sleep: 9999)
- Improve documentation formatting and organization
This commit is contained in:
Björn Benouarets
2025-11-12 12:25:43 +01:00
parent c91b13a08f
commit 784ebf24e4

View File

@@ -2,34 +2,61 @@
## Description ## Description
This is a CLI tool that sends a Wake on LAN (WOL) packet to a target device. It supports authentication using a username and password. This is a CLI tool that sends Wake on LAN (WOL) and Sleep packets to a target device. It supports authentication using a username and password.
## Usage ## Usage
The tool now uses subcommands for different operations:
### Wake Command (sends WOL packet on port 9)
```bash ```bash
python wol.py -m AA:BB:CC:DD:EE:FF -u admin -p secret python index.py wake -m AA:BB:CC:DD:EE:FF -u admin -p secret
``` ```
### Sleep Command (sends sleep packet on port 9999)
```bash
python index.py sleep -m AA:BB:CC:DD:EE:FF -u admin -p secret
```
## Commands
### wake
Send a Wake-on-LAN packet to wake up a target device (default port: 9)
### sleep
Send a Sleep packet to put a target device to sleep (default port: 9999)
## Arguments ## Arguments
- `-m, --mac`: MAC address of the target device (format: XX:XX:XX:XX:XX:XX or XX-XX-XX-XX-XX-XX) Both commands share the same arguments:
- `-u, --username`: Username for authentication
- `-p, --password`: Password for authentication - `-m, --mac`: MAC address of the target device (format: XX:XX:XX:XX:XX:XX or XX-XX-XX-XX-XX-XX) **[required]**
- `-u, --username`: Username for authentication **[required]**
- `-p, --password`: Password for authentication **[required]**
- `-H, --host`: Target host address (default: 255.255.255.255 for broadcast) - `-H, --host`: Target host address (default: 255.255.255.255 for broadcast)
- `-P, --port`: Target UDP port (default: 9999) - `-P, --port`: Target UDP port (default: 9 for wake, 9999 for sleep)
## Example ## Examples
Wake up a device:
```bash ```bash
python wol.py -m AA:BB:CC:DD:EE:FF -u admin -p secret -H 192.168.1.100 -P 9999 python index.py wake -m AA:BB:CC:DD:EE:FF -u admin -p secret -H 192.168.1.100
```
Put a device to sleep:
```bash
python index.py sleep -m AA:BB:CC:DD:EE:FF -u admin -p secret -H 192.168.1.100 -P 9999
``` ```
## Notes ## Notes
- The tool sends a Wake on LAN packet to the target device using the UDP protocol. - The tool sends packets using the UDP protocol.
- The tool supports authentication using a username and password. - The tool supports authentication using a username and password.
- The tool supports broadcasting to the target host address. - The tool supports broadcasting to the target host address.
- The tool supports specifying the target UDP port. - The tool supports specifying the target UDP port.
- Default ports differ between commands: wake uses port 9, sleep uses port 9999.
## License ## License