我尝试在scapy中实现DHCP服务器 . 我使用iface =“Local Area Connection 3”为udp sport 67和dport 68进行DHCP发现,然后使用sendp命令发送DHCP Offer . 我无法在Wireshark中看到我的数据包,而且DHCP Clinet也没有收到,它还会发送DHCP发现 .
在wireshark上,我只看到来自客户端的DHCP发现 .
这是代码:
def sniff_DHCP_discovers():
sniff(filter='port 67 or port 68', prn=startThread, iface="Local Area Connection 3")
def startThread(pkt):
thread = threading.Thread(target=process_DHCP_discover, args=(pkt,))
thread.deamon = True
thread.start()
def process_DHCP_discover(pkt):
print 'Process ', ls(pkt)
if DHCP in pkt:
if pkt[DHCP].options[0][1]==1:
print '\tDetected DHCP Discover from client: ', pkt[Ether].src
#Create DHCP Offer
Ethernet = Ether(src="00:50:B6:0E:FE:36", dst=pkt[Ether].src)