Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from scapy.all import *
- conf.checkIPaddr=False
- # configuration
- localiface = 'eno1'
- requestMAC = 'ac:16:2d:ab:14:98'
- myhostname = '\0'
- localmac = get_if_hwaddr(localiface)
- localmacraw = requestMAC.replace(':','').decode('hex')
- # craft DHCP DISCOVER
- dhcp_discover = Ether(src=localmac, dst='ff:ff:ff:ff:ff:ff')/IP(src='0.0.0.0', dst='255.255.255.255')/UDP(dport=67, sport=68)/BOOTP(chaddr=localmacraw,xid=RandInt())/DHCP(options=[('message-type', 'discover'),('hostname', myhostname), 'end'])
- print dhcp_discover.display()
- # send discover, wait for reply
- dhcp_offer = srp1(dhcp_discover,iface=localiface)
- print dhcp_offer.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement