This is a small tutorial on how to deal with Windows interfaces. You should read the sniffing tutorial before reading this section.
Network interface names on GNU/Linux are simple and easily readable, like eth0 or wlan3. But when it comes to Windows, the interface names are GUIDs, so they look like this {8f063c61-68a7-48a2-965e-9eea2ba6c510}. This can make capturing packets on the right interface a bit more difficult on this platform. libtins provides some features to simplify this and helping you find the right one easily.
In order to capture packets on Windows, you could first list all network interfaces.
You can do that easily by using the NetworkInterface
class:
That small code snippet should provide an output like the following:
This might be enough for you to recognize which is the interface you want to use. You can also resort to getting the default interface, which is very likely the one you want to use, or show the IP addresses of each of them until you recognize them:
This should help you find the right interface to capture packets on.
Now that you know which is the interface in which you want to capture
packets, you just have to use the network interface's name when instantiating
the Sniffer
class:
That's everything you need to know to start capturing packets on Windows. Note that if you know how WinPcap works, you probably know that the names you use when capturing look a bit more like this \Device\NPF_{6527cc7d-c647-4986-ac10-7784dc1f2439}. libtins automatically prepends the \Device\NPF_ string to the interface name before starting the capture, so you don't have to worry about that at all.