Python scapy 信标框架

Python scapy Beacon Frames

我正在尝试构建一个扫描信标帧的 scapy 程序。每个路由器都应以 X 毫秒的间隔向空中发送信标帧,以便可能的主机知道路由器 (AP) 处于活动状态。

我什么也没得到,到目前为止我能得到的唯一一种 Dot11 帧是概率请求,很少还有一些数据或控制帧。我在 运行 脚本之前将我的无线网卡设置为监控模式,它也支持它。我不知道我可能做错了什么......这是代码:

from scapy.all import * 

global list_prob
list_prob = []
def search_prob(packet1):
    if (packet1.haslayer(Dot11)) and (packet1[Dot11].type == 0) and\
    (packet1[Dot11].subtype == 8) : #type 4 == ProbRequest
        if packet1[Dot11].addr2 not in list_prob:
            if packet1[Dot11].info not in list_prob:
                print('[>]AP',packet1[Dot11].addr2,'SSID',packet1[Dot11].info)
                list_prob.append(packet1[Dot11].addr2)
                list_prob.append(packet1[Dot11].info)

sniff(iface='wlan0mon',prn=search_prob)

我也尝试过使用 Dot11Beacon 而不是子类型 8,但没有任何改变。我正在 Linux 上使用 python3.5 进行编程。 有任何想法吗 ?

使用python不断改变网络接口频道的代码:

from threading import Thread
import subprocess,shlex,time
import threading
locky = threading.Lock()

def Change_Freq_channel(channel_c):
    print('Channel:',str(channel_c))
    command = 'iwconfig wlan1mon channel '+str(channel_c)
    command = shlex.split(command)
    subprocess.Popen(command,shell=False) # To prevent shell injection attacks ! 

while True:
    for channel_c in range(1,15):
        t = Thread(target=Change_Freq_channel,args=(channel_c,))
        t.daemon = True
        locky.acquire()
        t.start()
        time.sleep(0.1)
        locky.release()