Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()