【问题标题】:Scapy will listen on wlan0 but not wlan1 that is set to monitor modeScapy 将监听 wlan0 但不会监听设置为监控模式的 wlan1
【发布时间】:2021-07-18 15:04:35
【问题描述】:

我有两个无线接口,wlan0wlan1。我通过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


    【解决方案1】:

    我很笨。没有网络流量,因此没有回调功能。上面的代码按预期工作,如果其他人遇到此问题,请考虑通过该接口发送数据包,然后查看是否发生任何事情..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-10
      • 2015-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多