kpcyrd / sniffglue

Secure multithreaded packet sniffer
https://crates.io/crates/sniffglue
GNU General Public License v3.0
1.08k stars 94 forks source link

Should have an option to dump captured packets as `.pcap` file #126

Open xtaran opened 6 months ago

xtaran commented 6 months ago

It's nice to see a threaded packet sniffer with seccomp. But it seems to lack a possibility to dump the captured packets onto disk.

Is this something on the roadmap? Or totally out of scope? Or already there and just not documented?

kpcyrd commented 6 months ago

Writing pcap's has been requested multiple times, I think I'd like to understand the use-case more:

Do you want one singular pcap file that sniffglue writes to until terminated? In theory you can currently keep sniffglue running indefinitely, but when writing pcaps you'd eventually run out of disk unless you terminate and restart sniffglue periodically. During startup sniffglue discards access to the file system (depending on the operating system, using pledge and unveil, or by doing a combination of chroot then removing the processes chroot capabilities). Because of this, it's possible to open a file to write to during startup, but features like "log rotation" for pcaps can't be implemented because the process may close open files but not open any new ones.

I hesitated because of this, and that's why I'm asking if writing to a singular file would be sufficient for your use-case.

xtaran commented 6 months ago

I'd like to understand the use-case more

Maybe I can explain it the other way round: Due to its threadedness and the use of seccomp I had a look at sniffglue as a potential tcpdump replacement, also because we occasionally had performance issues with with tcpdump (usually on > 10 GBit/s interfaces) and more threads sounded like a way to get around that these issues.

Common use cases where I want to save a PCAP file: