Example Code

Ethernet Packet Sniffer Utility Using WinPcap Functions

Code and Documents


This example project provides a library of VIs that work together to wrap various ethernet packet sniffing functions available from WinPcap, a Windows packet capture program.

Note: You must install WinPcap before running this example. You can download WinPcap from www.winpcap.org.

To launch this example VI, open Packet_Sniffer_Project.lvproj, then open Packet Sniffer Example.vi.

This VI reads ethernet packets. It outputs the raw data for the packet as a hexadecimal string. It also parses out the ethernet and IP header information, as well as timestamp information for each packet.

The VI enumerates all the ethernet adapters on your system and allows you interactively to select between the various adapters.

Please note that this project is for demonstration purposes only. It was designed to demonstrate one method in which LabVIEW can be used to interface with external software utilities (such as WinPcap). NI Engineers can only address questions on how to call external code from LabVIEW, not the contents of each call demonstrated in this example. In addition, we cannot guarantee that the software will work with newer versions of the external software package.

Related Links:
WinPcap, The Packet Capture and Network Monitoring Library for Windows

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.