Created
July 7, 2017 13:50
-
-
Save Creased/a663b1b0f9f7d6a61dd4274c7c207537 to your computer and use it in GitHub Desktop.
WoL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*-coding:Utf-8 -* | |
# Magic Packet | |
import logging | |
logging.getLogger("scapy.runtime").setLevel(logging.ERROR) | |
from scapy.all import * | |
conf.iface='eth1' | |
conf.verb=0 | |
src_port=RandShort() | |
eth=Ether() | |
eth.dst='08:00:27:b8:4e:03' | |
eth.src='08:00:27:a0:5b:14' | |
ip=IP() | |
ip.src='192.168.1.2' | |
ip.dst='192.168.1.1' | |
udp=UDP() | |
udp.sport=RandShort() | |
udp.dport=9 | |
raw=Raw() | |
data='FF:FF:FF:FF:FF:FF' | |
data=''.join(data.split(':')).decode('hex') | |
data+=''.join(eth.dst.split(':')).decode('hex')*16 | |
data=data.upper() | |
raw.load=data | |
packet=eth/ip/udp/raw | |
reply=srp(packet) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment