All Projects → chmorgan → Sharppcap

chmorgan / Sharppcap

Licence: lgpl-3.0
Official repository - Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets

Projects that are alternatives of or similar to Sharppcap

sharppcap
Official repository - Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets
Stars: ✭ 1,054 (+58.5%)
Mutual labels:  packets, analysis, network-monitoring, network-programming
Xdp
Package xdp allows one to use XDP sockets from the Go programming language.
Stars: ✭ 36 (-94.59%)
Mutual labels:  network-programming, packets
Msquic
Cross-platform, C implementation of the IETF QUIC protocol.
Stars: ✭ 2,501 (+276.09%)
Mutual labels:  network-programming, cross-platform
Libpnet
Cross-platform, low level networking using the Rust programming language.
Stars: ✭ 1,322 (+98.8%)
Mutual labels:  packets, cross-platform
Passer
Passive service locator, a python sniffer that identifies servers, clients, names and much more
Stars: ✭ 144 (-78.35%)
Mutual labels:  network-monitoring, packets
Mne Cpp
MNE-CPP: A Framework for Electrophysiology
Stars: ✭ 104 (-84.36%)
Mutual labels:  analysis, cross-platform
Timemory
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
Stars: ✭ 192 (-71.13%)
Mutual labels:  analysis, cross-platform
arpwitch
A modern arpwatch replacement with JSON formatted outputs and easy options to exec commands when network changes are observed.
Stars: ✭ 20 (-96.99%)
Mutual labels:  network-monitoring, network-programming
Seccubus
Easy automated vulnerability scanning, reporting and analysis
Stars: ✭ 615 (-7.52%)
Mutual labels:  analysis
Flutter Examples
[Examples] Simple basic isolated apps, for budding flutter devs.
Stars: ✭ 5,863 (+781.65%)
Mutual labels:  cross-platform
Cross Env
🔀 Cross platform setting of environment scripts
Stars: ✭ 5,623 (+745.56%)
Mutual labels:  cross-platform
Tvision
A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.
Stars: ✭ 612 (-7.97%)
Mutual labels:  cross-platform
Copperspice
Cross platform C++ libraries
Stars: ✭ 630 (-5.26%)
Mutual labels:  cross-platform
Capacitor
Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️
Stars: ✭ 6,598 (+892.18%)
Mutual labels:  cross-platform
Bareos
Main repository with the code for the libraries and daemons
Stars: ✭ 651 (-2.11%)
Mutual labels:  cross-platform
Guilite
✔️The smallest header-only GUI library(4 KLOC) for all platforms
Stars: ✭ 5,841 (+778.35%)
Mutual labels:  cross-platform
Notes
Note-taking application, write down your thoughts.
Stars: ✭ 612 (-7.97%)
Mutual labels:  cross-platform
Wallet Core
Cross-platform, cross-blockchain wallet library.
Stars: ✭ 657 (-1.2%)
Mutual labels:  cross-platform
Guitar
A Cross-Platform String and Regular Expression Library written in Swift.
Stars: ✭ 641 (-3.61%)
Mutual labels:  cross-platform
Liteapp
LiteApp is a high performance mobile cross-platform implementation, The realization of cross-platform functionality is base on webview and provides different ideas and solutions for improve webview performance.
Stars: ✭ 626 (-5.86%)
Mutual labels:  cross-platform

.NET Core

sharppcap

Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets from live and file based devices

The official SharpPcap repository.

Features

Note that packet dissection and creation was split from SharpPcap some years ago into a separate project, Packet.Net. See the Packet.Net page for a full list of supported packet formats.

  • On Linux, support for libpcap

  • On Windows, support for:

  • On all platforms:

    • Live device lists
    • Statistics
    • Reading packets from Live Devices (actual network devices) and Offline Devices (Capture files)
    • Support for Berkley Packet Filters
    • Dumping packets to Pcap files.
    • Pcap and pcap-ng format (when using libpcap >=1.1.0 or npcap)
  • NativeLibrary support

    • Capture library resolution works cleanly across Linux, OSX, and Windows
    • Cleanly loads libpcap on Linux whether the distro has a symlink to libpcap.so or not.
  • .NET Core 3 and .NET Framework support

Examples

See the Examples folder for a range of full example projects using SharpPcap

Listing devices

var devices = CaptureDeviceList.Instance;
foreach (var dev in devices)
    Console.WriteLine("{0}\n", dev.ToString());

Capturing packets

void Device_OnPacketArrival(object s, CaptureEventArgs e)
{
    Console.WriteLine(e.Packet);
}

using var device = LibPcapLiveDeviceList.Instance[0];
device.Open();
device.OnPacketArrival += Device_OnPacketArrival;
device.StartCapture();

Reading from a capture file

void Device_OnPacketArrival(object s, CaptureEventArgs e)
{
    Console.WriteLine(e.Packet);
}

using var device = new CaptureFileReaderDevice("filename.pcap");
device.Open();
device.OnPacketArrival += Device_OnPacketArrival;
device.StartCapture();

Writing to a capture file

using var device = new CaptureFileWriterDevice("somefilename.pcap", System.IO.FileMode.Open);
var bytes = new byte[] { 1, 2, 3, 4 };
device.Write(bytes);

CI support

We have support for a number of CI systems for a few reasons:

  • Diversity of CI systems in case one of them shuts down
  • Examples in case you'd like to customize SharpPcap and make use of one of these CI systems for internal builds. Note that we assume you are following the license for the library.

Releases

SharpPcap is released via nuget

Platform specific notes

  • OSX (at least as of 11.1) lacks libpcap with pcap_open

Thanks

SharpPcap is where it is today because of a number of developers who have provided improvements and fixes and users that have provided helpful feedback through issues and feature requests.

We are especially appreciative of a number of projects we build upon (as SharpPcap is a C# wrapper):

  • libpcap - thank you so much for releasing 1.10
  • npcap - for continuing packet capture support on Windows

Migration from 5.x to 6.0

We hope that you'll find the 6.x api to be cleaner and easier to use.

6.0 brings a number of cleanups that have resulted in API breakage for 5.x users.

To aid with the migration from 5.x to 6.0 here is a list of some of the changes you'll have to make to your SharpPcap usage.

The examples are also a great resource a they show working examples using the latest API.

  • NativeLibrary is used for improved capture library resolution
  • Devices are IDisposable
    • Remove calls to Close()
    • Switch 'var device = xxx;'to 'using device = xxx;'
  • Rename OpenFlags -> DeviceModes
  • Open() methods have been collapsed into fewer methods with default variables.
  • DeviceMode has been replaced by DeviceModes as DeviceMode was not able to cover all of the combinations of ways you could open a device.
  • NpcapDevice -> LibPcapLiveDevice
    • If you are using NpcapDevice you should consider using LibPcapLiveDevice. The latest versions of Npcap come with newer versions of libpcap that provide almost all of the functionality of Npcap native APIs.
    • The current gap here is statistics mode, currently only supported by Npcap.
    • There has been talk of a statistics mode wrapper that would provide similar functionality, albeit without the same level of efficiency as if it were done in the kernel or driver as on Windows, for libpcap systems.
  • WinPcap has been deprecated
    • We recommend switching to LibPcapLiveDevice
  • Remote authentication
    • If you are using RemoteAuthentication some functionality has been folded into this class and the api changed to remove usage of ICredentials and NetworkCredentials.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].