【发布时间】:2021-07-18 15:04:35
【问题描述】:
我有两个无线接口,wlan0 和 wlan1。我通过wlan0 连接到家庭网络上的树莓派,我使用wlan1 作为接入点来收集探测请求。
我将wlan1 设置为监控模式(iwconfig 显示模式:更改时为 Master)
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 上工作?
【问题讨论】:
标签: python network-programming scapy