Possible Duplicate:
How do I programatically collect packets from passively sniffing?
I am interested in figuring out how to go about writing a program like wireshark.
The program should be able to listen on any port without disrupting network traffic.
The exact programming language is less interesting than the OS principle itself, so let’s say that either C++ or Python would work just fine.
How would you do this on Windows?
And on Linux?
Thanks!
On Linux you use libpcap, on Windows you use the windows port of it, winpcap.
Since you tagged the question with python: There are python bindings (pylibpcap) for libpcap.