I have written a sniffer using scapy. It tries to get the probe request packets. My program runs fine for about 8-10 mins, then, it suddenly stops sniffing the probe requests after throwing socket closed warning. I didn't find any information regarding this on google. Why am i getting this error?
ERROR:
WARNING: Socket <scapy.arch.linux.L2ListenSocket object at 0x15c4140> failed with ''. It was closed.
Steps:
- Enter monitor mode:
ifconfig wlan0 down
iwconfig wlan0 mode monitor
ifconfig wlan0 up
- Run airodump-ng in background:
airodump-ng wlan0 &
- Run my script
./my_script.py
Output:
[ 329.993891] device wlan0 entered promiscuous mode
02-Jun-2021, 23:12:04 , ff:ff:ff:ff:ff:ff <mac_address> dbm_signal= -91 , freq= 2427 , 802.11 Probe Request --->
Unknown OUI --- Unknown OUI
.
.
. (After about 8-10 minutes)
.
.
[ 898.806823] device wlan0 left promiscuous mode
WARNING: Socket <scapy.arch.linux.L2ListenSocket object at 0x12d4200> failed with ''. It was closed.
My script has nothing but this normal scapy code for accessing mac address of both client and ap, ssid and channel etc as shown below. Then just printing these.
dot11_layer = pkt.getlayer(Dot11)
addr1= dot11_layer.addr1
addr2= dot11_layer.addr2
payload_name= dot11_layer.payload.name
ssid= pkt[Dot11Elt].info.decode()