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
评论列表
文章目录