How to use the wakeonlan.wol.WOL function in wakeonlan

To help you get started, we’ve selected a few wakeonlan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mpenning / wakeonlan / wakeonlan / wol.py View on Github external
return payload

    def raw(self):
        # Ethertype 0x0842 + WOL Payload
        return sendp([Ether(type=int('0842', 16), dst=self.ETH_BROADCAST) / Raw(load=self.wol_payload)], iface=self.intf)

    def udp4(self):
        # UDP port 9 + WOL Payload
        return sendp([Ether(dst=self.ETH_BROADCAST) / IP(dst='255.255.255.255') / UDP(sport=32767, dport=9)/ Raw(load=self.wol_payload)], iface=self.intf)

    def udp6(self):
        # UDP port 9 + WOL Payload
        return sendp([Ether() / IPv6(dst='ff02::1') / UDP(sport=32767, dport=9)/ Raw(load=self.wol_payload)], iface=self.intf)

if __name__=="__main__":
    wol = WOL("00:30:1b:bc:a7:d7", intf="eth0")
    wol.raw()
    wol.udp4()
    wol.udp6()

wakeonlan

A small python module for wake on lan.

MIT
Latest version published 12 months ago

Package Health Score

65 / 100
Full package analysis