detect_distance.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:dr1det 作者: narbi 项目源码 文件源码
def show_alert(drone,dBm, mac, ssid, channel):
    global drone_img
    frequency = get_frequency(channel)
    distance = get_distance(dBm,frequency)
    distance=round(distance,2)

    text_file = open("logs.txt", "a")
    text_file.write("\n"+str(datetime.datetime.now())+"\t"+mac+"\t"+ssid+"\t"+drone+" DRONE\t~"+str(distance)+"m.")
    text_file.close()
    if mac not in open('ignore.list').read():
        ssid = ssid.split('_')
        Label(f2, text='\n\n ALERT \n ', fg="red",font = "Verdana 10 bold").pack()
        Label(f2, text='\n DRONE '+drone+' '+ssid[0]+' detected in approximately '+str(distance)+' meters \n\n{:%Y-%b-%d %H:%M:%S}'.format(datetime.datetime.now()),font = "Verdana 10 bold").pack()
        image = Image.open("images/"+drone+".png")
        image = image.resize((400, 400), Image.ANTIALIAS)
        drone_img = ImageTk.PhotoImage(image)
        Label(f2, image = drone_img).pack(side = "top", fill = "both", expand = "no")
        Button(f2, text ="Ignore", command = lambda: ignore_it(mac)).pack(padx=255, pady=20, side=LEFT)
        # Button(f2, text ="Deauth", command = lambda: deauth(channel)).pack(padx=5, pady=20, side=LEFT)
        play_sound()
        f2.after(9000, no_drone,f3)
    else:
        f2.after(0, no_drone,f3)
    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号