Advertisement
opexxx

dhcpoffer.py

Feb 2nd, 2014
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. from scapy.all import *
  2. conf.checkIPaddr = False
  3. fam,hw = get_if_raw_hwaddr(conf.iface)
  4. def dhcp_discover(resp):
  5.     print "Source: " +resp[Ether].src
  6.     print "Dest: " +resp[Ether].dst
  7.     for opt in resp[DHCP].options:
  8.         if opt == 'end':
  9.             break
  10.         elif opt == 'pad':
  11.             break
  12.         print opt
  13. sendp(Ether(dst="ff:ff:ff:ff:ff:ff")/IP(src="0.0.0.0",dst="255.255.255.255")/UDP(sport=68,dport=67)/BOOTP(chaddr=hw)/DHCP(options=[("message-type","discover")]),count=3)
  14. sniff(filter="udp and (port 67 or 68)", prn=dhcp_discover, store=1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement