在使用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