Packet sniffing is the process of capturing and logging network traffic. It allows you to inspect the data packets that are transmitted over a network.
Browse / Packet Sniffing Cheatsheet
Packet Sniffing Cheatsheet
A concise cheat sheet covering packet sniffing techniques, tools, and essential commands for network analysis and troubleshooting. This guide provides a quick reference for capturing and analyzing network traffic.
Introduction to Packet Sniffing
What is Packet Sniffing?
|
It is used for network troubleshooting, security analysis, and monitoring network performance. |
Ethical use requires explicit permission from network administrators. |
Key Concepts
Promiscuous Mode |
Network interface card (NIC) captures all packets on the network, not just those addressed to it. |
Packet Analyzer |
Software or hardware used to capture and analyze network packets. |
Capture Filter |
Defines which packets to capture based on criteria like IP address, port, or protocol. |
Common Tools
|
Using tcpdump
Basic tcpdump Usage
Capture all packets on the default interface:
|
Capture packets on a specific interface:
|
Capture a specific number of packets:
|
Filtering with tcpdump
Capture packets from a specific host: |
|
Capture packets to a specific host: |
|
Capture packets on a specific port: |
|
Capture TCP packets: |
|
Capture UDP packets: |
|
Saving captured packets
Save captured packets to a file:
|
Read packets from a capture file:
|
Using Wireshark
Wireshark Interface
Wireshark provides a graphical user interface for capturing and analyzing packets.
|
Basic Wireshark Usage
|
Wireshark Display Filters
Filter by IP Address: |
|
Filter by Source IP Address: |
|
Filter by Destination IP Address: |
|
Filter by Port: |
|
Filter by Protocol: |
|
Advanced Techniques
Following TCP Streams
Wireshark allows you to follow TCP streams to view the entire conversation between two endpoints.
|
This displays the entire TCP conversation in a new window, making it easier to analyze the data exchanged. |
Analyzing HTTP Traffic
Filter HTTP traffic: |
|
View HTTP request headers: |
Expand the ‘Hypertext Transfer Protocol’ section in the Packet Details pane. |
View HTTP response data: |
Look for the ‘HTTP Data’ section in the Packet Details pane. |
Detecting Anomalies
Packet sniffing can be used to detect network anomalies such as:
|
Analyze packet sizes, protocols, and communication patterns to identify potential security threats. |