Sniff packets in WSL on Windows
If you are running “scapy” to sniff packets or any of the packet sniffing libraries that open a raw socket, you will see “Operation not permitted” error.
Cause: WSL or WSL2 simply does not have the permission to touch Windows sockets. They use a vNIC for communication.
Fix: Instead of setting up a port forwarding step, you may just run your program using the “sudo -E” prefix.
Example: sudo -E python SniffPackets.py