Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sniff local outgoing network traffic in .NET without using PCap?

I'd like to somehow hook into the local system's network stack to capture outgoing network packets without using Winpcap. Unfortunately it tends to crash my system every now and then.

Is there a way to "sniff" outgoing traffic of the local system from a user space process written in a .NET language?

like image 667
Hendrik Wiese Avatar asked Jun 01 '10 21:06

Hendrik Wiese


People also ask

How do I sniff traffic on my network?

The most reliable way to sniff traffic is to use a network tap. A network tap is a “bump-in-the-wire” device designed only to copy traffic passing through it to a monitor port. You typically insert a network tap inline between two nodes in a network, such as between your firewall and your first switch.

What tool can be used to capture live traffic?

To capture network traffic, you can use tcpdump. This is a packet sniffer that can observe and record network traffic on an interface. In the following example, we capture 1,000 packets using tcpdump. An easier way to analyze network traffic is to use an actual network traffic analyzer, such as Wireshark.

Can Wireshark monitor all network traffic?

By default, Wireshark only captures packets going to and from the computer where it runs. By checking the box to run Wireshark in promiscuous mode in the capture settings, you can capture most of the traffic on the LAN.

How do I track network packets?

Access your router by entering your router's IP address into a web browser. Once you sign in, look for a Status section on the router (you might even have a Bandwidth or Network Monitor section depending on the type of router). From there, you should be able to see the IP addresses of devices connected to your network.


2 Answers

What you want is the Network Monitor API. More here and here.

like image 196
Mike Atlas Avatar answered Oct 13 '22 20:10

Mike Atlas


I use smsniff from NIRSOFT. You need to be admin on the machine to sniff any traffic.

http://www.nirsoft.net/utils/smsniff.html

I have never seen .net used to sniff traffic. But maybe NetMon from Microsoft has a COM interface you call from .Net

But as always you need to be admin to sniff traffic, since it is needed to put the NIC in promiscuous mode.

like image 45
ggonsalv Avatar answered Oct 13 '22 19:10

ggonsalv