且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 python scapy 发送 DHCP Discover

更新时间:2021-08-28 15:57:01

解决了!我遇到了同样的问题,

Solved ! I had the same problem,

我认为问题出在 srp() 函数上,它无法在端口 68 上接收数据包,但我创建了一个新函数,其中包含一个新线程,用于嗅探 BOOTP 消息并显示数据包字段.你可以模拟它:

sniff(iface=myiface, filter="port 68 and port 67")

sniff(iface=myiface, filter="port 68 and port 67")

然后使用 srp() 或 sendp() func 发送数据包 :)

then send the packet using srp() or sendp() func :)

注意:我使用了多线程机制,因为如果网络上有恶意 DHCP 服务器,我的程序会发送消息和嗅探

NOTE: I have used multithreading mechanism cause my program sends messages and sniffs if a rogue DHCP Server is on the network