2021-06-16 Python Scapy WARNING: Mac address to reach destination not found. Using broadcast.

在使用Scapy模拟数据包进行主机探测等行为的时候,发送IP数据包的时候,如果本地不存在ARP信息,会在程序运行界面提示Waring信息,影响查看扫描结果
运行程序时提示Warning:

WARNING: Mac address to reach destination not found. Using broadcast.
192.168.37.27--->Host is up
WARNING: Mac address to reach destination not found. Using broadcast.
WARNING: Mac address to reach destination not found. Using broadcast.
192.168.37.31--->Host is up
WARNING: Mac address to reach destination not found. Using broadcast.
WARNING: Mac address to reach destination not found. Using broadcast.
WARNING: Mac address to reach destination not found. Using broadcast.
WARNING: Mac address to reach destination not found. Using broadcast.
WARNING: Mac address to reach destination not found. Using broadcast.
192.168.37.37--->Host is up
WARNING: Mac address to reach destination not found. Using broadcast.

可以通过logging模块控制提示报错等级,只提示Error及以上级别的报错信息:

import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)

添加代码后的运行效果:

192.168.37.27--->Host is up
192.168.37.31--->Host is up
192.168.37.37--->Host is up
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。