Sharppcap
Author: m | 2025-04-24
Official repository - Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets - sharppcap/SharpPcap/ARP.cs at master dotpcap/sharppcap Official repository - Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets - sharppcap/SharpPcap/Pcap.cs at master dotpcap/sharppcap
sharppcap/SharpPcap/ILiveDevice.cs at master dotpcap/sharppcap
Platform:Windows 10 ProNpcap latest version 0.9983.NET Core 2.1Issue:Can't get accurate and friendly descriptions for network adaptersCan't get accurate number of adaptersHi, first of all, thank you for your great work.I'm trying to learn C# and build a GUI driven ARP resolver.I would like to get a list of my network adapters and display 'friendly names' to my users.However, using the Description method from SharpPcap:// Retrieve the device list var devices = LibPcapLiveDeviceList.Instance;int i = 0; // Print out the available devices foreach (var dev in devices) { Console.WriteLine("{0}) {1}", i, dev.Description); i++; }This is the output:Microsoft CorporationNdisWan AdapterRealtek PCIe GbE Family ControllerNdisWan AdapterNdisWan AdapterAdapter for loopback traffic captureSo not only am I getting some duplicate 'NdisWan' descriptions, I am also getting too many of them, and it doesn't reflect what I'm getting from native methods. One of the adapter has no description at all. It makes selecting the right interface a difficult guessing game.Here's an example, on the same computer, using some native .net methods, this is what I'm looking for: NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface adapter in adapters) { Console.WriteLine("{0}", adapter.Description); }Output:Realtek PCIe GbE Family ControllerNpcap Loopback AdapterSoftware Loopback Interface 1Hyper-V Virtual Ethernet AdapterIs there a way I could get a similar list with friendly names (and accurate number of interfaces), using SharpPcap? Official repository - Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets - sharppcap/SharpPcap/ARP.cs at master dotpcap/sharppcap Official repository - Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets - sharppcap/SharpPcap/Pcap.cs at master dotpcap/sharppcap Currently, sharppcap uses the LGPL license, this prevents using sharppcap in AOH and making self-contained apps, without making the whole application GPL or LGPL licensed.This discussion is an attempt to get the approval from all the copyright holders and contributors of the project, to switch the license to MIT.If your name is listed below, please write a comment to explicitly approve or decline the license change.Known Copyright HoldersWhoApprovedCommentAyoub Kaanich [email protected]✔️Chris Morgan [email protected]✔️Evan Plaice [email protected] limited to Tutorial and Examples in b6e9899 and 147bc90Noah Potash [email protected]✔️Phillip Lemon [email protected]✔️Tamir Gal [email protected]✔️Known ContributorsWhoLinesPercentUsernameApprovedChris Morgan1101252.36%@chmorgan✔️Ayoub Kaanich861140.94%@kayoub5✔️Hendrik Eckardt3781.80%@heck-gd✔️Jan Pluskal3441.64%@pluskal✔️Lex Li2421.15%@lextm✔���houcem benali1140.54%@sensokame✔️Evan Plaice1090.52%@evanplaiceNoah Potash510.24%@SapientGuardian✔️Ilya Botov380.18%@ARHARUP✔️Sterlinghv370.18%@Sterlinghv✔️Cameron Elliott340.16%@cameronelliott✔️paul270.13%@zpaul48Manuel Jacob90.04%@MJay1337Viliam Letavay80.04%@fukaminakrize✔️D1010011100160.03%@D10100111001tamirgal40.02%@tamirgal✔️Mauro Levra30.01%@Nazardo✔️Trivalik20.01%@trivalik✔️Fidel Perez-Smith10.00%@fiddyschmitt✔️VerdictMozilla's lawyers believed it would be acceptable for Mozilla to make a good-faith effort to contract all contributors and then re-license, even if 5% of the contributors were unreachable (and none of the contributors disapproved).you can read more about it in our case, the contributors that voted, all voted in favor of changing the license, the ones that did not, have code contribution that consist of less than 1% of the current code base.The copyright holders all agreed to change the license, except for "Evan Plaice" who is yet to reply, his contribution is limited to tutorial and documentation, thus does not consist a blocker for changing the library license.Based on the votes, the small contribution size of the of the ones who did not vote, we may proceed on changing the project license, still I would give it a few days in hope that the remaining contributors do reply.ContextThis discussion was originally started in #481Comments
Platform:Windows 10 ProNpcap latest version 0.9983.NET Core 2.1Issue:Can't get accurate and friendly descriptions for network adaptersCan't get accurate number of adaptersHi, first of all, thank you for your great work.I'm trying to learn C# and build a GUI driven ARP resolver.I would like to get a list of my network adapters and display 'friendly names' to my users.However, using the Description method from SharpPcap:// Retrieve the device list var devices = LibPcapLiveDeviceList.Instance;int i = 0; // Print out the available devices foreach (var dev in devices) { Console.WriteLine("{0}) {1}", i, dev.Description); i++; }This is the output:Microsoft CorporationNdisWan AdapterRealtek PCIe GbE Family ControllerNdisWan AdapterNdisWan AdapterAdapter for loopback traffic captureSo not only am I getting some duplicate 'NdisWan' descriptions, I am also getting too many of them, and it doesn't reflect what I'm getting from native methods. One of the adapter has no description at all. It makes selecting the right interface a difficult guessing game.Here's an example, on the same computer, using some native .net methods, this is what I'm looking for: NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface adapter in adapters) { Console.WriteLine("{0}", adapter.Description); }Output:Realtek PCIe GbE Family ControllerNpcap Loopback AdapterSoftware Loopback Interface 1Hyper-V Virtual Ethernet AdapterIs there a way I could get a similar list with friendly names (and accurate number of interfaces), using SharpPcap?
2025-04-07Currently, sharppcap uses the LGPL license, this prevents using sharppcap in AOH and making self-contained apps, without making the whole application GPL or LGPL licensed.This discussion is an attempt to get the approval from all the copyright holders and contributors of the project, to switch the license to MIT.If your name is listed below, please write a comment to explicitly approve or decline the license change.Known Copyright HoldersWhoApprovedCommentAyoub Kaanich [email protected]✔️Chris Morgan [email protected]✔️Evan Plaice [email protected] limited to Tutorial and Examples in b6e9899 and 147bc90Noah Potash [email protected]✔️Phillip Lemon [email protected]✔️Tamir Gal [email protected]✔️Known ContributorsWhoLinesPercentUsernameApprovedChris Morgan1101252.36%@chmorgan✔️Ayoub Kaanich861140.94%@kayoub5✔️Hendrik Eckardt3781.80%@heck-gd✔️Jan Pluskal3441.64%@pluskal✔️Lex Li2421.15%@lextm✔️houcem benali1140.54%@sensokame✔️Evan Plaice1090.52%@evanplaiceNoah Potash510.24%@SapientGuardian✔️Ilya Botov380.18%@ARHARUP✔️Sterlinghv370.18%@Sterlinghv✔️Cameron Elliott340.16%@cameronelliott✔️paul270.13%@zpaul48Manuel Jacob90.04%@MJay1337Viliam Letavay80.04%@fukaminakrize✔️D1010011100160.03%@D10100111001tamirgal40.02%@tamirgal✔️Mauro Levra30.01%@Nazardo✔️Trivalik20.01%@trivalik✔️Fidel Perez-Smith10.00%@fiddyschmitt✔️VerdictMozilla's lawyers believed it would be acceptable for Mozilla to make a good-faith effort to contract all contributors and then re-license, even if 5% of the contributors were unreachable (and none of the contributors disapproved).you can read more about it in our case, the contributors that voted, all voted in favor of changing the license, the ones that did not, have code contribution that consist of less than 1% of the current code base.The copyright holders all agreed to change the license, except for "Evan Plaice" who is yet to reply, his contribution is limited to tutorial and documentation, thus does not consist a blocker for changing the library license.Based on the votes, the small contribution size of the of the ones who did not vote, we may proceed on changing the project license, still I would give it a few days in hope that the remaining contributors do reply.ContextThis discussion was originally started in #481
2025-04-11=====Linux=====Catcher - http packet viewer for linux. Written in C#, requires mono (>= 2.8).Uses SharpPcap library, you need to have >= libpcap0.8 (and -dev package) installed too. Although it may work with lower versions too.Run from binaries folder with root privileges: 'sudo mono catcher.exe', until I (or you) figure out how to sniff without root.Unlike fiddler and like wireshark catcher doesn't act as proxy: no packets go through it,instead it passively captures tcp packets flying by and tries to assemble http data.The problem with this is some packets are going to be lost even when capture is handled correctly.Another problem is difficulty to decrypt SSL packets (man in the middle is not applicable).But it seem to work fine with small/medium sized http data (The source project created in MonoDevelop 3.0.5.====Windows====It turns out it works on windows! You'll need .net 4.0, gtk# for .net ( andwinpcap library ( Once these installed run catcher.exe from windows_binaries folder.Source project is opened by visual studio flawlessly.====Mac====Should work on a mac in theory, although I haven't tried that. Steps:get libpcapget mono and gtk# for macget monodevelop for macget sources from here and open it in monodevelopcompileit should work (maybe with sudo)Please give feedback here on github or at (questions are welcome too).Here is how it looks on my ubuntu machine:
2025-04-20