({{, (RefLink[NetworkPacketCapture, paclet:ref/NetworkPacketCapture])[]
creates a temporary interactive interface for capturing information on network packets transmitted or received through all network interfaces on your computer.}, {, (RefLink[NetworkPacketCapture, paclet:ref/NetworkPacketCapture])[service]
captures only packets associated with the specified network service.}, {, (RefLink[NetworkPacketCapture, paclet:ref/NetworkPacketCapture])[port]
captures only packets associated with the specified port.}, {, (RefLink[NetworkPacketCapture, paclet:ref/NetworkPacketCapture])[spec]
captures only packets matching the specification spec. }})

OpenersNotesSection(Spacer1)Details

In (RefLink[NetworkPacketCapture, paclet:ref/NetworkPacketCapture])[service], possible forms for service include:

Entities can be entered using free-form linguistics with (Key1[ctrl, ==]).

In (RefLink[NetworkPacketCapture, paclet:ref/NetworkPacketCapture])[ports], network ports can be specified as follows:

In (RefLink[NetworkPacketCapture, paclet:ref/NetworkPacketCapture])[spec], spec can be given in the form key->value, or as an association containing multiple keys and values. Possible keys include:

IP addresses can be given as strings or (RefLink[IPAddress, paclet:ref/IPAddress]) objects.

Possible values for the "Interface" key can be any element in (RefLink[$NetworkInterfaces, paclet:ref/$NetworkInterfaces]), a list of these or (RefLink[All, paclet:ref/All]).

Any setting given for "PCAPFilter" overrides all other settings.

On Windows computers, (RefLink[SystemInstall, paclet:ref/SystemInstall])["WinPcap"] may be needed before (RefLink[NetworkPacketCapture, paclet:ref/NetworkPacketCapture]) is used.

(RefLink[NetworkPacketCapture, paclet:ref/NetworkPacketCapture]) typically requires elevated permissions on Linux and Mac.

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Start an interactive interface to capture network packets:

NetworkPacketCapture[]

When complete, a dataset with packets is returned:

NetworkPacketCapture[]

Record network activity from a specific service and show the first packet:

NetworkPacketCapture["HTTP"]//First

Record network activity from a specific port and show the first packet:

NetworkPacketCapture[80]//First

Record network activity from all interfaces and show the first packet:

NetworkPacketCapture["Interface"->All]//First

Record network activity using a direct PCAP filter string and show the first packet:

NetworkPacketCapture["PCAPFilter"->"port 443"]//First

OpenersExampleSection1(Spacer1)Scope  (1)

Use multiple keys to filter on multiple conditions:

NetworkPacketCapture[<|"SourceIPAddress"->"10.6.153.175","DestinationIPAddress"->"208.80.154.224"|>]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[NetworkPacketRecording, paclet:ref/NetworkPacketRecording])  ▪  (RefLink[$NetworkInterfaces, paclet:ref/$NetworkInterfaces])  ▪  (RefLink[$DefaultNetworkInterface, paclet:ref/$DefaultNetworkInterface])  ▪  (RefLink[HostLookup, paclet:ref/HostLookup])  ▪  (RefLink[PingTime, paclet:ref/PingTime])  ▪  (RefLink[URLResponseTime, paclet:ref/URLResponseTime])  ▪  (RefLink[SocketListen, paclet:ref/SocketListen])  ▪  (RefLink[SystemInstall, paclet:ref/SystemInstall])  ▪  (RefLink[AudioCapture, paclet:ref/AudioCapture])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Network Programming, paclet:guide/NetworkProgramming])}, {▪(RefLinkPlain[Internet and Computer Systems Data, paclet:guide/InternetAndWebRelatedData])}, {▪(RefLinkPlain[Raspberry Pi, paclet:guide/RaspberryPi])}, {▪(RefLinkPlain[Web Operations, paclet:guide/WebOperations])}})}})