Skip to content

Instantly share code, notes, and snippets.

@cameronelliott
Last active August 31, 2016 23:32
Show Gist options
  • Save cameronelliott/33e9569e3d8aa1c7d505c2fdaaeab1ec to your computer and use it in GitHub Desktop.
Save cameronelliott/33e9569e3d8aa1c7d505c2fdaaeab1ec to your computer and use it in GitHub Desktop.
Sharppcap Live Packet filtering using BPF
var devices = CaptureDeviceList.Instance;
devices.Select (z=>z.Description).Dump();
WinPcapDevice d = (WinPcapDevice )devices.First(z=>z.Description.Contains("Ethernet"));
d.Open(SharpPcap.WinPcap.OpenFlags.NoCaptureLocal,0);
d.Filter="port 80";
WinPcapDevice.GetSequence(d).Take(10).Dump();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment