Search code examples
raspberry-pilibpcappacket-sniffers

Is it possible sniff all packets on your own wifi subnet using npm package cap?


I've installed an npm package on a Pi that uses mscdex/cap (cap) to sniff packets for both udp and tcp on specific ports over wlan0. Cap defaults to promiscuous mode and I want to view packets being sent to another computer on the same wireless subnet. So, how can I listen to packets sent to a port on another computer/IP address within the same wifi subnet?


Solution

  • npm cap (github.com/mscdex/cap) uses libpcap/npcap to capture packets, so you should be able to capture wireless traffic. However, in order to capture wireless traffic, you need to specify the correct interface (something like wlan0, and will depend on your machine).

    Based on the documentation for this project, the only link-layer protocol it is designed to parse is ethernet, not 802.11.