Raspberry Pi as NetSniffer in PureData

As part of the system for the SoDa Matrix Project, I'm developing an apparatus working as network sniffer for a WiFi network.

Not important now how I'll use that traffic in the project, but the structure of the system itself.

Controlled traffic is used as data packages imported in PureData, filtered and then sent via OSC protocol to the main patch on Max/MSP.

The project use a RaspberryPi 3 Model B for the hardware. It's small, cheap, with a little power consumption and it is powerful.

For the sniffing process you can use the ethernet port connected to the router that makes the WiFi network available, the WiFi chip integrate on the board or a USB WiFi dongle as the TP-Link TL-WN722N (on the rasPi no need to install nothing. Plug it in and the OS will recognize the dongle automatically).

As main sniffer software there is WireShark in its only-terminal version T-Shark.

A Python script to run it and translate the traffic sniffed into OSC protocol (python 3 + pythonosc).

At this point you can simply take thos OSC messages and do what you want in a simple PureData or Max/MSP patch (or whatever). In the first case I've used a combo of objects like udpreceive, unpackOSC, routeOSC, symbol and symbol2list to be able to use those messages as I want. Using Max/MSP you can use the CNMAT Externals from the Package Manager to parse the incoming osc traffic.

If you decide to use PD all can run on the RasPi. Otherwise you have to do a bridge from the RasPi to another pc/mac through OSC protocol to receive all the traffic.

I've chosen the second option only because I have my main control patch on Max, so it was easier in my case. Before deviating the traffic from the RasPi to the Max patch on the other computer I've used the processing power of the Model B to filter and elaborate the rough messages incoming from T-Shark, doing some of the dirt work for me.

So: T-Shark --> PD/Max-MSP through a Python sketch on OSC messages_ Obviously you can also do the Net Sniffer on any other platform instead of on a RaspberryPi_

Many thanks to Dirk Leas that help me to develop this little project_