WIP
This commit is contained in:
@@ -1,32 +1,41 @@
|
|||||||
# Woly
|
# Wolz
|
||||||
|
|
||||||
Broadcast Wake on Lan (WoL) magic packet to network devices in the local network.
|
- Broadcast Wake on Lan (WoL) magic packet to network devices in the local network.
|
||||||
|
- WoL only works if the target network interface supports it and is not in low power mode. Check [arch wiki](https://wiki.archlinux.org/title/Wake-on-LAN) on this subject to setup your device to wakup
|
||||||
|
|
||||||
## Magic Packet
|
## Usage
|
||||||
|
|
||||||
If MAC = aa:bb:cc:dd:ee:ff
|
Run `wolz` to view the help text.
|
||||||
|
|
||||||
UDP packet is constructed as follows, and sent to 255.255.255.255:9
|
## Troubleshooting
|
||||||
|
|
||||||
FF x 6; Mac Address x 16
|
This tool broadcasts the magic packet to the limited broadcast address 255.255.255.255 and port 9.
|
||||||
|
|
||||||
eg.
|
Install `tcpdump` to inspect the network traffic published to the limited broadcast address (255.255.255.255) and port 9
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$> # Update `enp42s0` to your interface name.
|
||||||
|
$> # To find out the interface to which the kernel
|
||||||
|
$> # routes the packets to, do
|
||||||
|
$> # ip route get 255.255.255.255
|
||||||
|
$> sudo tcpdump -i enp42s0 udp and host 255.255.255.255 and port 9 -n -XX
|
||||||
|
$>
|
||||||
|
$> # Sample output for mac 04:7c:16:6e:c0:2f
|
||||||
|
0x0000: 4500 0082 6153 4000 4011 ceb6 0a60 0002 E...aS@.@....`..
|
||||||
|
0x0010: ffff ffff 8bd0 0009 006e b739 ffff ffff .........n.9....
|
||||||
|
0x0020: ffff 047c 166e c02f 047c 166e c02f 047c ...|.n./.|.n./.|
|
||||||
|
0x0030: 166e c02f 047c 166e c02f 047c 166e c02f .n./.|.n./.|.n./
|
||||||
|
0x0040: 047c 166e c02f 047c 166e c02f 047c 166e .|.n./.|.n./.|.n
|
||||||
|
0x0050: c02f 047c 166e c02f 047c 166e c02f 047c ./.|.n./.|.n./.|
|
||||||
|
0x0060: 166e c02f 047c 166e c02f 047c 166e c02f .n./.|.n./.|.n./
|
||||||
|
0x0070: 047c 166e c02f 047c 166e c02f 047c 166e .|.n./.|.n./.|.n
|
||||||
|
0x0080: c02f ./
|
||||||
```
|
```
|
||||||
FF FF FF FF FF FF
|
|
||||||
AA BB CC DD EE FF
|
If you have VPN enabled, depending on the configuration the kernel might route it to the tunnel interface, and the tool will not work.
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
To debug TCP packets intended to wolz-daemon, run
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
```
|
||||||
AA BB CC DD EE FF
|
$> sudo tcpdump -i lo tcp and port 21367 -n -XX
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
|
||||||
AA BB CC DD EE FF
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -9,9 +9,17 @@ fn main() -> WResult<()> {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
match arg_1.as_str() {
|
||||||
|
"-h" | "--help" => {
|
||||||
|
print_usage();
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
_ => {
|
||||||
let wolz = Wolz::create()?;
|
let wolz = Wolz::create()?;
|
||||||
wolz.wake_up(&arg_1)?;
|
wolz.wake_up(&arg_1)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_usage() {
|
fn print_usage() {
|
||||||
@@ -22,17 +30,16 @@ fn print_usage() {
|
|||||||
Options:
|
Options:
|
||||||
ARG Either the mac address of the device to send the wol magic
|
ARG Either the mac address of the device to send the wol magic
|
||||||
packet to, or a nickname specified in woly.conf to lookup
|
packet to, or a nickname specified in woly.conf to lookup
|
||||||
the mac.
|
the mac. See details about config file below.
|
||||||
Eg: woly aa:bb:cc:dd:ee:ff
|
Eg: woly aa:bb:cc:dd:ee:ff
|
||||||
Eg: woly potato
|
Eg: woly potato
|
||||||
where potato is configured in the woly.conf file as
|
|
||||||
potato=aa:bb:cc:dd:ee:ff
|
|
||||||
|
|
||||||
Config file:
|
Config file:
|
||||||
Filename woly.conf
|
Filename woly.conf
|
||||||
Location $WOLY_CONFIG_DIR/woly.conf, then $XDG_CONFIG_DIR/woly.conf,
|
Location $WOLY_CONFIG_DIR/woly.conf, then $XDG_CONFIG_DIR/woly.conf,
|
||||||
then $HOME/woly.conf
|
then $HOME/woly.conf
|
||||||
Format one KEY=VALUE per line without spaces
|
Format KEY=VALUE
|
||||||
|
one per line without spaces, no comments allowed
|
||||||
Example potato=aa:bb:cc:dd:ee:ff
|
Example potato=aa:bb:cc:dd:ee:ff
|
||||||
idly=12:34:23:e2:3d:ff
|
idly=12:34:23:e2:3d:ff
|
||||||
"#
|
"#
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use std::{
|
|||||||
fn main() -> DResult<()> {
|
fn main() -> DResult<()> {
|
||||||
let address = "0.0.0.0:21367";
|
let address = "0.0.0.0:21367";
|
||||||
let listener = TcpListener::bind(address).map_err(DError::TcpBindError)?;
|
let listener = TcpListener::bind(address).map_err(DError::TcpBindError)?;
|
||||||
println!("Listening on {}", address);
|
println!("Listening for TCP packets at {}", address);
|
||||||
for mut stream in listener.incoming() {
|
for mut stream in listener.incoming() {
|
||||||
match &mut stream {
|
match &mut stream {
|
||||||
Ok(stream) => {
|
Ok(stream) => {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ impl Config {
|
|||||||
&nick.name
|
&nick.name
|
||||||
)))
|
)))
|
||||||
.map(|mac| mac.clone()),
|
.map(|mac| mac.clone()),
|
||||||
|
Device::IpV4(ip_v4) => todo!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,4 @@ impl Wolz {
|
|||||||
println!("Magic packet sent to 255.255.255.255:9 for Mac {:}", mac);
|
println!("Magic packet sent to 255.255.255.255:9 for Mac {:}", mac);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn shutdown(&self, ip_or_nick: &str) -> WResult<()> {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user