Question

I want to develop a program in c# that can target and application or port's traffic and tries to view that traffic.For example,I select example.exe program in my application and it gives me it's network traffic data. Is it possible?If so,give me some directions. I'm trying not to use airPcap or winPcap or anything like these,because these libraries target the network card and I don't know what type of interface card the user might be using.

Was it helpful?

Solution

You have to either capture packets where you receive a duplicate from the NIC (pcap), or route requests through your own application so you can inspect the live packet flow (proxy-like).

For a WinPcap implementation in C#, take a look at SharpPcap. For a proxy, see here.

OTHER TIPS

winPcap is a very good library for what you want to do. If you choose to do it yourself, you will only be reinventing the wheel, and might not be able to support as many network cards as it does.

If you only want to see the traffic, you would have to use a proxy in between. But I believe you are not looking to build something like, fiddler for example, that sits in between and allows you to monitor the traffic.

If I understand you correctly you want make a c# app where you select from a list of running applications and display the network traffic to/from that app. You could do this with c# but you would have to make calls to the Windows API to get the information you need. In addition you will need non-c# library for packet capture sucgh as WinPcap. Windows has a new NetMon API that does pcap like things. I have not used it, but you probably way better off with pcap and the SharpPcap lib that CodeCaster posted.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top