Detecting Deauthentication Attacks with Python

I was looking for a way to use python the detect wifi deauthing and I could not find a good way to do this so here is the script that I made.

# WIFI needs to be in monitor mode
# find wifi name [ip address]
# sudo airmon-ng check kill
# sudo airmon-ng start wlx00a1b0b00de1
# verify using [ip address]
# sudo airodump-ng wlan0mon

# install needed
# sudo apt install python3 -y
# sudo apt install python3-pip -y
# sudo pip3 install scapy
# sudo apt install aircrack-ng -y

from scapy.all import *
import datetime

# looking for Dot11 AKA Deauthentication Packet
def process_packet(packet):
    if packet.haslayer(Dot11Deauth):
        print(' [ ' +  str( ' ] '+  ' Deauthentication Attack Detected Against Mac Address: ' +   str(packet.addr2).swapcase())
#Running scanner for packet
sniff(iface="wlan0mon", prn=process_packet, store=False, count=0)

where to find the other script used

Leave a Reply