capture.pcap
packet capture
No.  Source         Destination    Proto  Info
1    192.0.2.10     198.51.100.7   DNS    Standard query A example.com
2    198.51.100.7   192.0.2.10     DNS    Standard query response
3    192.0.2.10     203.0.113.5    TCP    52144 → 443 [SYN]
4    203.0.113.5    192.0.2.10     TCP    443 → 52144 [SYN, ACK]
5    192.0.2.10     203.0.113.5    TLS    Client Hello
Illustration · Signal
tool

Wireshark: see what is on the wire

Captures network traffic and breaks every packet into readable layers.

Curated by Signal · 10/5/2026

Original: wireshark.org ↗License: GPL-2.0Repository ↗

What it is

Wireshark captures and inspects network traffic. It shows every packet broken into its protocol layers, so you can see exactly what two machines said to each other. The command-line version is called tshark and is useful when a GUI is not available, such as on a remote server.

Capturing traffic

# List available interfaces
tshark -D

# Capture on a specific interface
tshark -i eth0

# Capture a fixed number of packets
tshark -i eth0 -c 100

# Capture and write to a file
tshark -i eth0 -w capture.pcap

# Read a saved capture file
tshark -r capture.pcap

Display filters (GUI filter bar or tshark -Y)

# Only HTTP traffic
http

# Only traffic to or from an IP
ip.addr == 192.168.1.5

# Only traffic on a specific port
tcp.port == 443

# Only DNS queries
dns

# Only TCP SYN packets
tcp.flags.syn == 1 and tcp.flags.ack == 0

# Exclude a protocol
not arp

Capture filters (set before capturing, BPF syntax)

# Capture only a host
host 192.168.1.5

# Capture only a port
port 80

# Capture a subnet
net 192.168.1.0/24

# Combine filters
host 192.168.1.5 and port 443

Following a conversation

# Follow a TCP stream (reassembles the full conversation)
tshark -r capture.pcap -z follow,tcp,ascii,0

# Show only packets for one stream
tcp.stream == 0

Useful filters for investigation

# Find failed TCP connections (reset packets)
tcp.flags.reset == 1

# Find large packets
frame.len > 1000

# Find HTTP requests only (not responses)
http.request

# Find a specific HTTP host header
http.host == "example.com"

# Find plaintext passwords in common protocols
tcp contains "password"

Extracting data with tshark

# Print only source and destination IPs
tshark -r capture.pcap -T fields -e ip.src -e ip.dst

# Count packets per protocol
tshark -r capture.pcap -q -z io,phs

# Export HTTP objects (files transferred over HTTP)
tshark -r capture.pcap --export-objects http,output_folder

Statistics

# Conversation statistics (who talked to whom)
tshark -r capture.pcap -q -z conv,tcp

# Endpoint statistics
tshark -r capture.pcap -q -z endpoints,ip

# Protocol hierarchy
tshark -r capture.pcap -q -z io,phs

Practical workflow

# 1. Capture traffic while reproducing an issue
tshark -i eth0 -w issue.pcap

# 2. Stop capture, then filter for errors
tshark -r issue.pcap -Y "tcp.flags.reset == 1 or icmp"

# 3. Follow the relevant stream to see the full exchange
tshark -r issue.pcap -z follow,tcp,ascii,0

Curated summary. The original work belongs to its authors.

#network#defense
Related reading