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

…衆ロ難τιáo~ 提交于 2019-11-26 23:17:50

问题


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.


回答1:


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




回答2:


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




回答3:


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).




回答4:


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



来源:https://stackoverflow.com/questions/3798733/how-do-i-programatically-collect-packets-from-passively-sniffing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!