Analyzing Network Traffic & Protocol Investigation
Section 7 of 12
Definition: Monitoring and analyzing network traffic to detect intrusions, investigate incidents, and gather evidence.
# Capture all traffic on eth0
tcpdump -i eth0 -w capture.pcap
# Capture with filters
tcpdump -i eth0 'tcp port 80' -w web.pcap
# Read from file
tcpdump -r capture.pcap 'host 192.168.1.100'
Only capture traffic on networks you own or have explicit authorization to monitor. Unauthorized packet capture may violate privacy laws.
Display filters help isolate specific traffic patterns in large captures.
# IP Address Filters
ip.addr == 192.168.1.100 # Any traffic to/from this IP
ip.src == 10.0.0.5 # Source IP only
ip.dst == 172.16.0.1 # Destination IP only
# Protocol Filters
http # All HTTP traffic
dns # All DNS queries/responses
tcp.port == 443 # HTTPS traffic
udp.port == 53 # DNS over UDP
# TCP Flags
tcp.flags.syn == 1 # SYN packets (connection attempts)
tcp.flags.reset == 1 # RST packets (connection resets)
tcp.analysis.retransmission # Retransmitted packets
# Combining Filters (AND, OR, NOT)
ip.src == 10.0.0.5 && tcp.port == 80
http || dns
!(arp || icmp) # Exclude ARP and ICMP
Wireshark: File → Export Objects → HTTP
Note: Encrypted content requires private keys
# Display only SYN packets from single source
tcp.flags.syn == 1 && tcp.flags.ack == 0 && ip.src == 192.168.1.100
# Statistics → Conversations → TCP (sort by packets)
# Statistics → Endpoints → IPv4 (sort by packets)
Leading GUI packet analyzer
Command-line packet capture
Passive network analyzer
Network security monitor
Intrusion Detection System
Full packet capture & search
Reassemble network sessions to understand complete communications.
Right-click packet → Follow → TCP/UDP/HTTP/TLS Stream
# Extract all HTTP objects
tshark -r capture.pcap --export-objects http,./extracted_files/
# Follow TCP stream #5
tshark -r capture.pcap -z follow,tcp,ascii,5
# Extract specific stream
tshark -r capture.pcap -qz follow,tcp,ascii,0 > stream0.txt
# Using tshark
tshark -r capture.pcap -T fields -e ip.dst | sort -u > unique_ips.txt
# Extract DNS queries
tshark -r capture.pcap -Y "dns.flags.response == 0" -T fields -e dns.qry.name | sort -u
# Find connections to specific IP
tshark -r capture.pcap -Y "ip.addr == 203.0.113.50"