Created
May 1, 2019 03:28
-
-
Save LaurentDumont/9559ceabefb986756b75738d969afdba to your computer and use it in GitHub Desktop.
Simpy scapy DHCP Discover packet.
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
from scapy.layers.inet import IP, TCP, Ether, UDP | |
from scapy.layers.dhcp import BOOTP, DHCP | |
from scapy.all import send, sendp, RandMAC | |
#discover = Ether(dst='ff:ff:ff:ff:ff:ff', src='DE:EA:DE:C0:FF:EE', type=0x0800)/IP(src='0.0.0.0', dst='255.255.255.255' )/UDP(dport=67,sport=68)/BOOTP(op=1,chaddr='DE:EA:DE:C0:FF:EE')/DHCP(options=[('message-type','discover'), ('end')]) | |
#send(discover,iface="wlp3s0") | |
src_mac = str(RandMAC()) | |
ethernet = Ether(dst='ff:ff:ff:ff:ff:ff', src=src_mac, type=0x800) | |
ip = IP(src="0.0.0.0", dst="255.255.255.255") | |
udp = UDP(sport=68, dport=67) | |
bootps = BOOTP(chaddr=src_mac, ciaddr='0.0.0.0', flags=1) | |
dhcps = DHCP(options=[("message-type", "discover"), "end"]) | |
packet = ethernet / ip / udp / bootps / dhcps | |
sendp(packet, iface="wlp3s0", verbose=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment