I wrote the below code in scapy for filtering UDP frames. But it was capturing all the frames just not only UDP.
sniff(filter = "UDP", timeout=5)
ERROR: Could not compile filter expression UDP
the output is:
- Sniffed: TCP:41 UDP:32 ICMP:0 Other:11
I'm using Windows 7. I already installed npcap-0.99-r9 and nmap-7.70. Can someone please suggest what could be the reason.
Hi,
The
filter
parameter is a BPF filter: protocol names are lowercase.You just need to use
sniff(filter="udp", timeout=5)