HSR Sector 6 · Bangalore +91 96110 27980 Mon–Sat · 09:30–20:30
Chapter 13 of 20 — Ethical Hacking & Penetration Testing
intermediate Chapter 13 of 20

Network Sniffing — Wireshark, tcpdump & Packet Analysis

By Vikas Swami, CCIE #22239 | Updated Mar 2026 | Free Course

What is Network Sniffing — Capturing Traffic on the Wire

Network sniffing, also known as packet capturing or network traffic analysis, is the process of intercepting and logging data packets that traverse a computer network. It is an essential technique in both security assessments and network troubleshooting. By capturing traffic, security professionals can analyze data flows, identify vulnerabilities, and detect malicious activities.

In the context of ethical hacking and penetration testing, network sniffing with tools like Wireshark and tcpdump enables testers to observe real-time data exchanges between hosts, servers, and network devices. This visibility is crucial for understanding how data moves across networks, identifying unencrypted sensitive information, and spotting anomalies indicative of security breaches.

Typical scenarios where network sniffing is employed include troubleshooting network issues, monitoring network performance, and conducting security audits. While malicious actors may use sniffing for cyber espionage or data theft, authorized security professionals leverage this technique ethically to strengthen network defenses. Proper understanding of network protocols, filtering, and data analysis is vital to effectively perform network sniffing without disrupting normal operations or violating privacy policies.

At Networkers Home, our comprehensive courses cover these core principles, empowering students with hands-on experience in network traffic capture and analysis.

Promiscuous Mode & Monitor Mode — How to Capture All Traffic

To effectively perform network sniffing, especially in a controlled environment for penetration testing, setting network interfaces into promiscuous mode or monitor mode is essential. These modes allow network interfaces to capture all packets on the network segment, not just those addressed to the host machine.

Promiscuous mode is used primarily in wired Ethernet networks. When enabled, the network interface card (NIC) forwards all traffic it receives to the operating system, regardless of the destination MAC address. This mode is vital for capturing complete traffic flows in LAN environments and is supported by most network tools like Wireshark and tcpdump.

In contrast, monitor mode is used predominantly in wireless networks. It allows wireless network interfaces to capture all wireless frames in the vicinity, including management frames, control frames, and data frames, regardless of the associated network or access point. This mode is essential for analyzing Wi-Fi traffic, detecting rogue access points, or conducting wireless security assessments.

Enabling promiscuous mode in Linux can be done via command-line tools:

sudo ifconfig eth0 promisc

For monitor mode on Wi-Fi interfaces, tools like Aircrack-ng are used:

sudo airmon-ng start wlan0

Understanding when and how to use these modes is fundamental for network sniffing and packet analysis. Proper configuration ensures comprehensive data capture, which is vital for accurate security assessments or troubleshooting.

Networkers Home offers in-depth training on network interface management, ensuring students master these configurations for effective packet analysis. For more insights, visit our Networkers Home Blog.

Wireshark — Installation, Interface & Capture Filters

Wireshark is the most popular open-source network protocol analyzer used widely for network sniffing Wireshark. Its graphical interface makes it accessible for both beginners and advanced users, providing detailed insights into network traffic. Installing Wireshark is straightforward across multiple OS platforms.

**Installation Steps:**

  1. Download the installer from the official website: Wireshark Downloads.
  2. Follow the setup wizard, which typically includes installing WinPcap or Npcap (for Windows) to facilitate packet capture.
  3. On Linux, install via package managers, e.g., sudo apt install wireshark.

**Interface & Main Window:**

Upon launching Wireshark, users are presented with a list of network interfaces. Selecting an interface initiates live packet capture. The main window displays captured packets with columns such as Time, Source, Destination, Protocol, Length, and Info.

**Capture Filters:**

Capture filters are essential for limiting data to relevant traffic, reducing noise and improving analysis efficiency. Filters are applied before starting capture and use the Berkeley Packet Filter (BPF) syntax. Examples include:

  • port 80 — captures HTTP traffic
  • ip host 192.168.1.10 — captures traffic to/from specific IP
  • tcp — captures all TCP packets

To set a capture filter, input it into the filter box before clicking "Start". This ensures only relevant packets are captured, making subsequent analysis more manageable.

Understanding interface configuration and filter application in Wireshark is fundamental for precise packet analysis, especially during security assessments. For a detailed Wireshark tutorial, visit the Networkers Home Blog.

Wireshark Display Filters — Finding What You Need in Captured Data

While capture filters limit the data collected, display filters enable analysts to sift through captured packets efficiently. These filters are applied after data capture, allowing for dynamic analysis and targeted investigation. Wireshark display filters use a specific syntax that closely resembles expressions used in programming languages.

Common display filters include:

  • http — filters HTTP protocol packets
  • dns — filters DNS query and response packets
  • tcp.port == 443 — filters TCP traffic on port 443 (HTTPS)
  • ssl.handshake — filters SSL/TLS handshake packets

For example, to locate credentials transmitted via HTTP Basic Authentication, a filter like http.authbasic can be used. Similarly, to find unencrypted passwords, filtering for plain text protocols such as FTP or Telnet (ftp, telnet) is useful.

Wireshark's filter syntax permits complex expressions, combining multiple conditions with logical operators like and, or, and not. For example:

http.request and ip.src == 192.168.1.100

This filter finds HTTP requests originating from a specific IP address, aiding in pinpointing suspicious activity.

Mastering Wireshark display filters significantly enhances packet analysis efficiency, enabling security professionals to quickly locate relevant data, identify anomalies, and extract valuable forensic information. For more advanced filtering techniques, consult the Networkers Home Blog.

tcpdump — Command-Line Packet Capture on Linux

For users preferring command-line tools, tcpdump provides powerful, flexible packet capturing capabilities on Linux and other Unix-like systems. It is often used by network administrators and security analysts for quick, scriptable traffic analysis without the overhead of a GUI.

Basic Usage:

sudo tcpdump -i eth0

This command captures all traffic on interface eth0. To filter specific traffic, tcpdump uses BPF syntax similar to Wireshark capture filters. Examples include:

  • sudo tcpdump -i wlan0 port 80 — captures HTTP traffic on wireless interface
  • sudo tcpdump -i eth0 src 192.168.1.10 — captures packets originating from a specific IP
  • sudo tcpdump -i eth0 dst port 22 — captures SSH traffic destined for port 22

Advanced options include saving captured data to a file for later analysis:

sudo tcpdump -i eth0 -w capture.pcap

To read a capture file, use:

tcpdump -r capture.pcap

tcpdump supports complex filtering expressions, enabling detailed traffic analysis essential for security assessments, forensic investigations, or troubleshooting. Its command-line nature allows automation and integration into scripts, making it indispensable for experienced network professionals.

For comprehensive tutorials on tcpdump commands, visit the Networkers Home Blog.

ARP Spoofing & MITM — Redirecting Traffic for Sniffing

Advanced network sniffing often involves techniques like ARP spoofing and Man-in-the-Middle (MITM) attacks to intercept traffic that would otherwise be encrypted or inaccessible. While these techniques are malicious when used without authorization, they are also employed ethically in penetration testing to evaluate network defenses.

ARP Spoofing manipulates the Address Resolution Protocol (ARP) cache, associating the attacker's MAC address with the IP address of a target device or gateway. This causes traffic meant for the legitimate device to be rerouted through the attacker’s machine.

Tools like Ettercap and Bettercap facilitate ARP spoofing. For example, using Ettercap:

sudo ettercap -T -M arp:remote /192.168.1.1/ /192.168.1.100/

This command intercepts traffic between the gateway (192.168.1.1) and the target host (192.168.1.100). Once in position, the attacker can capture traffic with Wireshark or tcpdump.

MITM attacks enable intercepting unencrypted data, including credentials, session cookies, and other sensitive information. However, modern networks employ measures like HTTPS, SSH, and network segmentation to mitigate these risks.

Proper ethical use of ARP spoofing and MITM techniques requires explicit authorization. These methods are critical tools for pentesters and network defenders to identify vulnerabilities and improve security posture.

Networkers Home provides training on these advanced topics, emphasizing ethical and legal considerations while mastering packet interception techniques. Explore more at our cybersecurity courses.

Analyzing Captured Traffic — Credentials, DNS, HTTP & TLS

Once traffic is captured with Wireshark or tcpdump, the next step involves in-depth packet analysis to extract actionable insights. Key focus areas include credentials, DNS queries, HTTP data, and TLS handshakes.

Credentials: Unencrypted protocols like HTTP, FTP, Telnet, and SMTP often transmit login information in plaintext. Examining HTTP requests in Wireshark, for example, can reveal Basic Authentication headers:

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Decoding Base64 credentials provides usernames and passwords. In tcpdump, matching filters like http.authbasic help locate these credentials.

DNS Traffic: DNS queries and responses can reveal browsing habits, internal hostnames, and malicious domains. Filtering for DNS in Wireshark with dns helps identify suspicious lookups or data exfiltration attempts.

HTTP & TLS: HTTP traffic can include form submissions, cookies, and other sensitive data. TLS encrypts this data, but analyzing the TLS handshake (e.g., using Wireshark's SSL dissector) can reveal server certificates and session details.

In security assessments, identifying unencrypted credentials or misconfigured TLS implementations provides critical insights. Extracting and analyzing these packets requires meticulous filtering and understanding of protocol specifics.

Practitioners must also be aware of legal and ethical boundaries while performing deep packet inspection. For practical skills, consider training at Networkers Home.

Packet Analysis for Incident Response — Finding IOCs in Captures

In incident response scenarios, analyzing network captures for Indicators of Compromise (IOCs) is crucial for identifying ongoing threats or breaches. Techniques include searching for unusual traffic patterns, suspicious payloads, and known malicious signatures.

Key steps involve:

  • Identifying anomalous internal-to-external communications.
  • Detecting data exfiltration through unusual DNS queries or large outbound data transfers.
  • Locating known malicious domains or IP addresses via threat intelligence feeds integrated into analysis tools.
  • Spotting suspicious protocols or ports being used unexpectedly.

Wireshark's coloring rules and expert info can flag abnormal packets, while filters like ip.addr == 10.0.0.5 && tcp.port == 4444 help isolate attacker activity. Similarly, tcpdump scripts can automate detection of specific patterns.

Deep packet inspection aids in reconstructing attack timelines, understanding attacker methods, and collecting forensic evidence. Combining traffic analysis with threat intelligence enhances detection accuracy.

Training in network security analysis, such as that offered at Networkers Home, equips professionals to efficiently identify and respond to security incidents.

Key Takeaways

  • Network sniffing involves capturing and analyzing network traffic to identify vulnerabilities and monitor activity.
  • Promiscuous mode and monitor mode enable comprehensive traffic capture on wired and wireless networks.
  • Wireshark offers a user-friendly interface for packet capturing, filtering, and deep analysis; mastering filters is essential.
  • tcpdump provides powerful command-line capabilities for scriptable, quick traffic analysis on Linux systems.
  • Techniques like ARP spoofing and MITM are used ethically in penetration testing to evaluate network defenses.
  • Analyzing captured data for credentials, DNS queries, and protocol details helps uncover security issues.
  • Packet analysis supports incident response by identifying malicious activity and IOC indicators in network captures.

Frequently Asked Questions

What is the primary difference between Wireshark and tcpdump?

Wireshark is a graphical user interface-based tool that provides detailed, real-time packet analysis with advanced filtering and visualization capabilities. It is user-friendly, suitable for detailed forensic analysis and learning. tcpdump, on the other hand, is a command-line utility optimized for quick, scriptable packet captures and filtering, ideal for automated workflows and remote server analysis. Both tools support BPF syntax for filtering, but Wireshark excels in visualization and protocol decoding, while tcpdump offers speed and simplicity. Understanding their strengths allows security professionals to choose the appropriate tool for specific tasks during network analysis or penetration testing.

How can network sniffing Wireshark be used ethically in penetration testing?

Ethical use of network sniffing Wireshark in penetration testing requires explicit authorization from the network owner. It involves performing packet captures within the scope of a sanctioned security assessment, ensuring no sensitive data is mishandled or privacy policies are violated. Properly documenting procedures, limiting data collection to relevant segments, and securely storing captured data are essential practices. Using Wireshark to identify vulnerabilities or misconfigurations helps strengthen security posture. Ethical practitioners also ensure that traffic analysis does not disrupt normal network operations. Training at institutes like Networkers Home emphasizes the importance of legality and professionalism in ethical hacking activities.

What are some common capture filters used in Wireshark for network security analysis?

Common capture filters in Wireshark include port 80 for HTTP traffic, ip host 192.168.1.10 for traffic involving a specific IP, tcp or udp for protocol-specific captures, and dst port 443 for HTTPS traffic. For more targeted analysis, filters like http.request help locate HTTP requests, while dns captures DNS queries. Combining filters with logical operators such as and and or allows precise traffic collection. Mastering these filters enhances the efficiency of packet capture and analysis, enabling security professionals to pinpoint suspicious activities effectively. For extensive filtering techniques, explore resources on the Networkers Home Blog.

Ready to Master Ethical Hacking & Penetration Testing?

Join 45,000+ students at Networkers Home. CCIE-certified trainers, 24x7 real lab access, and 100% placement support.

Explore Course