Wireshark is an open-source network protocol analyzer used for capturing and inspecting network traffic in real time. It allows users to analyze packets at a granular level, helping in troubleshooting network issues, monitoring security threats, and understanding network protocols.
Key Features of Wireshark¶
β
Packet Capture β Captures live network traffic from wired and wireless interfaces.
β
Deep Packet Inspection β Analyzes protocols and packet details.
β
Filtering & Searching β Supports display and capture filters to refine data.
β
Traffic Analysis β Helps diagnose slow networks, dropped packets, or security threats.
β
Decryption Support β Can decrypt protocols like TLS/SSL (if keys are available).
β
Cross-Platform β Works on Windows, Linux, and macOS.
π‘ Use Case Examples
πΉ Debugging network issues (e.g., packet loss, latency).
πΉ Analyzing HTTP requests for web applications.
πΉ Detecting unauthorized access attempts or cyber threats.
Wireshark Interface Overview¶
Wireshark's interface is divided into several key sections, making it easy to capture, filter, and analyze network packets. Below is a breakdown of its interface:
1. Menu Bar¶
Located at the top, the Menu Bar provides access to various Wireshark functions.
-
File β Open, save, and export capture files.
-
Edit β Preferences, find packets, and configure Wireshark.
-
View β Customize layout, coloring, and zoom levels.
-
Capture β Start, stop, restart, and configure capture settings.
-
Analyze β Apply display filters and follow network streams.
-
Statistics β View protocol hierarchy, I/O graphs, and conversation details.
-
Help β Access documentation and Wireshark community support.
2. Toolbar¶
Below the menu bar, the Toolbar provides quick access to essential functions.
πΉ Start/Stop Capture β Buttons to control packet capture.
πΉ Capture Options β Configure interfaces, buffer size, and packet limits.
πΉ Open File β Load previous captures (.pcapng, .pcap).
πΉ Apply Display Filter β Enter filters like ip.addr == 192.168.1.1.
πΉ Color Filters β Highlights specific protocols (TCP, DNS, ARP).
3. Interface List (Capture Section)¶
When starting Wireshark, youβll see a list of available network interfaces (Wi-Fi, Ethernet, loopback, etc.).
-
Select an interface (e.g.,
eth0for Ethernet,wlan0for Wi-Fi) to begin packet capture. -
Live traffic statistics (packet count, bytes per second) are displayed next to each interface.
π‘ Tip: Use Capture β Options to customize capture settings before starting.
4. Packet List Pane (Top Section)¶
This pane displays captured packets in real-time.
Columns include:
-
No. β Packet number in capture.
-
Time β Timestamp (relative or absolute).
-
Source β Senderβs IP address.
-
Destination β Receiverβs IP address.
-
Protocol β Identified protocol (e.g., TCP, HTTP, DNS).
-
Length β Packet size in bytes.
-
Info β Brief packet description.
πΉ Clicking a packet selects it for detailed analysis.
5. Packet Details Pane (Middle Section)¶
This pane shows a structured breakdown of the selected packet.
-
Frame Header β Metadata (time, interface, length).
-
Ethernet Layer β MAC addresses and frame type.
-
IP Layer β Source/destination IP addresses, TTL, checksum.
-
Transport Layer β TCP/UDP details (ports, sequence numbers).
-
Application Layer β HTTP headers, DNS queries, encrypted payloads.
π‘ Tip: Right-click on a field β Apply as Filter to quickly filter packets.
6. Packet Bytes Pane (Bottom Section)¶
This pane displays the raw data of the selected packet in hexadecimal and ASCII format.
πΉ Useful for deep-level protocol analysis or investigating malware payloads.
πΉ Can be copied/exported for further analysis.
7. Status Bar (Bottom Section)¶
Displays summary information about the capture session.
-
Packet count β Total captured packets.
-
Displayed packets β Number of packets after applying a filter.
-
Dropped packets β Shows if any packets were lost during capture.
-
Profile selection β Switch between custom analysis profiles.
Steps to Capture and Save Packets in Wireshark¶
1οΈβ£ Open Wireshark
2οΈβ£ Select a Network Interface (e.g., Ethernet, Wi-Fi)
3οΈβ£ Start Capture (Click the Shark Fin icon or press Ctrl + E)
4οΈβ£ Stop Capture (Click the Red Square icon or press Ctrl + E)
5οΈβ£ Save Capture β File β Save As β Choose .pcapng or .pcap
β Done! Your packet capture is saved for analysis. π
Filters in Wireshark¶
Filters in Wireshark help refine captured network traffic for easier analysis. They allow users to focus on specific packets based on IP addresses, protocols, ports, or other parameters.
Types of Filters in Wireshark¶
1οΈβ£ Capture Filters (Before capturing packets)
-
Applied before packet capture to limit data collection.
-
Example:
2οΈβ£ Display Filters (After capturing packets)
-
Applied after packet capture to refine displayed results.
-
Example:
π‘ Tip: Use Expression Editor in Wireshark to create complex filters easily! π
How to Capture and View Unencrypted HTTP Data in Wireshark¶
π¨ Note: This works only for unencrypted HTTP traffic. If the website uses HTTPS (TLS encryption), you wonβt see readable data unless you have the decryption keys.
Steps to Capture HTTP Packets¶
1οΈβ£ Open Wireshark
2οΈβ£ Select Network Interface (e.g., Wi-Fi or Ethernet)
3οΈβ£ Apply Capture Filter (Optional)
4οΈβ£ Start Capture (Ctrl + E) and Visit an HTTP Website
- Example:
http://example.com
5οΈβ£ Stop Capture (Ctrl + E)
6οΈβ£ Apply Display Filter to Show Only HTTP Traffic
7οΈβ£ Analyze HTTP Packets
-
Find GET and POST requests.
-
Click a packet β Expand Hypertext Transfer Protocol.
-
Right-click β Follow HTTP Stream to see raw data.
β Now you can see unencrypted data (usernames, passwords, cookies) if the site does not use HTTPS! π
Wireshark Filters: Protocol, Address, and Port Filters¶
1οΈβ£ Protocol Filters (Filter by network protocol)¶
Used to display packets for a specific protocol (TCP, UDP, HTTP, DNS, etc.).
π Examples:
http # Show only HTTP traffic
dns # Show only DNS packets
tcp # Show only TCP packets
udp # Show only UDP packets
icmp # Show only ICMP (ping) packets
2οΈβ£ Address Filters (Filter by IP/MAC address)¶
Used to show packets from or to a specific device.
π Examples:
ip.addr == 192.168.1.10 # Show packets where 192.168.1.10 is source or destination
ip.src == 192.168.1.10 # Show packets where 192.168.1.10 is the source
ip.dst == 192.168.1.10 # Show packets where 192.168.1.10 is the destination
eth.addr == 00:1A:2B:3C:4D:5E # Show packets from/to a specific MAC address
3οΈβ£ Port Filters (Filter by network ports)¶
Used to filter packets based on source or destination port numbers.
π Examples:
tcp.port == 80 # Show only HTTP packets
udp.port == 53 # Show only DNS packets
tcp.srcport == 443 # Show packets where the source port is HTTPS
tcp.dstport == 22 # Show packets where the destination port is SSH
π‘ Tip: You can combine filters!
This shows only HTTP traffic from/to 192.168.1.10. π
Logical Operators in Wireshark Filters¶
Wireshark supports logical operators to combine multiple filter conditions for precise packet analysis.
1οΈβ£ AND Operator (&& or and)¶
β
Matches all conditions (both must be true).
π Example:
πΉ Shows HTTP traffic only from/to 192.168.1.10.
2οΈβ£ OR Operator (|| or or)¶
β
Matches any condition (at least one must be true).
π Example:
πΉ Shows both HTTP (80) and HTTPS (443) traffic.
3οΈβ£ NOT Operator (! or not)¶
β
Excludes packets that match the condition.
π Example:
πΉ Hides all HTTP packets, showing everything else.
4οΈβ£ Combining Operators¶
β
Complex filters using multiple conditions.
π Example:
πΉ Shows SSH traffic (22) from either 192.168.1.10 or 192.168.1.20.
π‘ Tip: Use parentheses () for clarity! π
Wireshark Coloring Rules π¨¶
Wireshark uses coloring rules to highlight packets for quick identification. These colors help distinguish protocols, errors, or specific traffic patterns.
1οΈβ£ Default Coloring Rules¶
Wireshark applies default colors:
-
π΅ Light Blue β TCP traffic
-
π’ Green β HTTP traffic
-
π‘ Yellow β Warnings (e.g., retransmissions)
-
π΄ Red β Errors (e.g., malformed packets)
-
β« Black β Rejected or dropped packets
2οΈβ£ Viewing & Editing Coloring Rules¶
π Steps to Open Coloring Rules:
-
Go to View β Coloring Rules
-
Modify existing rules or add new ones
π Creating a New Rule:
-
Click + (Add Rule)
-
Enter a filter condition (e.g.,
tcp.port == 443) -
Choose a foreground & background color
-
Click OK β Apply
3οΈβ£ Example Custom Rules¶
β Highlight all DNS traffic in Purple:
β Mark all SSH packets in Orange:
β Highlight traffic from a specific IP in Pink:
Wireshark Profiles π οΈ¶
A Wireshark Profile is a customized workspace with specific settings for different analysis needs.
1οΈβ£ Features of Profiles¶
-
Custom Display Filters
-
Coloring Rules
-
Capture Settings
-
Column Layouts
2οΈβ£ Create a New Profile¶
π Steps:
-
Edit β Configuration Profiles
-
Click New β Enter a Name
-
Customize settings (filters, columns, colors, etc.)
-
Click OK to save
3οΈβ£ Switching Profiles¶
-
Bottom-right corner β Select a profile from the list
-
Edit β Configuration Profiles to manage profiles
Wireshark Statistics Explained π¶
Wireshark provides various statistical tools for analyzing network traffic. Below is a detailed explanation of each option available under the Statistics menu.
1οΈβ£ Capture File Properties
π Location: Statistics β Capture File Properties πΉ Provides basic information about the capture file:
File name, size, and format Capture duration (start & end time) Packet count and average packet size Interface and capture filter used
2οΈβ£ Resolved Addresses
π Location: Statistics β Resolved Addresses πΉ Displays resolved MAC, IP, and DNS names from packet captures. β Useful for identifying human-readable names instead of raw IPs or MACs.
3οΈβ£ Protocol Hierarchy
π Location: Statistics β Protocol Hierarchy πΉ Shows the breakdown of network protocols used in the capture. β Useful for understanding protocol distribution and identifying dominant traffic types.
4οΈβ£ Conversations
π Location: Statistics β Conversations πΉ Displays active connections based on:
Ethernet (MAC addresses) IPv4/IPv6 (IP addresses) TCP/UDP (ports used in communication) β Helps analyze communication between specific devices.
5οΈβ£ Endpoints
π Location: Statistics β Endpoints πΉ Shows all network devices involved in communication. β Useful for identifying top talkers and analyzing device-level traffic.
6οΈβ£ Packet Lengths
π Location: Statistics β Packet Lengths πΉ Displays the distribution of packet sizes in the capture. β Helps detect: Too many small packets (inefficiency) Too many large packets (bulk data transfers)
7οΈβ£ I/O Graph
π Location: Statistics β I/O Graph πΉ Provides a graphical representation of network traffic over time. β Helps in performance monitoring, DDoS detection, and traffic analysis.
8οΈβ£ Service Response Time
π Location: Statistics β Service Response Time πΉ Measures response time of different services (HTTP, DNS, etc.). β Helps detect latency issues in network services.
9οΈβ£ DHCP (BOOTP) Statistics
π Location: Statistics β DHCP (BOOTP) πΉ Displays statistics on DHCP requests, offers, and leases. β Useful for analyzing DHCP issues in networks.
π NetPerfMeter Statistics
π Location: Statistics β NetPerfMeter πΉ Analyzes network performance metrics, such as bandwidth and delay.
11οΈβ£ ONC-RPC Programs
π Location: Statistics β ONC-RPC Programs πΉ Displays statistics for Remote Procedure Calls (RPCs). β Helps troubleshoot NFS and other RPC-based services.
12οΈβ£ 29West Statistics
π Location: Statistics β 29West πΉ Displays statistics related to 29West messaging middleware (used in financial services).
13οΈβ£ ANCP Statistics
π Location: Statistics β ANCP πΉ Displays statistics for Access Node Control Protocol (ANCP), used in DSL networks.
14οΈβ£ BACnet Statistics
π Location: Statistics β BACnet πΉ Analyzes BACnet protocol (used in building automation).
15οΈβ£ Collectd Statistics
π Location: Statistics β Collectd πΉ Displays statistics for Collectd, a system performance monitoring daemon.
16οΈβ£ DNS Statistics
π Location: Statistics β DNS πΉ Provides an overview of DNS queries and responses. β Helps detect slow DNS resolution or DNS attacks.
17οΈβ£ Flow Graph
π Location: Statistics β Flow Graph πΉ Visualizes packet flow between devices. β Helps in troubleshooting network communication issues.
18οΈβ£ HART-IP Statistics
π Location: Statistics β HART-IP πΉ Analyzes HART-IP protocol (used in industrial automation).
19οΈβ£ HPFeeds Statistics
π Location: Statistics β HPFeeds πΉ Displays statistics for HPFeeds, a protocol for honeypot data collection.
20οΈβ£ HTTP Statistics
π Location: Statistics β HTTP πΉ Shows HTTP traffic details:
Requests & responses
Top accessed URLs
Response codes (200, 404, etc.) β Helps analyze web traffic & performance issues.
21οΈβ£ HTTP2 Statistics
π Location: Statistics β HTTP2 πΉ Similar to HTTP statistics, but for the HTTP/2 protocol.
22οΈβ£ Sametime Statistics
π Location: Statistics β Sametime πΉ Displays statistics for IBM Sametime, an enterprise messaging service.
23οΈβ£ TCP Stream Graph
π Location: Statistics β TCP Stream Graph πΉ Graphs TCP performance metrics like:
Round Trip Time (RTT)
Throughput
Packet retransmissions β Helps diagnose network slowness & packet loss.
24οΈβ£ UDP Multicast Streams
π Location: Statistics β UDP Multicast Streams πΉ Displays multicast traffic statistics, used in IPTV and VoIP.
25οΈβ£ Reliable Server Pooling (RSerPool)
π Location: Statistics β RSerPool πΉ Displays statistics for RSerPool, a protocol for high-availability server pooling.
26οΈβ£ SOME/IP Statistics
π Location: Statistics β SOME/IP πΉ Analyzes SOME/IP protocol (used in automotive communication).
27οΈβ£ DTN Statistics
π Location: Statistics β DTN πΉ Displays statistics for Delay-Tolerant Networking (DTN), used in space communication.
28οΈβ£ F5 Statistics
π Location: Statistics β F5 πΉ Shows traffic related to F5 load balancers.
29οΈβ£ IPv4 Statistics
π Location: Statistics β IPv4 πΉ Provides insights into IPv4 traffic, including:
Packet count & errors
Fragmentation analysis
30οΈβ£ IPv6 Statistics
π Location: Statistics β IPv6 πΉ Similar to IPv4 statistics, but for IPv6 traffic.
TCP Three-Way Handshake in Wireshark π΅οΈββοΈ¶
The TCP three-way handshake is the process of establishing a reliable connection between a client and a server. It ensures both sides are ready before data transfer begins.
πΉ Steps in the Three-Way Handshake¶
1οΈβ£ SYN (Synchronize)¶
π The client sends a SYN packet to the server.
πΉ This packet contains:
-
SYN flag = 1 (indicates connection request)
-
Initial Sequence Number (ISN) (random number)
π Client β Server: SYN (Seq=1000)
2οΈβ£ SYN-ACK (Synchronize-Acknowledge)¶
π The server responds with a SYN-ACK packet.
πΉ This packet contains:
-
SYN = 1 (server agrees to start connection)
-
ACK = 1 (acknowledges client's SYN)
-
Server's ISN
π Server β Client: SYN-ACK (Seq=2000, Ack=1001)
3οΈβ£ ACK (Acknowledge)¶
π The client sends a final ACK packet to confirm the connection.
πΉ This packet contains:
- ACK = 1 (acknowledges server's SYN)
π Client β Server: ACK (Seq=1001, Ack=2001)
β Connection Established! π
πΉ RST (Reset) Packet¶
π RST is used to abruptly terminate a connection due to errors or unexpected behavior.
πΉ When an RST packet is sent:
-
The connection is immediately closed
-
No further communication happens
π Example: Server sends RST if it receives unexpected data.
πΉ Viewing TCP Handshake in Wireshark¶
π Steps to Capture TCP Handshake¶
-
Open Wireshark and start capturing packets.
-
Apply a filter to focus on TCP handshakes:
-
Initiate a connection, like opening a website or using SSH.
-
Stop the capture and analyze the handshake.
πΉ Identifying Handshake Packets in Wireshark¶
| Step | Source β Destination | Flags | Info |
|---|---|---|---|
| 1οΈβ£ SYN | Client β Server | SYN | SYN, Seq=1000 |
| 2οΈβ£ SYN-ACK | Server β Client | SYN, ACK | SYN, ACK, Seq=2000, Ack=1001 |
| 3οΈβ£ ACK | Client β Server | ACK | ACK, Seq=1001, Ack=2001 |
β Connection Established!
πΉ Filtering TCP Reset (RST) Packets¶
To find connections that were abruptly closed:
This will show RST packets, which indicate a connection reset.
πΉ TCP Stream Graph in Wireshark¶
-
Right-click on a TCP packet β "Follow TCP Stream"
-
See the full conversation between client and server.
-
Analyze TCP flow in Statistics β TCP Stream Graphs
π Quick Wireshark Filters¶
| Filter | Description |
|---|---|
tcp |
Show all TCP packets |
tcp.flags.syn == 1 |
Show only SYN packets |
tcp.flags.ack == 1 |
Show only ACK packets |
tcp.flags.reset == 1 |
Show only RST packets |
Now you can analyze TCP handshakes like a pro! π
UDP, DNS, and DHCP in Wireshark π΅οΈββοΈ¶
πΉ UDP (User Datagram Protocol)¶
UDP is a connectionless transport protocol used for fast, lightweight communication. Unlike TCP, it does not require a handshake or error correction.
π Capturing UDP Packets in Wireshark¶
-
Open Wireshark and start capturing packets.
-
Apply the UDP filter:
-
Look for source and destination ports (e.g., 53 for DNS, 67/68 for DHCP).
πΉ Key UDP Fields¶
-
Source Port: The port from which the packet was sent.
-
Destination Port: The receiving port.
-
Length: Size of the UDP packet.
-
Checksum: Used for error checking.
πΉ DNS (Domain Name System)¶
DNS translates domain names (e.g., google.com) into IP addresses. It mainly uses UDP port 53 but can use TCP for larger queries.
π Capturing DNS Packets in Wireshark¶
-
Start a capture and filter for DNS:
-
Visit any website or run:
-
Look for:
-
Query (Standard query A)
-
Response (Answer contains the IP address)
-
πΉ Key DNS Fields¶
-
Query Name: The domain being resolved.
-
Response: The resolved IP address.
-
Transaction ID: Unique identifier for the request.
πΉ DHCP (Dynamic Host Configuration Protocol)¶
DHCP assigns IP addresses dynamically to devices on a network. It uses UDP ports 67 (server) and 68 (client).
π Capturing DHCP Packets in Wireshark¶
-
Start a capture and filter for DHCP:
(DHCP was originally called BOOTP, so Wireshark uses
bootpfor filtering.) -
Restart your network interface to trigger a DHCP request.
πΉ Key DHCP Messages¶
| Message | Description |
|---|---|
| Discover | Client requests an IP address. |
| Offer | Server offers an available IP. |
| Request | Client requests the offered IP. |
| ACK | Server confirms the lease. |
π Quick Wireshark Filters¶
| Filter | Description |
|---|---|
udp |
Show all UDP packets |
dns |
Show only DNS packets |
bootp |
Show only DHCP packets |
udp.port == 53 |
Show only DNS traffic |
| `udp.port == 67 |
Now you can analyze UDP, DNS, and DHCP like a pro! π