如何使用 winpcap 捕获网络流量应用程序?
我必须制作一个基于 Windows 的应用程序,用于捕获每个应用程序的网络流量,其中某些正在运行的应用程序使用相同的端口号来发送和接收数据包。 我已经使用了 winpcap 并成功捕获并过滤了它们的端口和目的地,但我不知道如何捕获它们应用程序明智,这意味着如何从 ip 数据包了解应用程序信息。 只有 winpcap 可以解决问题,还是应该使用其他一些 api 或库。 我们能否从数据包头中获取到数据包是由哪个应用程序生成的?
**
谁能给我举个例子,在 vc++ 中使用 iphlpapi 和 winpcap 来捕获每个应用程序的网络流量。
**
I have to make a windows based application for which captures network traffic per application where some of running application uses same port number for sending and receiving the packets.
I have used winpcap and successfully captured and filtered them port wise and destination wise but I dont know how to capture them application wise that means how to know application information from ip packets.
Is only winpcap can solve the problem or some other api's or library shoud be used.
Can we get the application information from which packet is generated from packet header?
**
Can anyone give me example that uses iphlpapi and winpcap in vc++ for capturing network traffic per application.
**
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为 winpcap 不可能做到这一点。
查看Windows 筛选平台。它一点也不先进。如果您查看示例,您会发现它完全符合您的要求。
I don't think this is possible with winpcap.
Take a look at Windows Filtering Platform. It's not advanced at all.If you look in the samples you can find one which does exactly what you want.
winpcap 没有一个好的方法来告诉哪个进程正在发送什么数据。
但 Windows 确实如此。
尝试使用
netstat 这个程序可以告诉您终端上正在使用哪些端口。
- 开关说,“显示所有端口”
-o 开关表示,“显示使用此端口的进程的 pid”,
您无法看到进程在哪个端口上发送,但您可以看到哪些端口正在接收 udp 数据包。
对于 tcp 数据包,您将看到所需的所有信息,包括远程连接 IP 地址。
winpcap doesn't have a good way to tell what process is sending what data.
But windows does.
try using
netstat is a program that tells you what ports are being used on your terminal.
-a switch says, "show me all the ports"
-o switch says, "show me the pid of the processes using this port"
you can't see what port your processes are sending on, but you can see what ports are receving on for udp packets.
for tcp packets you'll see all the info you could want, includeing the remote connections ip address.