0

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.

Matt Davis
  • 45,297
  • 16
  • 93
  • 124
Kishore
  • 1
  • 1

1 Answers1

2

Hi,

The filter parameter is a BPF filter: protocol names are lowercase.

You just need to use sniff(filter="udp", timeout=5)

Pierre
  • 6,047
  • 1
  • 30
  • 49