[英]Scapy will listen on wlan0 but not wlan1 that is set to monitor mode
我有两个无线接口, wlan0
和wlan1
。 我通过wlan0
连接到家庭网络上的树莓派,我使用wlan1
作为接入点来收集探测请求。
我将wlan1
设置为监控模式(iwconfig 显示模式:更改时为主)
subprocess.run(f'ifconfig wlan{interface_id} down', shell=True)
subprocess.run(f'ifconfig wlan{interface_id} mode Monitor', shell=True)
subprocess.run(f'ifconfig wlan{interface_id} up', shell=True)
运行此代码以检查卡是否处于监控(主)模式时,它返回 true:
def is_card_in_mon_mode(interface_id):
output = subprocess.Popen(['iwconfig', f'wlan{interface_id}'], stdout=subprocess.PIPE)
for param in output.stdout:
if b'Master' in param:
return True
然后,执行: sniff(iface="wlan1", prn=handle_packet)
不会访问 handle_packet 方法。
使用sniff(iface="wlan0", prn=handle_packet)
确实访问了handle_packet
方法,是否有任何理由它可以在 wlan0 上工作而不是在 wlan1 上工作?
我傻了没有网络流量,因此没有回调功能。 上面的代码按预期工作,如果其他人遇到此问题,请考虑通过该接口发送数据包,然后查看是否发生任何事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.