How can I programmatically collect packages from passive sniffing?

I want to test the vulnerability of the server that I just wrote against a person in medium attacks.

How (on Mac OS X) to analyze packets. (I will check where they go, pulling out information if they go to my server and see that everything is available). Then I figure out a way to encrypt everything ... but first, first.

Any help on batch sniffing is welcome.

The preferred language is java. But I can do C ++.

So my question is: "Are there any APIs / libraries that I can interact with?"

Like if I could do PacketSniffer ps = new PacketSniffer (); that would be amazing.

+4
source share
4 answers

The best portable library for this libpcap . There is even java wrapper available.

+7
source

No need to write yourself - Download Wireshark from http://www.wireshark.org/

+5
source

Wireshark and KisMAC both offer downloading source code and running it on MacOS X. You can remove the necessary code from it (if it is used only for your internal use).

0
source

You should take a look at libcrafter: http://code.google.com/p/libcrafter/

There is a Sniffer class in the library, the interface is very easy to use:

http://code.google.com/p/libcrafter/wiki/SnifferIntroduction

0
source

All Articles