tools

Overview

Wireshark is a GUI-based network packet capture and analysis tool. Provides deep inspection of hundreds of protocols, real-time capture, and PCAP file analysis. Widely used for network troubleshooting, protocol analysis, and forensics.

Target / Context

Live network interfaces or saved PCAP files. Available on Linux and Windows. Pairs with TCPDump for headless capture then GUI analysis.


Installation

ℹ︎Installation Commands:
sudo apt install wireshark

Or download from https://www.wireshark.org/download.html


Basic Usage

ℹ︎Basic Usage:

Open Wireshark, select an interface, and click the shark fin to start capture. To open a PCAP: File -> Open -> select file To save current capture: File -> Save (or select format from File menu) Start a capture with filters: Capture -> Options -> select interface -> add capture filter


GUI Layout

Wireshark presents three panes during capture or file analysis:

PaneLocationDescription
Packet ListTopOne row per packet. Columns: Number, Time, Source, Destination, Protocol, Info. Columns are configurable.
Packet DetailsMiddleExpandable tree showing each protocol layer in OSI order (lower-layer encapsulation at top). Click any field for details.
Packet BytesBottomRaw hex and ASCII of the selected packet. Non-printable bytes shown as .. Selecting a field in the Details pane highlights the corresponding bytes here.

The status bar at the bottom-left shows the Expert Analysis indicator — yellow/red flags indicate errors, retransmissions, resets, and suspicious anomalies.


Flags & Options

ℹ︎Flags & Options:
FeatureDescription
Display FiltersFilter packets shown in the view without discarding captured data
Capture FiltersFilter which packets are captured — BPF syntax, same as TCPDump
Expert AnalysisBottom-left status bar — shows warnings, errors, and anomalies
Follow StreamRight-click a packet -> Follow -> TCP/UDP/HTTP Stream
StatisticsProtocol hierarchy, conversations, endpoints, I/O graphs

Capture Filters

Applied before capture starts using BPF syntax. Reduces data written to disk — irreversible; data not matching is never captured. Access: Capture -> Capture Filters, or Capture -> Options -> filter field per interface.

ℹ︎Capture Filter Examples:
FilterResult
host x.x.x.xCapture only traffic involving a specific host (bi-directional)
net x.x.x.x/24Capture traffic to or from a specific subnet
src net x.x.x.x/24Capture traffic sourcing from a specific network only
dst net x.x.x.x/24Capture traffic destined to a specific network only
port 443Capture only traffic on port 443
not port 22Capture everything except port 22
port 80 and port 443Capture traffic matching both ports
portrange 0-1024Capture traffic on all well-known ports
ip / tcp / etherCapture only traffic of the specified protocol type
broadcast / multicast / unicastCapture by traffic delivery type

Display Filters

Applied after capture or while capture is running. All captured data is retained — display filters only affect what is shown. Green input field means the filter syntax is valid. Access: filter bar at the top, or Bookmarks toolbar dropdown.

ℹ︎Display Filter Examples:
FilterResult
ip.addr == x.x.x.xShow all traffic involving an IP (OR match — src or dst)
ip.addr == x.x.x.x/24Show traffic involving any host in the subnet
ip.src == x.x.x.xShow only traffic from a specific source IP
ip.dst == x.x.x.xShow only traffic to a specific destination IP
tcp.port == 443Filter by TCP port
tcp.port != 22Exclude a specific port
dns / http / ftp / arpShow only the specified protocol
tcp.flags.syn == 1Show SYN packets
!(arp or dns or icmp)Exclude noise protocols
http.request.method == “GET”Show only HTTP GET requests
ftp.request.commandShow FTP commands (credentials visible in clear text)
ftp-dataShow FTP data transfers (reconstructable files)
rdpShow RDP traffic (requires TLS decryption to be meaningful)
tcp.stream eq 5Isolate a specific TCP conversation by stream number
and / or / notCombine filters with logical operators

Note: filtering for http is not the same as filtering for port 80 — Wireshark identifies HTTP by protocol markers (GET/POST), not port number alone. Display filter processing can be slow on large captures. Consider breaking large PCAPs into smaller chunks.


Common Use Cases

Search Packet Contents

ℹ︎Steps:

CTRL+F -> select “Packet Details” -> search for plaintext strings

Follow a TCP Stream

ℹ︎Steps:

Right-click any packet in a TCP conversation -> Follow -> TCP Stream Wireshark reassembles the full session into readable text (both directions shown in different colors). Works for any TCP-based protocol — HTTP, FTP, SMTP, etc. The display filter tcp.stream eq <N> is applied automatically to isolate that stream. Use to pull credentials, file contents, or full HTTP responses from a capture.

Extract Files from a Capture

ℹ︎Steps:

Requires the full conversation to be captured before extraction. File -> Export Objects -> select protocol format (HTTP, FTP-DATA, SMB, etc.) Wireshark lists all transferable objects found in the capture for selective export.

Analyze FTP Traffic

ℹ︎Steps:

FTP transmits credentials and data in cleartext. ftp.request.command — shows all FTP commands including USER and PASS ftp-data — shows data transfer payloads (raw bytes of transferred files) To reconstruct a transferred file: filter on ftp-data, right-click the data packet, Follow -> TCP Stream -> Show and save data as: Raw -> save with original filename

Decrypt RDP Traffic (with RSA Private Key)

ℹ︎Steps:

If you have the RSA private key used by the RDP server, Wireshark can decrypt the session.

  1. Filter on tcp.port == 3389 to confirm traffic is present
  2. Edit -> Preferences -> Protocols -> TLS -> RSA Keys list -> Edit (”+”)
  3. Enter: IP address of the RDP server, port 3389, protocol: tpkt (or leave blank)
  4. Select the RSA private key file (.pem or .key)
  5. Save and reapply — filter on rdp to view decrypted packets Note: This same process works for any TLS-encrypted protocol given the correct server key.

Decrypt TLS Traffic (with Key Log File)

ℹ︎Steps:

Right Click packet -> Protocol Preferences -> TLS -> Open TLS Preferences Browse under “(Pre)-Master-Secret log filename” and select the key log file.

Filter by Protocol or Host

ℹ︎Commands:

Display filter examples: http — show only HTTP traffic Filter by port

tcp.port == 443

Filter by IP

ip.addr == 10.10.10.1

Show SYN packets

tcp.flags.syn == 1

Exclude noise protocols

!(arp or dns or icmp)

Check for Anomalies

ℹ︎Steps:

Use the Expert Analysis indicator in the bottom-left status bar. Yellow/red indicators highlight errors, retransmissions, and suspicious patterns. Statistics -> Protocol Hierarchy — view protocol breakdown across the entire capture Statistics -> Conversations — top talkers and per-protocol session breakdown Analyze tab — TCP stream following, filter preparation, expert info details


TShark (CLI Interface)

TShark is the terminal-based counterpart to Wireshark. It shares Wireshark’s protocol dissectors, display filter syntax, and capture formats but runs headless. Useful on servers without a desktop environment or when piping output to other tools.

ℹ︎TShark Flags:
FlagDescription
-DList available capture interfaces and exit
-LList available link-layer mediums and exit
-i <iface>Select capture interface
-f <filter>Capture filter in BPF/libpcap syntax (applied during capture)
-Y <filter>Display filter (applied to output)
-r <file>Read from a PCAP file
-w <file>Write to file in pcapng format
-c <n>Stop after capturing N packets
-a <condition>Autostop condition: duration, filesize, or packet count
-PPrint packet summary while writing to file
-xAdd hex and ASCII output for each packet
-hShow help
ℹ︎TShark Examples:
tshark -D
tshark -i 1 -w /tmp/test.pcap
sudo tshark -i eth0 -f "host 172.16.146.2"
tshark -r capture.pcap -Y "http.request.method == GET"

Termshark (Terminal UI)

Termshark is a terminal-based UI (TUI) that replicates the Wireshark three-pane interface inside a terminal window. Uses the same capture filters and display filters as Wireshark. Accepts interfaces and filters at startup the same way as TShark.

ℹ︎Termshark Keyboard Shortcuts:
KeyAction
/Open display filter / stream search
TabSwitch between panes
qQuit
EscActivate menu
cSwitch to copy mode
|Cycle through pane layouts
</code>Toggle pane zoom
+ / -Adjust horizontal split
< / >Adjust vertical split
:Activate command-line mode
zMaximize/restore modal dialog
?Display help
Shift + Left MouseCopy
Shift + Right MousePaste

Install: download a stable release binary from the Termshark GitHub releases page and extract — no build required.


  • Packet Analysis
  • Packet Sniffing

References / Images

  • Assets/Images/Protocol Data Unit Breakdown In Wireshark.png