How do I programatically collect packets from passively sniffing? [closed]
Asked Answered
I

4

5

I want to test the vulnerability of the server I just wrote against man in the middle attacks.

How (on Mac OS X) do I analyze packets. (I'll be checking where they are going, pulling information from if they are heading to my server, and seeing what all is available) Then I'll figure out a way to encrypt everything... but first things first.

Any help on packet sniffing would be greatly appreciated.

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

so, my question is: "Is there any sort of API / library that I can interface with?"

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

Ia answered 26/9, 2010 at 16:31 Comment(0)
H
7

The best portable library for this is libpcap. There's even a java wrapper available for it.

Hitchcock answered 26/9, 2010 at 16:46 Comment(0)
R
4

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

Repurchase answered 26/9, 2010 at 16:35 Comment(3)
is there a way I could interface with it from a program I write?Ia
like, how would I get the packets into my code to analyze?Ia
Yes. You can access the packet capture library, libpcap. Wireshark uses libpcap to do the actual capture.Repurchase
A
0

Wireshark and KisMAC both offer source code downloads and run on MacOS X. You can strip the needed code from there (if it's just for your internal use).

Allene answered 26/9, 2010 at 16:39 Comment(0)
P
0

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

The library has a Sniffer class with an interface very easy to use:

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

Potable answered 27/3, 2012 at 5:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.