VirtualBox内部网络中Scapy ARP请求无结果?如何解决?
解决Scapy在VirtualBox内部网络无ARP扫描结果的问题
以下是针对性的解决步骤:
指定正确的内部网络接口
Scapy默认可能未绑定到VirtualBox内部网络对应的网卡,导致无法收发数据包。先通过命令确认接口名称:- Linux:执行
ip addr,找到对应192.168.3.x网段的接口(通常是enp0s8或类似名称) - Windows:执行
ipconfig,找到VirtualBox内部网络对应的适配器名称
修改代码,添加
iface参数指定接口:answered, unanswered = srp(Ether("ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.3.0/24"), iface="你的内部网络接口名", timeout=3) print(answered.summary())- Linux:执行
以特权身份运行代码
发送原始网络数据包需要管理员/root权限,netdiscover本身也是以root身份运行的,因此必须:- Linux:用
sudo python3 你的脚本.py执行 - Windows:在管理员权限的命令提示符中运行Python脚本
- Linux:用
启用调试模式排查问题
添加verbose=2参数,查看数据包发送和接收的详细过程,确认是否有数据包发出或响应被拦截:answered, unanswered = srp(Ether("ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.3.0/24"), iface="你的接口名", timeout=3, verbose=2)检查虚拟机防火墙设置
部分虚拟机的防火墙规则可能拦截ARP响应,临时关闭防火墙测试:- Linux:执行
sudo systemctl stop firewalld或sudo iptables -F - Windows:在防火墙设置中临时关闭公共/专用网络防火墙
- Linux:执行
内容的提问来源于stack exchange,提问作者Vergar
相关产品推荐
相关产品推荐

