Is it possible to implement the wake-on-lan magic packet in bash? I'm using a old, customized BusyBox and don't have
ether-wake. Is it possible to replace it with some other shell command, like:
You need something that's capable of sending an Ethernet packet that will be seen by the device you want to wake up.
If you have a sufficiently “bloaty” netcat (BusyBox can have one of two
Another BusyBox utility that you could abuse into sending that packet is
If the MAC contains a null byte, you won't be able to craft the packet so easily. Pick a byte that's not
If you really have bash (which is extremely unusual on devices with BusyBox — are you sure you really have bash, and not another shell provided by BusyBox?), it can send UDP packets by redirecting to
I think you can use
I have busybox with
I have an ssh server running on old HTC dream. My version of busybox also didn't include ether-wake and I'm not skilled enough to compile my own busybox. Fortunately I managed to wake up my PC using:
Notice that the broadcast ip is different in my network.
I crafted the file (mac2.txt) containing the magic packet on my PC and pushed it to the server via SFTP. Because my mac has null byte I have to use tr to substitute all x42 bytes with 00. It worked like charm.