任何人都可以建议一个好的数据包嗅探器类为c ++? [英] Could anyone suggest a good packet sniffer class for c++?

查看:217
本文介绍了任何人都可以建议一个好的数据包嗅探器类为c ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以建议一个好的数据包嗅探器类的c ++?寻找一个容易插入的类,我可以在我的c ++程序中使用,没有什么复杂。

Could anyone suggest a good packet sniffer class for c++? Looking for a easy insertable class I can use in my c++ program, nothing complicated.

推荐答案

你永远不能拦截网络只是通过在你的项目中插入一个类。数据包捕获功能需要内核模式支持,因此您将至少需要让您的应用程序需要或安装libpcap / WinPcap,Will Dean指出。

You will never be able to intercept network traffic just by inserting a class into your project. Packet capture functionality requires kernel mode support, hence you will at the very least need to have your application require or install libpcap/WinPcap, as Will Dean pointed out.

类似Unix的发行版包括开箱即用的libpcap,在这种情况下,您可以看看这个非常简单的示例: http:// www .tcpdump.org / pcap.htm

Most modern Unix-like distributions include libpcap out of the box, in which case you could take a look at this very simple example: http://www.tcpdump.org/pcap.htm

如果你使用的是Windows,你或多或少是自己的,虽然WinPcap 编程与libpcap编程非常相似(不必惊讶,因为它是一个libpcap端口到Win32。)SDK可以在这里找到:http://www.winpcap.org/devel.htm

If you're using Windows, you're more or less on your own, although WinPcap programming is extremely similar to libpcap programming (unsurprisingly, since it's a libpcap port to Win32.) The SDK can be found here: http://www.winpcap.org/devel.htm

无论如何,重要的操作系统,您需要root /管理员访问实际执行捕获。只要使用库来重放或分析预捕获的数据,就不需要任何特殊的权限。

At any rate, no matter the operating system, you will need root / Administrator access to actually perform a capture. Just using the library to replay or analyze precaptured data doesn't require any special privilege, of course.

这篇关于任何人都可以建议一个好的数据包嗅探器类为c ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆